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