forked from x/ContextOS
opt some
This commit is contained in:
parent
1edf3227b9
commit
07b6af2772
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,6 +1,7 @@
|
|||||||
var/
|
var/
|
||||||
pkg/
|
pkg/
|
||||||
*.swp
|
*.swp
|
||||||
|
*.swo
|
||||||
# Binaries for programs and plugins
|
# Binaries for programs and plugins
|
||||||
*.exe
|
*.exe
|
||||||
*.dll
|
*.dll
|
||||||
|
13
Makefile
13
Makefile
@ -1,5 +1,6 @@
|
|||||||
|
|
||||||
BENCH=src/examples/app/bench.go
|
BENCH=src/examples/app/bench.go
|
||||||
|
upgrade=usr/upgrade/
|
||||||
|
|
||||||
install:
|
install:
|
||||||
@go get github.com/nsf/termbox-go
|
@go get github.com/nsf/termbox-go
|
||||||
@ -50,17 +51,17 @@ tar_all: tar linux64 darwin win64
|
|||||||
tar zcvf tar.tgz tar
|
tar zcvf tar.tgz tar
|
||||||
|
|
||||||
linux_arm:
|
linux_arm:
|
||||||
GOARCH=arm GOOS=linux go build -o bench.linux.arm $(BENCH)
|
GOARCH=arm GOOS=linux go build -o $(upgrade)bench.linux.arm $(BENCH)
|
||||||
linux32:
|
linux32:
|
||||||
GOARCH=386 GOOS=linux go build -o bench.linux32 $(BENCH)
|
GOARCH=386 GOOS=linux go build -o $(upgrade)bench.linux32 $(BENCH)
|
||||||
linux64:
|
linux64:
|
||||||
GOARCH=amd64 GOOS=linux go build -o bench.linux64 $(BENCH)
|
GOARCH=amd64 GOOS=linux go build -o $(upgrade)bench.linux64 $(BENCH)
|
||||||
darwin:
|
darwin:
|
||||||
GOARCH=amd64 GOOS=darwin go build -o bench.darwin $(BENCH)
|
GOARCH=amd64 GOOS=darwin go build -o $(upgrade)bench.darwin $(BENCH)
|
||||||
win32:
|
win32:
|
||||||
GOARCH=386 GOOS=windows go build -o bench.win32.exe $(BENCH)
|
GOARCH=386 GOOS=windows go build -o $(upgrade)bench.win32.exe $(BENCH)
|
||||||
win64:
|
win64:
|
||||||
GOARCH=amd64 GOOS=windows go build -o bench.win64.exe $(BENCH)
|
GOARCH=amd64 GOOS=windows go build -o $(upgrade)bench.win64.exe $(BENCH)
|
||||||
|
|
||||||
|
|
||||||
DOTS=etc/dotsfile
|
DOTS=etc/dotsfile
|
||||||
|
22
etc/init.shy
22
etc/init.shy
@ -1,23 +1,3 @@
|
|||||||
|
source common.shy
|
||||||
source local.shy
|
source local.shy
|
||||||
|
|
||||||
~ssh
|
|
||||||
remote listen :9090 right sub
|
|
||||||
~aaa
|
|
||||||
role void componet source js_token
|
|
||||||
|
|
||||||
role tech componet mp command share
|
|
||||||
role tech componet chat command share
|
|
||||||
role tech componet chat command nfs.pwd ls
|
|
||||||
|
|
||||||
role tech componet index command source
|
|
||||||
role tech componet index command context
|
|
||||||
|
|
||||||
role tech componet remote command nfs.pwd ls
|
|
||||||
|
|
||||||
role tech componet source command nfs.pwd ls
|
|
||||||
|
|
||||||
user root shy shy
|
|
||||||
user tech sub sub
|
|
||||||
~web
|
|
||||||
config spide "" client "localhost:9094"
|
|
||||||
serve
|
|
||||||
|
@ -6,6 +6,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
|
"path"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
@ -214,12 +215,18 @@ var Index = &ctx.Context{Name: "code", Help: "代码中心",
|
|||||||
},
|
},
|
||||||
}, Help: "组件列表"},
|
}, Help: "组件列表"},
|
||||||
"upgrade": &ctx.Config{Name: "upgrade", Value: map[string]interface{}{
|
"upgrade": &ctx.Config{Name: "upgrade", Value: map[string]interface{}{
|
||||||
|
"system": []interface{}{"exit_shy", "common_shy", "init_shy", "bench", "boot.sh"},
|
||||||
|
"portal": []interface{}{"code_tmpl", "code_js", "context_js"},
|
||||||
"file": map[string]interface{}{
|
"file": map[string]interface{}{
|
||||||
"boot_sh": "bin/boot.sh",
|
"boot_sh": "bin/boot.sh",
|
||||||
"bench": "bin/bench.new",
|
"bench": "bin/bench.new",
|
||||||
"init_shy": "etc/init.shy",
|
"init_shy": "etc/init.shy",
|
||||||
"common_shy": "etc/common.shy",
|
"common_shy": "etc/common.shy",
|
||||||
"exit_shy": "etc/exit.shy",
|
"exit_shy": "etc/exit.shy",
|
||||||
|
|
||||||
|
"code_tmpl": "usr/template/code/code.tmpl",
|
||||||
|
"code_js": "usr/librarys/code.js",
|
||||||
|
"context_js": "usr/librarys/context.js",
|
||||||
},
|
},
|
||||||
}, Help: "日志地址"},
|
}, Help: "日志地址"},
|
||||||
},
|
},
|
||||||
@ -235,28 +242,43 @@ var Index = &ctx.Context{Name: "code", Help: "代码中心",
|
|||||||
p = bench
|
p = bench
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
m.Log("fuck", "wha t%v", p)
|
||||||
|
|
||||||
|
if _, e = os.Stat(p); e != nil {
|
||||||
|
list := strings.Split(key, "/")
|
||||||
|
m.Log("fuck", "wha t%v", list)
|
||||||
|
p = m.Cmdx("nfs.path", m.Conf("upgrade", []string{"file", list[len(list)-1]}))
|
||||||
|
}
|
||||||
|
m.Log("fuck", "wha t%v", e)
|
||||||
|
|
||||||
m.Log("info", "upgrade %s %s", p, m.Cmdx("aaa.hash", "file", p))
|
m.Log("info", "upgrade %s %s", p, m.Cmdx("aaa.hash", "file", p))
|
||||||
http.ServeFile(m.Optionv("response").(http.ResponseWriter), m.Optionv("request").(*http.Request), p)
|
http.ServeFile(m.Optionv("response").(http.ResponseWriter), m.Optionv("request").(*http.Request), p)
|
||||||
return
|
return
|
||||||
}},
|
}},
|
||||||
"upgrade": &ctx.Command{Name: "upgrade system|script", Help: "服务升级", Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) (e error) {
|
"upgrade": &ctx.Command{Name: "upgrade system|portal|script", Help: "服务升级", Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) (e error) {
|
||||||
if len(arg) == 0 {
|
if len(arg) == 0 {
|
||||||
m.Cmdy("ctx.config", "upgrade", "file")
|
m.Cmdy("ctx.config", "upgrade")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if arg[0] == "system" {
|
if m.Confs("upgrade", arg[0]) {
|
||||||
arg = arg[1:]
|
arg = arg[1:]
|
||||||
m.Confm("upgrade", "file", func(key string, value string) {
|
m.Confm("upgrade", arg[0], func(index int, value string) {
|
||||||
arg = append(arg, key)
|
arg = append(arg, value)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
restart := false
|
restart := false
|
||||||
for _, link := range arg {
|
for _, link := range arg {
|
||||||
if file := m.Conf("upgrade", []string{"file", link}); file != "" {
|
if file := m.Conf("upgrade", []string{"file", link}); file != "" {
|
||||||
if m.Cmd("web.get", "dev", fmt.Sprintf("code/upgrade/%s", link), "save", file); strings.HasPrefix(file, "bin/") {
|
dir := path.Dir(file)
|
||||||
|
if _, e = os.Stat(dir); e != nil {
|
||||||
|
e = os.Mkdir(dir, 0777)
|
||||||
|
m.Assert(e)
|
||||||
|
}
|
||||||
|
if m.Cmd("web.get", "dev", fmt.Sprintf("code/upgrade/%s", link),
|
||||||
|
"GOOS", m.Conf("runtime", "GOOS"), "GOARCH", m.Conf("runtime", "GOARCH"),
|
||||||
|
"save", file); strings.HasPrefix(file, "bin/") {
|
||||||
if m.Cmd("cli.system", "chmod", "u+x", file); link == "bench" {
|
if m.Cmd("cli.system", "chmod", "u+x", file); link == "bench" {
|
||||||
m.Cmd("cli.system", "mv", "bin/bench", fmt.Sprintf("bin/bench_%s", m.Time("20060102_150405")))
|
m.Cmd("cli.system", "mv", "bin/bench", fmt.Sprintf("bin/bench_%s", m.Time("20060102_150405")))
|
||||||
m.Cmd("cli.system", "mv", "bin/bench.new", "bin/bench")
|
m.Cmd("cli.system", "mv", "bin/bench.new", "bin/bench")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user