fix: dpkg software issue

This commit is contained in:
2024-01-17 14:40:48 +08:00
parent 8eb6430ae3
commit 9e54ccd886
5 changed files with 15 additions and 6 deletions

View File

@@ -710,11 +710,15 @@ func ActiveSoftwareToNF(w http.ResponseWriter, r *http.Request) {
return
}
var inputStr string = "n"
var timeout int = 180
if config.GetYamlConfig().NE.DpkgOverwrite {
inputStr = "y"
}
dpkgCmd := fmt.Sprintf("sudo %s/spawndpkg.sh %s '%s'",
config.GetYamlConfig().NE.ScpDir, inputStr, filePath)
if config.GetYamlConfig().NE.DpkgTimeout != 0 {
timeout = config.GetYamlConfig().NE.DpkgTimeout
}
dpkgCmd := fmt.Sprintf("sudo %s/spawndpkg.sh %d %s '%s'",
config.GetYamlConfig().NE.ScpDir, timeout, inputStr, filePath)
err = RunSSHCmd(sshHost, dpkgCmd)
if err != nil {
log.Errorf("Faile to execute dpkg command: %s, error: %v", dpkgCmd, err)