diff --git a/base/ssh/server.go b/base/ssh/server.go index 14ec2bba..794d8839 100644 --- a/base/ssh/server.go +++ b/base/ssh/server.go @@ -218,6 +218,7 @@ func _ssh_config(m *ice.Message) *ssh.ServerConfig { } } }) + res = nil return &ssh.Permissions{Extensions: meta}, res }, PasswordCallback: func(conn ssh.ConnMetadata, password []byte) (*ssh.Permissions, error) { diff --git a/core/code/install.go b/core/code/install.go index 7ea210ad..c328043a 100644 --- a/core/code/install.go +++ b/core/code/install.go @@ -23,72 +23,14 @@ func init() { INSTALL: {Name: INSTALL, Help: "安装", Value: kit.Data( kit.MDB_SHORT, kit.MDB_NAME, kit.MDB_PATH, "usr/install", "contexts", kit.Dict( - "tmux", kit.Dict( - "centos", ` -yum update -y && yum install -y wget tmux curl -wget {{.Option "host"}}/publish/tmux.conf -tmux -f tmux.conf - `, - "ubuntu", ` -apt update -y && apt install -y wget tmux curl -wget {{.Option "host"}}/publish/tmux.conf -tmux -f tmux.conf -`, - "alpine", ` -apk update && apk add wget tmux curl -wget {{.Option "host"}}/publish/tmux.conf -tmux -f tmux.conf - `, - "darwin", ` -brew update && brew install wget tmux curl -wget {{.Option "host"}}/publish/tmux.conf -tmux -f tmux.conf -`, - ), - "base", kit.Dict( - "centos", ` -yum update -y && yum install -y curl -mkdir contexts; cd contexts -ctx_dev={{.Option "host"}}; curl $ctx_dev/publish/ice.sh | sh -`, - "ubuntu", ` -apt update -y && apt install -y curl -mkdir contexts; cd contexts -ctx_dev={{.Option "host"}}; curl $ctx_dev/publish/ice.sh | sh -`, - "alpine", ` -apk update && apk add curl -mkdir contexts; cd contexts -ctx_dev={{.Option "host"}}; curl $ctx_dev/publish/ice.sh | sh -`, - "darwin", ` -brew update && brew install curl -mkdir contexts; cd contexts -ctx_dev={{.Option "host"}}; curl $ctx_dev/publish/ice.sh | sh -`, - ), - "miss", kit.Dict( - "centos", ` -yum update -y && yum install -y git vim make go -git clone https://github.com/shylinux/contexts && cd contexts -source etc/miss.sh -`, - "ubuntu", ` -apt update -y && apt install -y git vim make golang -git clone https://github.com/shylinux/contexts && cd contexts -source etc/miss.sh -`, - "alpine", ` -apk update && apk add git vim make go -git clone https://github.com/shylinux/contexts && cd contexts -source etc/miss.sh -`, - "darwin", ` -brew update && brew install git vim make -git clone https://github.com/shylinux/contexts && cd contexts -source etc/miss.sh -`, - ), + "base", `mkdir contexts; cd contexts +export ctx_dev={{.Option "httphost"}}; curl $ctx_dev/publish/ice.sh | sh +bin/ice.sh`, + "miss", ` +touch ~/.ssh/config; [ -z "$(cat ~/.ssh/config|grep 'Host {{.Option "hostname"}}')" ] && echo -e "HOST {{.Option "hostname"}}\n Port 9030" >> ~/.ssh/config +git clone {{.Option "user.name"}}@{{.Option "hostname"}}:{{.Option "hostpath"}} && cd contexts +git clone {{.Option "httphost"}}/code/git/proxy/shylinux/contexts && cd contexts +source etc/miss.sh`, ), )}, }, @@ -96,18 +38,12 @@ source etc/miss.sh INSTALL: {Name: "install name=auto port=auto path=auto auto", Help: "安装", Meta: kit.Dict(), Action: map[string]*ice.Action{ "contexts": {Name: "contexts item os", Help: "下载", Hand: func(m *ice.Message, arg ...string) { u := kit.ParseURL(m.Option(ice.MSG_USERWEB)) - m.Option("host", fmt.Sprintf("%s://%s:%s", u.Scheme, strings.Split(u.Host, ":")[0], kit.Select(kit.Select("80", "443", u.Scheme == "https"), strings.Split(u.Host, ":"), 1))) + m.Option("httphost", fmt.Sprintf("%s://%s:%s", u.Scheme, strings.Split(u.Host, ":")[0], kit.Select(kit.Select("80", "443", u.Scheme == "https"), strings.Split(u.Host, ":"), 1))) + m.Option("hostport", fmt.Sprintf("%s:%s", strings.Split(u.Host, ":")[0], kit.Select(kit.Select("80", "443", u.Scheme == "https"), strings.Split(u.Host, ":"), 1))) + m.Option("hostname", strings.Split(u.Host, ":")[0]) + m.Option("hostpath", kit.Path("./")) - txt, sys := "hello world", kit.Select("centos", arg, 1) - switch text := m.Confv(INSTALL, kit.Keys("meta.contexts", kit.Select("tmux", arg, 0))).(type) { - case map[string]interface{}: - m.Cmdy("web.wiki.spark", sys) - txt = kit.Format(text[sys]) - case string: - txt = text - } - - if buf, err := kit.Render(txt, m); m.Assert(err) { + if buf, err := kit.Render(m.Conf(INSTALL, kit.Keys("meta.contexts", kit.Select("base", arg, 0))), m); m.Assert(err) { m.Cmdy("web.wiki.spark", "shell", string(buf)) } }}, diff --git a/core/code/publish.go b/core/code/publish.go index 8ecac448..9bf17d01 100644 --- a/core/code/publish.go +++ b/core/code/publish.go @@ -42,6 +42,7 @@ func init() { Commands: map[string]*ice.Command{ PUBLISH: {Name: "publish path=auto auto 火山架 冰山架 神农架", Help: "发布", Action: map[string]*ice.Action{ "ish": {Name: "ish", Help: "神农架", Hand: func(m *ice.Message, arg ...string) { + _publish_file(m, "etc/conf/tmux.conf") m.Option(nfs.DIR_REG, ".*\\.(sh|vim|conf)") m.Cmdy(nfs.DIR, m.Conf(PUBLISH, kit.META_PATH), "time size line path link") }}, diff --git a/core/wiki/template.go b/core/wiki/template.go index ecca5b74..73bdee27 100644 --- a/core/wiki/template.go +++ b/core/wiki/template.go @@ -19,7 +19,7 @@ var refer = `
{{.Option "text"}}
` +var spark = `{{.Option "text"}}
` var chart = `