1
0
mirror of https://shylinux.com/x/ContextOS synced 2025-04-25 16:58:06 +08:00

opt boot.sh

This commit is contained in:
shylinux 2019-06-16 10:40:53 +08:00
parent ad59a74939
commit 227b3475d1
12 changed files with 130 additions and 96 deletions

View File

@ -4,8 +4,8 @@ ctx_log=${ctx_log:="var/log"}
ctx_app=${ctx_app:="bench"} ctx_app=${ctx_app:="bench"}
ctx_bin=${ctx_app} && [ -f bin/${ctx_app} ] && ctx_bin=$(pwd)/bin/${ctx_app} ctx_bin=${ctx_app} && [ -f bin/${ctx_app} ] && ctx_bin=$(pwd)/bin/${ctx_app}
# ctx_box= # ctx_box=
ctx_dev=${ctx_dev:="https://shylinux.com"}
# ctx_cas= # ctx_cas=
ctx_dev=${ctx_dev:="https://shylinux.com"}
ctx_root=${ctx_root:=/usr/local/context} ctx_root=${ctx_root:=/usr/local/context}
ctx_home=${ctx_home:=~/context} ctx_home=${ctx_home:=~/context}
# web_port= # web_port=
@ -13,7 +13,8 @@ ctx_home=${ctx_home:=~/context}
# HOSTNAME= # HOSTNAME=
# USER= # USER=
# PWD= # PWD=
export ctx_log ctx_app ctx_bin ctx_dev ctx_root ctx_home export ctx_log ctx_app ctx_bin ctx_box ctx_cas ctx_dev
export ctx_root ctx_home web_port ssh_port
log() { log() {
echo -e $* echo -e $*
@ -30,9 +31,8 @@ install() {
esac esac
wget -O ${ctx_app} "$ctx_dev/publish/${ctx_app}?GOOS=$GOOS&GOARCH=$GOARCH" && chmod a+x ${ctx_app} \ wget -O ${ctx_app} "$ctx_dev/publish/${ctx_app}?GOOS=$GOOS&GOARCH=$GOARCH" && chmod a+x ${ctx_app} \
&& ./${ctx_app} upgrade system \ && ./${ctx_app} upgrade system && ${md5} ${ctx_app} \
&& ${md5} ${ctx_app} \ && mv ${ctx_app} bin/${ctx_app}
&& mv ${ctx_app} bin/${ctx_app}
} }
main() { main() {
while true; do while true; do

View File

@ -1,9 +1,9 @@
~wiki ~wiki
config save tmp/wiki.json wiki_visit config save var/tmp/wiki.json wiki_visit
~ssh ~ssh
config save tmp/cert.json work flow trust config save var/tmp/cert.json work flow trust
~aaa ~aaa
config save tmp/auth.json auth config save var/tmp/auth.json auth
~cli ~cli
config save tmp/runtime.json runtime config save var/tmp/runtime.json runtime

View File

@ -1,15 +1,13 @@
~cli ~cli
config load tmp/runtime.json runtime config load var/tmp/runtime.json runtime
~aaa ~aaa
config load tmp/auth.json auth config load var/tmp/auth.json auth
~ssh ~ssh
config load tmp/cert.json work flow trust config load var/tmp/cert.json work flow trust
~wiki ~wiki
config load tmp/wiki.json wiki_visit config load var/tmp/wiki.json wiki_visit
source etc/common.shy source etc/common.shy
~ssh ~ssh
remote auto remote auto
~cli
plugin sort.go sort
source local.shy source local.shy

View File

@ -541,10 +541,7 @@ var Index = &ctx.Context{Name: "aaa", Help: "认证中心",
switch arg[0] { switch arg[0] {
case "access": // 查看用户 case "access": // 查看用户
h := m.Cmdx("aaa.auth", "access", kit.Hashs(m.Option("remote_ip"), m.Option("username"))) h := m.Cmdx("aaa.auth", "access", kit.Hashs(m.Option("remote_ip"), m.Option("username")))
m.Cmd("aaa.auth", h, "data", m.Cmd("aaa.auth", h, "data", "remote_ip", m.Option("remote_ip"), "username", m.Option("username"))
"remote_ip", m.Option("remote_ip"),
"username", m.Option("username"),
)
m.Echo(h) m.Echo(h)
return return
@ -792,8 +789,8 @@ var Index = &ctx.Context{Name: "aaa", Help: "认证中心",
// 生成证书 // 生成证书
template := x509.Certificate{ template := x509.Certificate{
SerialNumber: big.NewInt(1), SerialNumber: big.NewInt(1),
IsCA: true, IsCA: true,
BasicConstraintsValid: true, BasicConstraintsValid: true,
KeyUsage: x509.KeyUsageCertSign, KeyUsage: x509.KeyUsageCertSign,
Subject: pkix.Name{CommonName: kit.Format(common)}, Subject: pkix.Name{CommonName: kit.Format(common)},

View File

@ -502,7 +502,7 @@ var Index = &ctx.Context{Name: "cli", Help: "管理中心",
"compile": &ctx.Command{Name: "compile [OS [ARCH]]", Help: "解析脚本, script: 脚本文件, stdio: 命令终端, snippet: 代码片段", Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) (e error) { "compile": &ctx.Command{Name: "compile [OS [ARCH]]", Help: "解析脚本, script: 脚本文件, stdio: 命令终端, snippet: 代码片段", Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) (e error) {
if len(arg) > 0 && arg[0] == "self" { if len(arg) > 0 && arg[0] == "self" {
if m.Cmdy("cli.system", "go", "install", m.Cmdx("nfs.path", m.Conf("compile", "bench"))); m.Result(0) == "" { if m.Cmdy("cli.system", "go", "install", m.Cmdx("nfs.path", m.Conf("compile", "bench"))); m.Result(0) == "" {
m.Cmdy("cli.quit", 1) m.Cmdy("cli.quit", 2)
} }
return return
} }
@ -521,7 +521,7 @@ var Index = &ctx.Context{Name: "cli", Help: "管理中心",
if len(arg) > 0 { if len(arg) > 0 {
goos := kit.Select(m.Conf("runtime", "host.GOOS"), arg, 0) goos := kit.Select(m.Conf("runtime", "host.GOOS"), arg, 0)
arch := kit.Select(m.Conf("runtime", "host.GOARCH"), arg, 1) arch := kit.Select(m.Conf("runtime", "host.GOARCH"), arg, 1)
name := strings.Join([]string{"bench", goos, arch}, ".") name := strings.Join([]string{"bench", goos, arch}, "_")
wd, _ := os.Getwd() wd, _ := os.Getwd()
env := []string{"cmd_env", "GOOS", goos, "cmd_env", "GOARCH", arch, "cmd_env", env := []string{"cmd_env", "GOOS", goos, "cmd_env", "GOARCH", arch, "cmd_env",
@ -593,8 +593,10 @@ var Index = &ctx.Context{Name: "cli", Help: "管理中心",
m.Echo("term") m.Echo("term")
case "2": case "2":
m.Cmd("cli.source", m.Conf("system", "script.exit")) if m.Option("cli.modal") != "action" {
m.Echo("restart") m.Cmd("cli.source", m.Conf("system", "script.exit"))
m.Echo("restart")
}
} }
m.Append("directory", "") m.Append("directory", "")
m.Echo(", wait 1s") m.Echo(", wait 1s")

View File

@ -40,13 +40,15 @@ func (ctx *CTX) Begin(m *Message, arg ...string) Server {
func (ctx *CTX) Start(m *Message, arg ...string) bool { func (ctx *CTX) Start(m *Message, arg ...string) bool {
m.Cmd("ctx._init") m.Cmd("ctx._init")
if m.Optionv("ps_target", Index); len(arg) == 0 { if m.Optionv("ps_target", Index); len(arg) == 0 {
Pulse.Option("log.disable", false) m.Option("cli.modal", "active")
m.Option("log.disable", false)
m.Cap("stream", "shy") m.Cap("stream", "shy")
m.Cmd("log._init") m.Cmd("log._init")
m.Cmd("yac._init") m.Cmd("yac._init")
m.Cmd("gdb._init") m.Cmd("gdb._init")
m.Cmd("cli.source", m.Conf("system", "script.init")).Cmd("cli.source", "stdio").Cmd("cli.source", m.Conf("system", "script.exit")) m.Cmd("cli.source", m.Conf("system", "script.init")).Cmd("cli.source", "stdio").Cmd("cli.source", m.Conf("system", "script.exit"))
} else { } else {
m.Option("cli.modal", "action")
m.Cmd("yac._init") m.Cmd("yac._init")
for _, v := range m.Spawn().Cmd(arg).Meta["result"] { for _, v := range m.Spawn().Cmd(arg).Meta["result"] {
fmt.Printf("%s", v) fmt.Printf("%s", v)
@ -1416,6 +1418,7 @@ func Start(args ...string) bool {
kit.DisableLog = true kit.DisableLog = true
if len(args) > 0 && args[0] == "daemon" { if len(args) > 0 && args[0] == "daemon" {
Pulse.Options("cli.modal", "daemon")
Pulse.Options("daemon", true) Pulse.Options("daemon", true)
args = args[1:] args = args[1:]
} }

View File

@ -149,6 +149,7 @@ var Index = &ctx.Context{Name: "gdb", Help: "调试中心",
// "11": "SEGV", // "11": "SEGV",
// "17": "STOP", // "17": "STOP",
// "23": "IO", // "23": "IO",
// "29": "INFO",
"5": "TRAP", "5": "TRAP",
"18": "TSTP", "18": "TSTP",
@ -172,7 +173,6 @@ var Index = &ctx.Context{Name: "gdb", Help: "调试中心",
"25": "XFSZ", "25": "XFSZ",
"26": "VTALRM", "26": "VTALRM",
"27": "PROF", "27": "PROF",
"29": "INFO",
}, Help: "信号"}, }, Help: "信号"},
"debug": &ctx.Config{Name: "debug", Value: map[string]interface{}{"value": map[string]interface{}{"enable": false}, "debug": &ctx.Config{Name: "debug", Value: map[string]interface{}{"value": map[string]interface{}{"enable": false},
"trace": map[string]interface{}{"value": map[string]interface{}{"enable": true}}, "trace": map[string]interface{}{"value": map[string]interface{}{"enable": true}},

View File

@ -15,8 +15,8 @@ type LOG struct {
*ctx.Context *ctx.Context
} }
func (log *LOG) Value(msg *ctx.Message, arg ...interface{}) map[string]interface{} { func (log *LOG) Value(msg *ctx.Message, arg ...interface{}) []string {
args := append(kit.Trans(arg...), "value") args := append(kit.Trans(arg...))
if value, ok := kit.Chain(log.Configs["output"].Value, args).(map[string]interface{}); ok { if value, ok := kit.Chain(log.Configs["output"].Value, args).(map[string]interface{}); ok {
if kit.Right(value["source"]) && kit.Format(value["source"]) != msg.Source().Name { if kit.Right(value["source"]) && kit.Format(value["source"]) != msg.Source().Name {
@ -26,9 +26,7 @@ func (log *LOG) Value(msg *ctx.Message, arg ...interface{}) map[string]interface
if kit.Right(value["target"]) && kit.Format(value["target"]) != msg.Target().Name { if kit.Right(value["target"]) && kit.Format(value["target"]) != msg.Target().Name {
return nil return nil
} }
return kit.Trans(value["value"])
// kit.Log("error", "value %v %v", kit.Format(args), kit.Format(value))
return value
} }
return nil return nil
} }
@ -61,10 +59,10 @@ func (log *LOG) Start(m *ctx.Message, arg ...string) bool {
kit.Log("error", "make log dir %s", m.Conf("logdir")) kit.Log("error", "make log dir %s", m.Conf("logdir"))
log.queue = make(chan map[string]interface{}, 1024) log.queue = make(chan map[string]interface{}, 1024)
for _, v := range []string{"error", "bench", "debug"} { // for _, v := range []string{"error", "bench", "debug"} {
log.Log(m, v, "hello world\n") // log.Log(m, v, "hello world\n")
log.Log(m, v, "hello world") // log.Log(m, v, "hello world")
} // }
m.Cap("stream", m.Conf("output", []string{"bench", "value", "file"})) m.Cap("stream", m.Conf("output", []string{"bench", "value", "file"}))
for { for {
@ -77,26 +75,37 @@ func (log *LOG) Start(m *ctx.Message, arg ...string) bool {
loop: loop:
for _, v := range []string{kit.Format(l["action"]), "bench"} { for _, v := range []string{kit.Format(l["action"]), "bench"} {
for i := len(args); i >= 0; i-- { for i := len(args); i >= 0; i-- {
if value := log.Value(m, append([]string{v}, args[:i]...)); kit.Right(value) && kit.Right(value["file"]) { value := log.Value(msg, append([]string{v}, args[:i]...))
file, ok := os.Stdout, true if !kit.Right(value) {
if kit.Format(value["file"]) != "stdout" { continue
name := path.Join(m.Conf("logdir"), kit.Format(value["file"])) }
file, ok = log.file[name] p := kit.Chains(log.Configs["output"].Value, []string{"file", value[0]})
if !ok { if p == "" {
if f, e := os.Create(name); e == nil { continue
file, log.file[name] = f, f }
kit.Log("error", "%s log file %s", "open", name)
} else { file, ok := os.Stdout, true
kit.Log("error", "%s log file %s %s", "open", name, e) if p != "stdout" {
continue name := path.Join(m.Conf("logdir"), p)
} file, ok = log.file[name]
if !ok {
if f, e := os.Create(name); e == nil {
file, log.file[name] = f, f
kit.Log("error", "%s log file %s", "open", name)
} else {
kit.Log("error", "%s log file %s %s", "open", name, e)
continue
} }
} }
fmt.Fprintln(file, fmt.Sprintf("%d %s %s%s %s%s", m.Capi("nout", 1), msg.Format(value["meta"].([]interface{})...),
kit.Format(value["color_begin"]), kit.Format(l["action"]), fmt.Sprintf(kit.Format(l["str"]), l["arg"].([]interface{})...), kit.Format(value["color_end"])))
break loop
} }
font := m.Conf("output", []string{"font", kit.Select("", value, 1)})
meta := msg.Format(m.Confv("output", []string{"meta", kit.Select("short", value, 2)}).([]interface{})...)
fmt.Fprintln(file, fmt.Sprintf("%d %s %s%s %s%s", m.Capi("nout", 1), meta, font,
kit.Format(l["action"]), fmt.Sprintf(kit.Format(l["str"]), l["arg"].([]interface{})...),
kit.Select("", "\033[0m", font != "")))
break loop
} }
} }
} }
@ -119,40 +128,53 @@ var Index = &ctx.Context{Name: "log", Help: "日志中心",
Configs: map[string]*ctx.Config{ Configs: map[string]*ctx.Config{
"logdir": &ctx.Config{Name: "logdir", Value: "var/log", Help: ""}, "logdir": &ctx.Config{Name: "logdir", Value: "var/log", Help: ""},
"output": &ctx.Config{Name: "output", Value: map[string]interface{}{ "output": &ctx.Config{Name: "output", Value: map[string]interface{}{
"error": map[string]interface{}{"value": map[string]interface{}{"file": "error.log", "meta": []interface{}{"time", "ship"}, "color_begin": "\033[31m", "color_end": "\033[0m"}}, "file": map[string]interface{}{
"trace": map[string]interface{}{"value": map[string]interface{}{"file": "error.log", "meta": []interface{}{"time", "ship"}, "color_begin": "\033[32m", "color_end": "\033[0m"}}, "bench": "bench.log",
"debug": map[string]interface{}{"value": map[string]interface{}{"file": "debug.log", "meta": []interface{}{"time", "ship"}}}, "debug": "debug.log",
"search": map[string]interface{}{"value": map[string]interface{}{"file": "debug.log", "meta": []interface{}{"time", "ship"}}}, "error": "error.log",
"call": map[string]interface{}{"value": map[string]interface{}{"file": "debug.log", "meta": []interface{}{"time", "ship"}}}, "right": "right.log",
"back": map[string]interface{}{"value": map[string]interface{}{"file": "debug.log", "meta": []interface{}{"time", "ship"}}}, },
"font": map[string]interface{}{
"red": "\033[31m",
"green": "\033[32m",
"blue": "\033[34m",
"yellow": "\033[33m",
},
"meta": map[string]interface{}{
"short": []interface{}{"time", "ship"},
"long": []interface{}{"time", "ship"},
},
"sync": map[string]interface{}{"value": map[string]interface{}{"file": "debug.log", "meta": []interface{}{"time", "ship"}}}, "error": map[string]interface{}{"value": []interface{}{"error", "red"}},
"recv": map[string]interface{}{"value": map[string]interface{}{"file": "debug.log", "meta": []interface{}{"time", "ship"}}}, "trace": map[string]interface{}{"value": []interface{}{"error", "red"}},
"send": map[string]interface{}{"value": map[string]interface{}{"file": "debug.log", "meta": []interface{}{"time", "ship"}}}, "debug": map[string]interface{}{"value": []interface{}{"debug"}},
"search": map[string]interface{}{"value": []interface{}{"debug"}},
"call": map[string]interface{}{"value": []interface{}{"debug"}},
"back": map[string]interface{}{"value": []interface{}{"debug"}},
"send": map[string]interface{}{"value": []interface{}{"debug"}},
"bench": map[string]interface{}{"value": map[string]interface{}{"file": "bench.log", "meta": []interface{}{"time", "ship"}}}, "bench": map[string]interface{}{"value": []interface{}{"bench"}},
"begin": map[string]interface{}{"value": map[string]interface{}{"file": "bench.log", "meta": []interface{}{"time", "ship"}, "color_begin": "\033[31m", "color_end": "\033[0m"}}, "begin": map[string]interface{}{"value": []interface{}{"bench", "red"}},
"start": map[string]interface{}{"value": map[string]interface{}{"file": "bench.log", "meta": []interface{}{"time", "ship"}, "color_begin": "\033[31m", "color_end": "\033[0m"}}, "start": map[string]interface{}{"value": []interface{}{"bench", "red"}},
"close": map[string]interface{}{"value": map[string]interface{}{"file": "bench.log", "meta": []interface{}{"time", "ship"}, "color_begin": "\033[31m", "color_end": "\033[0m"}}, "close": map[string]interface{}{"value": []interface{}{"bench", "red"}},
"warn": map[string]interface{}{"value": map[string]interface{}{"file": "bench.log", "meta": []interface{}{"time", "ship"}, "color_begin": "\033[33m", "color_end": "\033[0m"}}, "warn": map[string]interface{}{"value": []interface{}{"bench", "yellow"}},
"right": map[string]interface{}{"value": map[string]interface{}{"file": "right.log", "meta": []interface{}{"time", "ship"}}}, "cmd": map[string]interface{}{"value": []interface{}{"bench", "green"},
"lex": map[string]interface{}{"value": []interface{}{"debug", "green"}},
"cmd": map[string]interface{}{"value": map[string]interface{}{"file": "bench.log", "meta": []interface{}{"time", "ship"}, "color_begin": "\033[32m", "color_end": "\033[0m"}, "yac": map[string]interface{}{"value": []interface{}{"debug", "green"}},
"lex": map[string]interface{}{"value": map[string]interface{}{"file": "debug.log", "meta": []interface{}{"time", "ship"}, "color_begin": "\033[32m", "color_end": "\033[0m"}},
"yac": map[string]interface{}{"value": map[string]interface{}{"file": "debug.log", "meta": []interface{}{"time", "ship"}, "color_begin": "\033[32m", "color_end": "\033[0m"}},
"cli": map[string]interface{}{ "cli": map[string]interface{}{
"cmd": map[string]interface{}{"value": map[string]interface{}{"file": "debug.log", "meta": []interface{}{"time", "ship"}, "color_begin": "\033[31m", "color_end": "\033[0m"}}, "cmd": map[string]interface{}{"value": []interface{}{"debug", "red"}},
}, },
"mdb": map[string]interface{}{ "mdb": map[string]interface{}{
"note": map[string]interface{}{"value": map[string]interface{}{"file": "debug.log", "meta": []interface{}{"time", "ship"}, "color_begin": "\033[31m", "color_end": "\033[0m"}}, "note": map[string]interface{}{"value": []interface{}{"debug", "red"}},
}, },
"aaa": map[string]interface{}{ "aaa": map[string]interface{}{
"auth": map[string]interface{}{"value": map[string]interface{}{"file": "debug.log", "meta": []interface{}{"time", "ship"}, "color_begin": "\033[31m", "color_end": "\033[0m"}}, "auth": map[string]interface{}{"value": []interface{}{"debug", "red"}},
"hash": map[string]interface{}{"value": map[string]interface{}{"file": "debug.log", "meta": []interface{}{"time", "ship"}, "color_begin": "\033[31m", "color_end": "\033[0m"}}, "hash": map[string]interface{}{"value": []interface{}{"debug", "red"}},
"rsa": map[string]interface{}{"value": map[string]interface{}{"file": "debug.log", "meta": []interface{}{"time", "ship"}, "color_begin": "\033[31m", "color_end": "\033[0m"}}, "rsa": map[string]interface{}{"value": []interface{}{"debug", "red"}},
}, },
}, },
"right": map[string]interface{}{"value": []interface{}{"right"}},
}, Help: "日志输出配置"}, }, Help: "日志输出配置"},
}, },
Commands: map[string]*ctx.Command{ Commands: map[string]*ctx.Command{

View File

@ -22,9 +22,9 @@ func (tcp *TCP) Fuck(address []string, action func(address string) (net.Conn, er
m := tcp.Message() m := tcp.Message()
fuck := make(chan bool, 3) fuck := make(chan bool, 3)
for _, p := range address { for i := 0; i < m.Confi("retry", "counts"); i++ {
m.Cap("address", p) for _, p := range address {
for i := 0; i < m.Confi("retry", "counts"); i++ { m.Cap("address", p)
m.GoFunc(m, func(m *ctx.Message) { m.GoFunc(m, func(m *ctx.Message) {
p := m.Cap("address") p := m.Cap("address")
if c, e := action(p); e == nil { if c, e := action(p); e == nil {

View File

@ -96,7 +96,7 @@ func (web *WEB) Login(msg *ctx.Message, w http.ResponseWriter, r *http.Request)
// return true // return true
// } // }
defer func() { defer func() {
msg.Option("access", msg.Cmdx("aaa.sess", "access")) msg.Log("info", "access: %s", msg.Option("access", msg.Cmdx("aaa.sess", "access")))
}() }()
if msg.Confs("login", "cas") { if msg.Confs("login", "cas") {
if !cas.IsAuthenticated(r) { if !cas.IsAuthenticated(r) {
@ -136,12 +136,11 @@ func (web *WEB) Login(msg *ctx.Message, w http.ResponseWriter, r *http.Request)
return false return false
} }
if msg.Options("sessid") { if msg.Log("info", "sessid: %s", msg.Option("sessid")); msg.Options("sessid") {
msg.Log("info", "sessid: %s", msg.Option("sessid")) if msg.Log("info", "username: %s", msg.Option("username", msg.Cmd("aaa.sess", "user").Append("meta"))); msg.Options("username") {
msg.Log("info", "username: %s", msg.Option("username", msg.Cmd("aaa.sess", "user").Append("meta"))) if msg.Log("info", "nickname: %s", msg.Option("nickname", msg.Cmdx("aaa.auth", "username", msg.Option("username"), "data", "nickname"))); !msg.Options("nickname") {
msg.Log("info", "nickname: %s", msg.Option("nickname", msg.Cmdx("aaa.auth", "username", msg.Option("username"), "data", "nickname"))) msg.Option("nickname", msg.Option("username"))
if !msg.Options("nickname") { }
msg.Option("nickname", msg.Option("username"))
} }
} }
@ -169,7 +168,7 @@ func (web *WEB) HandleCmd(m *ctx.Message, key string, cmd *ctx.Command) {
msg.Option("accept", r.Header.Get("Accept")) msg.Option("accept", r.Header.Get("Accept"))
msg.Option("method", r.Method) msg.Option("method", r.Method)
msg.Option("path", r.URL.Path) msg.Option("path", r.URL.Path)
msg.Optionv("debug", false) msg.Option("sessid", "")
// 请求环境 // 请求环境
msg.Option("dir_root", msg.Cap("directory")) msg.Option("dir_root", msg.Cap("directory"))
@ -742,7 +741,7 @@ var Index = &ctx.Context{Name: "web", Help: "应用中心",
*/ */
default: default:
if m.Options("save") { if res.StatusCode == http.StatusOK && m.Options("save") {
dir := path.Dir(m.Option("save")) dir := path.Dir(m.Option("save"))
if _, e = os.Stat(dir); e != nil { if _, e = os.Stat(dir); e != nil {
m.Assert(os.MkdirAll(dir, 0777)) m.Assert(os.MkdirAll(dir, 0777))
@ -1156,10 +1155,10 @@ var Index = &ctx.Context{Name: "web", Help: "应用中心",
if strings.HasSuffix(key, "bench") { if strings.HasSuffix(key, "bench") {
key = key + "." + m.Option("GOOS") + "." + m.Option("GOARCH") key = key + "." + m.Option("GOOS") + "." + m.Option("GOARCH")
} }
key = strings.Replace(key, ".", "_", -1)
p := m.Cmdx("nfs.path", path.Join(m.Conf("publish", "path"), key)) p := m.Cmdx("nfs.path", path.Join(m.Conf("publish", "path"), key))
if p == "" { if p == "" {
p = m.Cmdx("nfs.path", m.Conf("publish", []string{"list", strings.Replace(key, ".", "_", -1)})) p = m.Cmdx("nfs.path", m.Conf("publish", []string{"list", key}))
} }
m.Log("info", "publish %s %s", kit.Hashs(p), p) m.Log("info", "publish %s %s", kit.Hashs(p), p)

View File

@ -110,7 +110,7 @@ var page = Page({
]) ])
if (true||kit.isWeiXin) { if (kit.isWeiXin) {
pane.Run(["weixin"], function(msg) { pane.Run(["weixin"], function(msg) {
// if (!ctx.Search("state")) { // if (!ctx.Search("state")) {
// location.href = msg["auth2.0"][0] // location.href = msg["auth2.0"][0]

View File

@ -1,15 +1,28 @@
## context ## context
context is not only context context是一种新的应用框架,通过模块化、集群化、自动化,实现软件的快速开发,快速共享,快速使用。
### 下载安装 ### 下载安装
#### 简易版 在Linux或Mac上可以直接用脚本下载在Windows上可以先安装[GitBash](https://www.git-scm.com/download/),然后下载。
在Mac或Linux上可以直接用脚本下载
``` ```
$ mkdir context && cd context $ mkdir context && cd context
$ curl https://shylinux.com/code/upgrade/boot_sh | bash -s install $ curl https://shylinux.com/publish/boot.sh | bash -s install
``` ```
### 使用方式
context内部实现了很多功能模块每个模块下有很多命令每条命令就是一种应用。
#### 命令模式
```
$ bin/bench dir
```
#### 交互模式
#### 集群模式
#### 完整版 #### 完整版
如果对源码有兴趣,使用更丰富的功能,可以直接下载源码, 如果对源码有兴趣,使用更丰富的功能,可以直接下载源码,
``` ```