This commit is contained in:
2024-01-17 20:38:25 +08:00
parent 92a46667b1
commit 827ada36c9
2 changed files with 11 additions and 4 deletions

View File

@@ -698,8 +698,8 @@ func ActiveSoftwareToNF(w http.ResponseWriter, r *http.Request) {
return return
} }
runCmd := fmt.Sprintf("sudo %s/actpkg.sh '%s' %s", runCmd := fmt.Sprintf("sudo %s/actpkg.sh %s '%s'",
config.GetYamlConfig().NE.ScpDir, filePath, neTypeUpper) config.GetYamlConfig().NE.ScpDir, neTypeUpper, filePath)
if neTypeLower == "omc" { if neTypeLower == "omc" {
idNeVersion, _ := strconv.Atoi((*neVersion)[0]["id"]) idNeVersion, _ := strconv.Atoi((*neVersion)[0]["id"])
neVersionData := dborm.NeVersion{ neVersionData := dborm.NeVersion{
@@ -898,8 +898,8 @@ func RollBackSoftwareToNF(w http.ResponseWriter, r *http.Request) {
return return
} }
runCmd := fmt.Sprintf("sudo %s/rbkpkg.sh '%s'", runCmd := fmt.Sprintf("sudo %s/rbkpkg.sh %s '%s'",
config.GetYamlConfig().NE.ScpDir, filePath) config.GetYamlConfig().NE.ScpDir, neTypeUpper, filePath)
if neTypeLower == "omc" { if neTypeLower == "omc" {
idNeVersion, _ := strconv.Atoi((*neVersion)[0]["id"]) idNeVersion, _ := strconv.Atoi((*neVersion)[0]["id"])
neVersionData := dborm.NeVersion{ neVersionData := dborm.NeVersion{

View File

@@ -1,10 +1,14 @@
#!/bin/bash #!/bin/bash
filename="$1" filename="$1"
neType="$2"
extension=$(basename "${1}" | awk -F . '{print $NF}') extension=$(basename "${1}" | awk -F . '{print $NF}')
case "${extension}" in case "${extension}" in
deb) deb)
if [ neType == "OMC" ]; then
systemctl stop restagent.service
fi
expect <<EOF expect <<EOF
spawn dpkg -i --force-all "$filename" spawn dpkg -i --force-all "$filename"
set timeout 180 set timeout 180
@@ -14,6 +18,9 @@ case "${extension}" in
EOF EOF
;; ;;
rpm) rpm)
if [ neType == "OMC" ]; then
systemctl stop restagent.service
fi
expect <<EOF expect <<EOF
spawn rpm -Uvh --oldpackage "$filename" spawn rpm -Uvh --oldpackage "$filename"
set timeout 180 set timeout 180