Mickael-Martin 7 лет назад
Родитель
Сommit
f89638ae40
1 измененных файлов с 15 добавлено и 15 удалено
  1. 15 15
      scripts/upgrade

+ 15 - 15
scripts/upgrade

@@ -48,19 +48,6 @@ if [ -z $final_path ]; then
 	ynh_app_setting_set $app final_path $final_path
 	ynh_app_setting_set $app final_path $final_path
 fi
 fi
 
 
-#=================================================
-# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
-#=================================================
-
-# Backup the current version of the app
-ynh_backup_before_upgrade
-ynh_clean_setup () {
-	# restore it if the upgrade fails
-	ynh_restore_upgradebackup
-}
-# Exit if an error occurs during the execution of the script
-ynh_abort_if_errors
-
 #=================================================
 #=================================================
 # CHECK THE PATH
 # CHECK THE PATH
 #=================================================
 #=================================================
@@ -81,10 +68,23 @@ zabbixFrontendInstalledVersion=$(apt-cache policy zabbix-frontend-php | grep -Po
 zabbixFrontendCandidateVersion=$(apt-cache policy zabbix-frontend-php | grep -Po "Candidate: \K(.*)")
 zabbixFrontendCandidateVersion=$(apt-cache policy zabbix-frontend-php | grep -Po "Candidate: \K(.*)")
 
 
 zabbixagentInstalledVersion=$(apt-cache policy zabbix-agent | grep -Po "Installed: \K(.*)")
 zabbixagentInstalledVersion=$(apt-cache policy zabbix-agent | grep -Po "Installed: \K(.*)")
-zabbixagentCandidateVersion=$(apt-cache policy zabbix-zabbix-agent | grep -Po "Candidate: \K(.*)")
+zabbixagentCandidateVersion=$(apt-cache policy zabbix-agent | grep -Po "Candidate: \K(.*)")
 
 
-if [ "$zabbixServerInstalledVersion" == "$zabbixServerCandidateVersion" -a "$zabbixFrontendInstalledVersion" == "$zabbixFrontendCandidateVersion" -a "$zabbixagentInstalledVersion" == "$zabbixagentCandidateVersion" ] 
+if [ "$zabbixServerInstalledVersion" != "$zabbixServerCandidateVersion" -o "$zabbixFrontendInstalledVersion" != "$zabbixFrontendCandidateVersion" -o "$zabbixagentInstalledVersion" != "$zabbixagentCandidateVersion" ] 
 then
 then
+    #=================================================
+    # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
+    #=================================================
+    
+    # Backup the current version of the app
+    ynh_backup_before_upgrade
+    ynh_clean_setup () {
+    	# restore it if the upgrade fails
+    	ynh_restore_upgradebackup
+    }
+    # Exit if an error occurs during the execution of the script
+    ynh_abort_if_errors
+    
     cp -rp /etc/zabbix /tmp/
     cp -rp /etc/zabbix /tmp/
     cp -p /usr/share/zabbix/conf/zabbix.conf.php /tmp/
     cp -p /usr/share/zabbix/conf/zabbix.conf.php /tmp/