From f89638ae409724d32152f007bdf0ffeada781782 Mon Sep 17 00:00:00 2001 From: Mickael-Martin Date: Wed, 12 Dec 2018 18:58:48 +0100 Subject: [PATCH] Update upgrade --- scripts/upgrade | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 6fa7d91..0fbf135 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -48,19 +48,6 @@ if [ -z $final_path ]; then ynh_app_setting_set $app final_path $final_path 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 #================================================= @@ -81,10 +68,23 @@ zabbixFrontendInstalledVersion=$(apt-cache policy zabbix-frontend-php | grep -Po zabbixFrontendCandidateVersion=$(apt-cache policy zabbix-frontend-php | grep -Po "Candidate: \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 + #================================================= + # 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 -p /usr/share/zabbix/conf/zabbix.conf.php /tmp/