优化远程安装程序

This commit is contained in:
GoEdgeLab
2022-07-27 08:35:15 +08:00
parent 36d3b84d2f
commit 8fa0d46f56
2 changed files with 10 additions and 10 deletions

View File

@@ -77,7 +77,6 @@ func (this *NodeInstaller) Install(dir string, params interface{}, installStatus
_, err = this.client.Stat(exePath) _, err = this.client.Stat(exePath)
if err == nil { if err == nil {
_, _, _ = this.client.Exec(exePath + " quit") _, _, _ = this.client.Exec(exePath + " quit")
}
// 删除可执行文件防止冲突 // 删除可执行文件防止冲突
err = this.client.Remove(exePath) err = this.client.Remove(exePath)
@@ -85,6 +84,7 @@ func (this *NodeInstaller) Install(dir string, params interface{}, installStatus
return errors.New("remove old file failed: " + err.Error()) return errors.New("remove old file failed: " + err.Error())
} }
} }
}
// 解压 // 解压
_, stderr, err := this.client.Exec(dir + "/" + env.HelperName + " -cmd=unzip -zip=\"" + targetZip + "\" -target=\"" + dir + "\"") _, stderr, err := this.client.Exec(dir + "/" + env.HelperName + " -cmd=unzip -zip=\"" + targetZip + "\" -target=\"" + dir + "\"")

View File

@@ -77,7 +77,6 @@ func (this *NSNodeInstaller) Install(dir string, params interface{}, installStat
_, err = this.client.Stat(exePath) _, err = this.client.Stat(exePath)
if err == nil { if err == nil {
_, _, _ = this.client.Exec(exePath + " stop") _, _, _ = this.client.Exec(exePath + " stop")
}
// 删除可执行文件防止冲突 // 删除可执行文件防止冲突
err = this.client.Remove(exePath) err = this.client.Remove(exePath)
@@ -85,6 +84,7 @@ func (this *NSNodeInstaller) Install(dir string, params interface{}, installStat
return errors.New("remove old file failed: " + err.Error()) return errors.New("remove old file failed: " + err.Error())
} }
} }
}
// 解压 // 解压
_, stderr, err := this.client.Exec(dir + "/" + env.HelperName + " -cmd=unzip -zip=\"" + targetZip + "\" -target=\"" + dir + "\"") _, stderr, err := this.client.Exec(dir + "/" + env.HelperName + " -cmd=unzip -zip=\"" + targetZip + "\" -target=\"" + dir + "\"")