mirror of
https://shylinux.com/x/ContextOS
synced 2025-04-25 08:48:06 +08:00
add alpine
This commit is contained in:
parent
d9daf68f2b
commit
03df7160a2
2
Makefile
2
Makefile
@ -17,6 +17,8 @@ prepare:
|
||||
@go get github.com/skip2/go-qrcode
|
||||
@go get gopkg.in/gomail.v2
|
||||
|
||||
linux:
|
||||
GOOS=linux $(BUILD)$(TARGET).linux.$(shell go env GOARCH) $(BENCH)
|
||||
linux_arm:
|
||||
GOARCH=arm GOOS=linux $(BUILD)$(TARGET).linux.arm $(BENCH)
|
||||
linux32:
|
||||
|
@ -160,7 +160,7 @@ var Index = &ctx.Context{Name: "cli", Help: "管理中心",
|
||||
},
|
||||
}, Help: "运行环境, host, init, boot, node, user, work"},
|
||||
"system": &ctx.Config{Name: "system", Value: map[string]interface{}{
|
||||
"timeout": "60s",
|
||||
"timeout": "180s",
|
||||
"env": map[string]interface{}{},
|
||||
"shell": map[string]interface{}{
|
||||
"sh": map[string]interface{}{"cmd": "bash"},
|
||||
|
@ -613,8 +613,12 @@ func (m *Message) Cmd(args ...interface{}) *Message {
|
||||
|
||||
} else if strings.Contains(key, ".") {
|
||||
arg := strings.Split(key, ".")
|
||||
if msg, key = msg.Sess(arg[0]), arg[1]; msg != nil {
|
||||
if msg, key = m.Sess(arg[0]), arg[1]; msg != nil {
|
||||
msg.Option("remote_code", "")
|
||||
|
||||
} else if msg, key = m.Find(strings.Join(arg[0:len(arg)-1], "."), true), arg[len(arg)-1]; msg != nil {
|
||||
msg.Option("remote_code", "")
|
||||
|
||||
}
|
||||
}
|
||||
if msg == nil {
|
||||
|
@ -50,7 +50,7 @@ func dir(m *ctx.Message, root string, name string, level int, deep bool, dir_typ
|
||||
if f, e = os.Lstat(p); e != nil {
|
||||
m.Log("info", "%s", e)
|
||||
continue
|
||||
} else if (f.Mode() & os.ModeSymlink) != 0 {
|
||||
} else if (f.Mode()&os.ModeSymlink) != 0 && f.IsDir() {
|
||||
continue
|
||||
}
|
||||
|
||||
|
@ -33,8 +33,20 @@ CMD sh bin/boot.sh
|
||||
Help: "终端", Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) (e error) {
|
||||
p, arg := kit.Select(".", arg[0]), arg[1:]
|
||||
switch arg[0] {
|
||||
case "install":
|
||||
m.Cmd("cli.system", "apk", "add", arg[1])
|
||||
case "init":
|
||||
m.Cmd("cli.system", "apk", "update")
|
||||
switch arg[1] {
|
||||
case "build":
|
||||
m.Cmd("cli.system", "apk", "add", "nginx")
|
||||
m.Cmd("cli.system", "apk", "add", "redis")
|
||||
m.Cmd("cli.system", "apk", "add", "tmux")
|
||||
m.Cmd("cli.system", "apk", "add", "zsh")
|
||||
m.Cmd("cli.system", "apk", "add", "git")
|
||||
m.Cmd("cli.system", "apk", "add", "vim")
|
||||
m.Cmd("cli.system", "apk", "add", "build-base")
|
||||
m.Cmd("cli.system", "apk", "add", "golang")
|
||||
m.Cmd("cli.system", "apk", "add", "mysql")
|
||||
}
|
||||
|
||||
case "list":
|
||||
m.Cmdy("nfs.dir", p, "time", "size", "path")
|
||||
@ -84,6 +96,8 @@ CMD sh bin/boot.sh
|
||||
case "tail":
|
||||
m.Cmdy("cli.system", "tail", path.Join(p, arg[1]))
|
||||
|
||||
default:
|
||||
m.Cmdy("cli.system", arg)
|
||||
}
|
||||
return
|
||||
}},
|
||||
@ -295,6 +309,11 @@ CMD sh bin/boot.sh
|
||||
return
|
||||
}},
|
||||
"git": {Name: "git", Help: "版本", Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) (e error) {
|
||||
prefix := []string{"cli.system", "git"}
|
||||
switch arg[0] {
|
||||
case "init":
|
||||
m.Cmdy(prefix, "config", "alias.s", "status")
|
||||
}
|
||||
m.Echo("git")
|
||||
return
|
||||
}},
|
||||
|
@ -1,6 +1,7 @@
|
||||
kit shell "命令" private "web.code.zsh" \
|
||||
kit shell "命令" private "ssh._route" _ "context" "find" "web.code" "zsh" \
|
||||
text "" name pod imports plugin_pod \
|
||||
text "" name dir imports plugin_path action auto \
|
||||
select "" name cmd values list values find values grep values tail \
|
||||
select "" name cmd values list values find values grep values tail values init \
|
||||
exports path path \
|
||||
text "" name txt \
|
||||
feature display editor \
|
||||
@ -29,7 +30,7 @@ kit image "镜像" private "web.code.docker" "image" \
|
||||
text "" name tag imports plugin_TAG \
|
||||
exports IMAGE_ID IMAGE_ID "" REPOSITORY REPOSITORY "" TAG TAG "" \
|
||||
feature detail "运行" "删除" "清理" \
|
||||
button "查看" action auto
|
||||
button "查看"
|
||||
|
||||
kit container "容器" private "web.code.docker" "container" \
|
||||
text "" name arg imports plugin_CONTAINER_ID \
|
||||
@ -37,10 +38,15 @@ kit container "容器" private "web.code.docker" "container" \
|
||||
feature detail "进入" "停止" "启动" "重启" "修改" "删除" "清理" \
|
||||
button "查看" action auto
|
||||
|
||||
kit command "命令" private "web.code.docker" "container" \
|
||||
text "" name tag imports plugin_CONTAINER_ID \
|
||||
text "pwd" name cmd view long \
|
||||
button "执行"
|
||||
|
||||
kit network "网络" private "web.code.docker" "network" \
|
||||
text "" name arg imports plugin_NETWORK_ID action auto \
|
||||
exports NETWORK_ID NETWORK_ID \
|
||||
button "查看" action auto
|
||||
button "查看"
|
||||
|
||||
kit volume "存储" private "web.code.docker" "volume" \
|
||||
text "" name arg imports plugin_CONTAINER_ID \
|
||||
|
@ -1220,7 +1220,7 @@ function Plugin(page, pane, field, inits, runs) {
|
||||
var meta = arguments.callee.meta
|
||||
var list = arguments.callee.list
|
||||
|
||||
for (var i = 0; i < list.length; i += 3) {if (list[i+1] == name) {
|
||||
for (var i = 0; i < list.length; i += 3) {if (list[i+1] == name || list[i+2]) {
|
||||
for (var i = 0; i < list.length; i += 3) {
|
||||
page.Sync("plugin_"+list[i]).set(meta[list[i+2]||""](list[i+1]? line[list[i+1]]: value, list[i+1]||name, line, list))
|
||||
}
|
||||
@ -1487,7 +1487,7 @@ function Output(plugin, type, msg, cb, target, option) {
|
||||
},
|
||||
inner: function(msg, cb) {
|
||||
target.innerHTML = "", plugin.onfigure.meta.max(target)
|
||||
output.onimport.meta._table(msg, msg.append) || (target.innerHTML = msg.result.join(""))
|
||||
output.onimport.meta._table(msg, msg.append) || kit.OrderCode(kit.ModifyNode(target, msg.result.join("")))
|
||||
kit._call(cb, [msg])
|
||||
},
|
||||
code: function(msg, cb) {
|
||||
|
@ -386,6 +386,9 @@ kit = toolkit = (function() {var kit = {__proto__: document,
|
||||
// HTML显示文本
|
||||
OrderCode: function(code) {if (!code) {return}
|
||||
code.onclick = function(event) {kit.CopyText()}
|
||||
kit.Selector(code, "a", function(item) {
|
||||
item.target = "_blank"
|
||||
})
|
||||
},
|
||||
OrderLink: function(link) {link.target = "_blank"},
|
||||
OrderText: function(pane, text) {
|
||||
|
79
usr/local/wiki/自然/编程/终端工具链/alpine.md
Normal file
79
usr/local/wiki/自然/编程/终端工具链/alpine.md
Normal file
@ -0,0 +1,79 @@
|
||||
## alpine
|
||||
|
||||
- 官网: https://www.alpinelinux.org/
|
||||
- 文档: https://wiki.alpinelinux.org/
|
||||
- 源码: https://github.com/alpinelinux/docker-alpine
|
||||
- 博客: https://blog.csdn.net/zl1zl2zl3/article/details/80118001
|
||||
|
||||
## 安装
|
||||
|
||||
```
|
||||
docker run alpine -it pwd
|
||||
```
|
||||
|
||||
## 安装
|
||||
### 主机名
|
||||
```
|
||||
$ echo myos > /etc/hostname
|
||||
$ hostname -F /etc/hostname
|
||||
$ sed -i -r 's#127.0.0.1.*#127.0.0.1 myos#g' /etc/hosts
|
||||
$ /etc/resolv.conf
|
||||
```
|
||||
|
||||
### 网络配置
|
||||
```
|
||||
$ ip
|
||||
$ ping
|
||||
$ udhcpc
|
||||
$ ifconfig
|
||||
$ /etc/network/interfaces
|
||||
auto lo
|
||||
iface lo inet lookback
|
||||
auto eth0
|
||||
iface eth0 inet dhcp
|
||||
iface eth1 inet static
|
||||
iface eth1 inet static
|
||||
address 192.168.1.21
|
||||
netmask 255.255.0.0
|
||||
gateway 192.168.1.1
|
||||
|
||||
$ wpa_supplicant
|
||||
$ /etc/wpa_supplicant/wpa_supplicant.conf
|
||||
```
|
||||
|
||||
### 包工具
|
||||
```
|
||||
/etc/apk/repositories
|
||||
/var/cache/apk
|
||||
/etc/apk/world
|
||||
$ apk
|
||||
$ apk update
|
||||
$ apk search
|
||||
$ apk cache
|
||||
$ apk info
|
||||
$ apk add
|
||||
$ apk del
|
||||
```
|
||||
|
||||
### 开发环境
|
||||
|
||||
```
|
||||
$ apk update
|
||||
$ apk add build-base
|
||||
```
|
||||
|
||||
```
|
||||
/* vi hi.c */
|
||||
#include<stdio.h>
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
println("hello c world!");
|
||||
}
|
||||
```
|
||||
|
||||
```
|
||||
$ gcc hi.c -o hi
|
||||
$ ./hi
|
||||
hello c world!
|
||||
```
|
||||
|
Loading…
x
Reference in New Issue
Block a user