[ Agent ] [ Executor ] - 修改zsh部分

This commit is contained in:
zeaslity
2023-10-18 16:21:10 +08:00
parent fa6cfe04b0
commit 15e132c6dc

View File

@@ -1153,13 +1153,13 @@ func (op *AgentOsOperator) installZSH() [][]string {
"git", "git",
"clone", "clone",
"https://github.com/zsh-users/zsh-autosuggestions", "https://github.com/zsh-users/zsh-autosuggestions",
"~/.oh-my-zsh/plugins/zsh-autosuggestions", "/root/.oh-my-zsh/plugins/zsh-autosuggestions",
}, },
{ {
"git", "git",
"clone", "clone",
"https://github.com/zsh-users/zsh-syntax-highlighting.git", "https://github.com/zsh-users/zsh-syntax-highlighting.git",
"~/.oh-my-zsh/plugins/zsh-syntax-highlighting", "/root/.oh-my-zsh/plugins/zsh-syntax-highlighting",
}, },
{ {
"wget", "wget",
@@ -1173,29 +1173,29 @@ func (op *AgentOsOperator) installZSH() [][]string {
"-i", "-i",
"./oh-my-zsh-plugins-list.txt", "./oh-my-zsh-plugins-list.txt",
"-P", "-P",
"~/.oh-my-zsh/plugins/", "/root/.oh-my-zsh/plugins/",
}, },
{ {
"sed", "sed",
"-i", "-i",
"s/robbyrussell/agnoster/g", "s/robbyrussell/agnoster/g",
"~/.zshrc", "/root/.zshrc",
}, },
{ {
"sed", "sed",
"-i", "-i",
"s/^# DISABLE_AUTO_UPDATE=\"true\"/DISABLE_AUTO_UPDATE=\"true\"/g", "s/^# DISABLE_AUTO_UPDATE=\"true\"/DISABLE_AUTO_UPDATE=\"true\"/g",
"~/.zshrc", "/root/.zshrc",
}, },
{ {
"sed", "sed",
"-i", "-i",
"s/plugins=(git)/plugins=(git zsh-autosuggestions zsh-syntax-highlighting command-not-found z themes)/g", "s/plugins=(git)/plugins=(git zsh-autosuggestions zsh-syntax-highlighting command-not-found z themes)/g",
"~/.zshrc", "/root/.zshrc",
}, },
{ {
"source", "source",
"~/.zshrc", "/root/.zshrc",
}, },
{ {
"chsh", "chsh",
@@ -1214,7 +1214,23 @@ func (op *AgentOsOperator) installZSH() [][]string {
func (op *AgentOsOperator) installZSHExec() (bool, []string) { func (op *AgentOsOperator) installZSHExec() (bool, []string) {
log.Info("开始安装ZSH!")
ok, resultLog := AllCompleteExecutor([][]string{ ok, resultLog := AllCompleteExecutor([][]string{
{
"rm",
"-rf",
"/root/.oh-my-zsh",
},
{
"rm",
"-rf",
"/root/wdd/zsh-install.sh",
},
{
"rm",
"-rf",
"/root/wdd/oh-my-zsh-plugins-list.txt",
},
{ {
"mkdir", "mkdir",
"-p", "-p",
@@ -1229,6 +1245,7 @@ func (op *AgentOsOperator) installZSHExec() (bool, []string) {
if !ok { if !ok {
return false, resultLog return false, resultLog
} }
log.InfoF("ZSH环境已经清理, 完成基础安装! 开始安装oh-my-zsh!")
var zshRemoteGitUrl string var zshRemoteGitUrl string
if op.IsAgentInnerWall { if op.IsAgentInnerWall {
@@ -1241,7 +1258,7 @@ func (op *AgentOsOperator) installZSHExec() (bool, []string) {
"wget", "wget",
"--timeout=5", "--timeout=5",
zshRemoteGitUrl, zshRemoteGitUrl,
"-O", "-qO",
"/root/wdd/zsh-install.sh", "/root/wdd/zsh-install.sh",
}, },
) )
@@ -1281,13 +1298,13 @@ func (op *AgentOsOperator) installZSHExec() (bool, []string) {
"git", "git",
"clone", "clone",
zshAutoSourcePath, zshAutoSourcePath,
"~/.oh-my-zsh/plugins/zsh-autosuggestions", "/root/.oh-my-zsh/plugins/zsh-autosuggestions",
}, },
{ {
"git", "git",
"clone", "clone",
zshHighLightingSourcePath, zshHighLightingSourcePath,
"~/.oh-my-zsh/plugins/zsh-syntax-highlighting", "/root/.oh-my-zsh/plugins/zsh-syntax-highlighting",
}, },
{ {
"wget", "wget",
@@ -1301,29 +1318,29 @@ func (op *AgentOsOperator) installZSHExec() (bool, []string) {
"-i", "-i",
"/root/wdd/oh-my-zsh-plugins-list.txt", "/root/wdd/oh-my-zsh-plugins-list.txt",
"-P", "-P",
"~/.oh-my-zsh/plugins/", "/root/.oh-my-zsh/plugins/",
}, },
{ {
"sed", "sed",
"-i", "-i",
"s/robbyrussell/agnoster/g", "s/robbyrussell/agnoster/g",
"~/.zshrc", "/root/.zshrc",
}, },
{ {
"sed", "sed",
"-i", "-i",
"s/^# DISABLE_AUTO_UPDATE=\"true\"/DISABLE_AUTO_UPDATE=\"true\"/g", "s/^# DISABLE_AUTO_UPDATE=\"true\"/DISABLE_AUTO_UPDATE=\"true\"/g",
"~/.zshrc", "/root/.zshrc",
}, },
{ {
"sed", "sed",
"-i", "-i",
"s/plugins=(git)/plugins=(git zsh-autosuggestions zsh-syntax-highlighting command-not-found z themes)/g", "s/plugins=(git)/plugins=(git zsh-autosuggestions zsh-syntax-highlighting command-not-found z themes)/g",
"~/.zshrc", "/root/.zshrc",
}, },
{ {
"source", "source",
"~/.zshrc", "/root/.zshrc",
}, },
{ {
"chsh", "chsh",