From 9723fa31492be3b9696db77e7a2093322037a63d Mon Sep 17 00:00:00 2001 From: Mickael-Martin Date: Thu, 6 Dec 2018 14:02:19 +0100 Subject: [PATCH 01/19] Update upgrade --- scripts/upgrade | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 6a76809..d8c9ea9 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -71,11 +71,19 @@ path_url=$(ynh_normalize_url_path $path_url) #================================================= # STANDARD UPGRADE STEPS #================================================= -# DOWNLOAD, CHECK AND UNPACK SOURCE -#================================================= -# Download, check integrity, uncompress and patch the source from app.src -ynh_setup_source "$final_path" +DEBIAN_FRONTEND=noninteractive apt-mark unhold zabbix-server-mysql zabbix-frontend-php +ynh_package_update +DEBIAN_FRONTEND=noninteractive apt-get -y download zabbix-frontend-php +ar x *.deb +tar xzf control.tar.gz +sed -i 's/apache2 | httpd, //' control +tar --ignore-failed-read -cvzf control.tar.gz {post,pre}{inst,rm} md5sums control +ar rcs zabbix-frontend-php+stretch_all-noapache2.deb debian-binary control.tar.gz data.tar.xz +dpkg -i zabbix-frontend-php+stretch_all-noapache2.deb +rm -fr zabbix-*.deb +apt-get -y --only-upgrade install zabbix-server-mysql zabbix-agent +DEBIAN_FRONTEND=noninteractive apt-mark hold zabbix-server-mysql zabbix-frontend-php #================================================= # NGINX CONFIGURATION From 6bf76fd4228285a1f614cc558574411dcff92357 Mon Sep 17 00:00:00 2001 From: Mickael-Martin Date: Fri, 7 Dec 2018 13:25:23 +0100 Subject: [PATCH 02/19] Update backup --- scripts/backup | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/scripts/backup b/scripts/backup index 1005ffe..b16050c 100644 --- a/scripts/backup +++ b/scripts/backup @@ -36,7 +36,15 @@ db_name=$(ynh_app_setting_get $app db_name) # BACKUP THE APP MAIN DIR #================================================= -ynh_backup "$final_path" +#backup frontend config +ynh_backup "$final_path/conf/zabbix.conf.php" + +#backup server confif +ynh_backup "/etc/zabbix/zabbix_server.conf" + +#backup agent config +ynh_backup "/etc/zabbix/zabbix_agentd.conf" +ynh_backup "/etc/zabbix/zabbix_agentd.d" #================================================= # BACKUP THE NGINX CONFIGURATION From 71e2973164af4d210e5a1a1de4b2d7cd78dabf30 Mon Sep 17 00:00:00 2001 From: Mickael-Martin Date: Fri, 7 Dec 2018 13:39:03 +0100 Subject: [PATCH 03/19] Update upgrade --- scripts/upgrade | 37 ++++--------------------------------- 1 file changed, 4 insertions(+), 33 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index d8c9ea9..d538cbe 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -85,44 +85,15 @@ rm -fr zabbix-*.deb apt-get -y --only-upgrade install zabbix-server-mysql zabbix-agent DEBIAN_FRONTEND=noninteractive apt-mark hold zabbix-server-mysql zabbix-frontend-php -#================================================= -# NGINX CONFIGURATION -#================================================= - -# Create a dedicated nginx config -ynh_add_nginx_config - -#================================================= -# UPGRADE DEPENDENCIES -#================================================= - -ynh_install_app_dependencies deb1 deb2 - -#================================================= -# CREATE DEDICATED USER -#================================================= - -# Create a dedicated user (if not existing) -ynh_system_user_create $app - -#================================================= -# PHP-FPM CONFIGURATION -#================================================= - -# Create a dedicated php-fpm config -ynh_add_fpm_config #================================================= # SPECIFIC UPGRADE #================================================= -# ... -#================================================= -### Verify the checksum of a file, stored by `ynh_store_file_checksum` in the install script. -### And create a backup of this file if the checksum is different. So the file will be backed up if the admin had modified it. -ynh_backup_if_checksum_is_different "$final_path/CONFIG_FILE" -# Recalculate and store the checksum of the file for the next upgrade. -ynh_store_file_checksum "$final_path/CONFIG_FILE" +ynh_restore_file "$final_path/conf/zabbix.conf.php" "final_path/conf/zabbix.conf.php" +ynh_restore_file "/etc/zabbix/zabbix_server.conf" "/etc/zabbix/zabbix_server.conf" +ynh_restore_file "/etc/zabbix/zabbix_agentd.conf" "/etc/zabbix/zabbix_agentd.conf" +ynh_restore_file "/etc/zabbix/zabbix_agentd.d" "/etc/zabbix/zabbix_agentd.d" #================================================= # SETUP LOGROTATE From 95daedec72bae7f7d54cb1f830136eb2d390d948 Mon Sep 17 00:00:00 2001 From: Mickael-Martin Date: Tue, 11 Dec 2018 11:58:45 +0100 Subject: [PATCH 04/19] Delete php-fpm.ini --- conf/php-fpm.ini | 10 ---------- 1 file changed, 10 deletions(-) delete mode 100644 conf/php-fpm.ini diff --git a/conf/php-fpm.ini b/conf/php-fpm.ini deleted file mode 100644 index 5c27d59..0000000 --- a/conf/php-fpm.ini +++ /dev/null @@ -1,10 +0,0 @@ -; Common values to change to increase file upload limit -; upload_max_filesize = 50M -; post_max_size = 50M -; mail.add_x_header = Off - -; Other common parameters -; max_execution_time = 600 -; max_input_time = 300 -; memory_limit = 256M -; short_open_tag = On From f8cd6ada2752cdc4e9e3db42c1a75be56f270db8 Mon Sep 17 00:00:00 2001 From: Mickael-Martin Date: Tue, 11 Dec 2018 12:02:44 +0100 Subject: [PATCH 05/19] no ini file for php needed --- scripts/backup | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/backup b/scripts/backup index b16050c..8970d54 100644 --- a/scripts/backup +++ b/scripts/backup @@ -57,7 +57,6 @@ ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= ynh_backup "/etc/php/7.0/fpm/pool.d/$app.conf" -ynh_backup "/etc/php/7.0/fpm/conf.d/20-$app.ini" #================================================= # BACKUP THE MYSQL DATABASE From 76c219cdace2fada31300a64e8b3a3f13cc1f7b8 Mon Sep 17 00:00:00 2001 From: Mickael-Martin Date: Tue, 11 Dec 2018 12:52:15 +0100 Subject: [PATCH 06/19] Update upgrade --- scripts/upgrade | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index d538cbe..659707c 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -90,10 +90,10 @@ DEBIAN_FRONTEND=noninteractive apt-mark hold zabbix-server-mysql zabbix-frontend # SPECIFIC UPGRADE #================================================= -ynh_restore_file "$final_path/conf/zabbix.conf.php" "final_path/conf/zabbix.conf.php" -ynh_restore_file "/etc/zabbix/zabbix_server.conf" "/etc/zabbix/zabbix_server.conf" -ynh_restore_file "/etc/zabbix/zabbix_agentd.conf" "/etc/zabbix/zabbix_agentd.conf" -ynh_restore_file "/etc/zabbix/zabbix_agentd.d" "/etc/zabbix/zabbix_agentd.d" +ynh_restore_file "/etc/conf/zabbix.conf.php" +ynh_restore_file "/etc/zabbix/zabbix_server.conf" +ynh_restore_file "/etc/zabbix/zabbix_agentd.conf" +ynh_restore_file "/etc/zabbix/zabbix_agentd.d" #================================================= # SETUP LOGROTATE From 54a836153f9f9043cbe9b30277dc0dbc7e7b0fce Mon Sep 17 00:00:00 2001 From: Mickael-Martin Date: Tue, 11 Dec 2018 13:16:59 +0100 Subject: [PATCH 07/19] Update upgrade --- scripts/upgrade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index 659707c..3c2fda3 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -90,7 +90,7 @@ DEBIAN_FRONTEND=noninteractive apt-mark hold zabbix-server-mysql zabbix-frontend # SPECIFIC UPGRADE #================================================= -ynh_restore_file "/etc/conf/zabbix.conf.php" +ynh_restore_file "/etc/zabbix/conf/zabbix.conf.php" ynh_restore_file "/etc/zabbix/zabbix_server.conf" ynh_restore_file "/etc/zabbix/zabbix_agentd.conf" ynh_restore_file "/etc/zabbix/zabbix_agentd.d" From 4b7d627c8bc55a496eab2377801dc1dc48bc7a31 Mon Sep 17 00:00:00 2001 From: Mickael-Martin Date: Tue, 11 Dec 2018 13:21:52 +0100 Subject: [PATCH 08/19] Update upgrade --- scripts/upgrade | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/scripts/upgrade b/scripts/upgrade index 3c2fda3..b27bf4a 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -71,6 +71,11 @@ path_url=$(ynh_normalize_url_path $path_url) #================================================= # STANDARD UPGRADE STEPS #================================================= +ynh_backup "/etc/zabbix/conf/zabbix.conf.php" +ynh_backup "/etc/zabbix/zabbix_server.conf" +ynh_backup "/etc/zabbix/zabbix_agentd.conf" +ynh_backup "/etc/zabbix/zabbix_agentd.d" + DEBIAN_FRONTEND=noninteractive apt-mark unhold zabbix-server-mysql zabbix-frontend-php ynh_package_update From 14927288a336211947e33e3cbcb8422e69a7a415 Mon Sep 17 00:00:00 2001 From: Mickael-Martin Date: Tue, 11 Dec 2018 13:26:14 +0100 Subject: [PATCH 09/19] Update upgrade --- scripts/upgrade | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index b27bf4a..8845ce9 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -71,11 +71,6 @@ path_url=$(ynh_normalize_url_path $path_url) #================================================= # STANDARD UPGRADE STEPS #================================================= -ynh_backup "/etc/zabbix/conf/zabbix.conf.php" -ynh_backup "/etc/zabbix/zabbix_server.conf" -ynh_backup "/etc/zabbix/zabbix_agentd.conf" -ynh_backup "/etc/zabbix/zabbix_agentd.d" - DEBIAN_FRONTEND=noninteractive apt-mark unhold zabbix-server-mysql zabbix-frontend-php ynh_package_update @@ -95,7 +90,7 @@ DEBIAN_FRONTEND=noninteractive apt-mark hold zabbix-server-mysql zabbix-frontend # SPECIFIC UPGRADE #================================================= -ynh_restore_file "/etc/zabbix/conf/zabbix.conf.php" +ynh_restore_file "/var/www/zabbix/conf/zabbix.conf.php" ynh_restore_file "/etc/zabbix/zabbix_server.conf" ynh_restore_file "/etc/zabbix/zabbix_agentd.conf" ynh_restore_file "/etc/zabbix/zabbix_agentd.d" From 23b3925201e49ec55121a59806103e9f2b14cddd Mon Sep 17 00:00:00 2001 From: Mickael-Martin Date: Tue, 11 Dec 2018 13:31:42 +0100 Subject: [PATCH 10/19] Update upgrade --- scripts/upgrade | 48 ------------------------------------------------ 1 file changed, 48 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 8845ce9..3377113 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -85,52 +85,4 @@ rm -fr zabbix-*.deb apt-get -y --only-upgrade install zabbix-server-mysql zabbix-agent DEBIAN_FRONTEND=noninteractive apt-mark hold zabbix-server-mysql zabbix-frontend-php - -#================================================= -# SPECIFIC UPGRADE -#================================================= - -ynh_restore_file "/var/www/zabbix/conf/zabbix.conf.php" -ynh_restore_file "/etc/zabbix/zabbix_server.conf" -ynh_restore_file "/etc/zabbix/zabbix_agentd.conf" -ynh_restore_file "/etc/zabbix/zabbix_agentd.d" - -#================================================= -# SETUP LOGROTATE -#================================================= - -# Use logrotate to manage app-specific logfile(s) -ynh_use_logrotate --non-append - -#================================================= -# SETUP SYSTEMD -#================================================= - -# Create a dedicated systemd config -ynh_add_systemd_config - -#================================================= -# GENERIC FINALIZATION -#================================================= -# SECURE FILES AND DIRECTORIES -#================================================= - -# Set permissions on app files -chown -R root: $final_path - -#================================================= -# SETUP SSOWAT -#================================================= - -# Make app public if necessary -if [ $is_public -eq 1 ] -then - # unprotected_uris allows SSO credentials to be passed anyway - ynh_app_setting_set $app unprotected_uris "/" -fi - -#================================================= -# RELOAD NGINX -#================================================= - systemctl reload nginx From e5d2de577ca07d33162ff6ed0bb14a335f810d6c Mon Sep 17 00:00:00 2001 From: Mickael-Martin Date: Tue, 11 Dec 2018 13:57:29 +0100 Subject: [PATCH 11/19] Update upgrade --- scripts/upgrade | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/upgrade b/scripts/upgrade index 3377113..fc5b343 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -85,4 +85,6 @@ rm -fr zabbix-*.deb apt-get -y --only-upgrade install zabbix-server-mysql zabbix-agent DEBIAN_FRONTEND=noninteractive apt-mark hold zabbix-server-mysql zabbix-frontend-php +ynh_restore_file "/usr/share/zabbix/conf/zabbix.conf.php" + systemctl reload nginx From b38036acb7fc7aaf585a7f180f5ad3efec2f96d8 Mon Sep 17 00:00:00 2001 From: Mickael-Martin Date: Tue, 11 Dec 2018 18:21:13 +0100 Subject: [PATCH 12/19] Update upgrade --- scripts/upgrade | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/upgrade b/scripts/upgrade index fc5b343..4c066ab 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -72,6 +72,8 @@ path_url=$(ynh_normalize_url_path $path_url) # STANDARD UPGRADE STEPS #================================================= +ynh_backup "/usr/share/zabbix/conf/zabbix.conf.php" + DEBIAN_FRONTEND=noninteractive apt-mark unhold zabbix-server-mysql zabbix-frontend-php ynh_package_update DEBIAN_FRONTEND=noninteractive apt-get -y download zabbix-frontend-php From 6a61e053eef1d745a8b345b89671d2b6feb9268d Mon Sep 17 00:00:00 2001 From: Mickael-Martin Date: Wed, 12 Dec 2018 18:09:10 +0100 Subject: [PATCH 13/19] change method of backup --- scripts/upgrade | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 4c066ab..fdc1bed 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -71,8 +71,8 @@ path_url=$(ynh_normalize_url_path $path_url) #================================================= # STANDARD UPGRADE STEPS #================================================= - -ynh_backup "/usr/share/zabbix/conf/zabbix.conf.php" +filefrontendconf=$(mktemp /tmp/frontend-zabbix.conf.php.XXXXXX) +cat /usr/share/zabbix/conf/zabbix.conf.php >$filefrontendconf DEBIAN_FRONTEND=noninteractive apt-mark unhold zabbix-server-mysql zabbix-frontend-php ynh_package_update @@ -87,6 +87,7 @@ rm -fr zabbix-*.deb apt-get -y --only-upgrade install zabbix-server-mysql zabbix-agent DEBIAN_FRONTEND=noninteractive apt-mark hold zabbix-server-mysql zabbix-frontend-php -ynh_restore_file "/usr/share/zabbix/conf/zabbix.conf.php" +cat "$filefrontendconf" >"/usr/share/zabbix/conf/zabbix.conf.php" +rm "$filefrontendconf" systemctl reload nginx From ca5867cbc95aa278afea9378f9add1926b69b6a2 Mon Sep 17 00:00:00 2001 From: Mickael-Martin Date: Wed, 12 Dec 2018 18:14:23 +0100 Subject: [PATCH 14/19] copy all conf file before upgrade --- scripts/upgrade | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index fdc1bed..5f91763 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -71,8 +71,8 @@ path_url=$(ynh_normalize_url_path $path_url) #================================================= # STANDARD UPGRADE STEPS #================================================= -filefrontendconf=$(mktemp /tmp/frontend-zabbix.conf.php.XXXXXX) -cat /usr/share/zabbix/conf/zabbix.conf.php >$filefrontendconf +cp -rp /etc/zabbix /tmp/ +cp -p /usr/share/zabbix/conf/zabbix.conf.php /tmp/ DEBIAN_FRONTEND=noninteractive apt-mark unhold zabbix-server-mysql zabbix-frontend-php ynh_package_update @@ -87,7 +87,9 @@ rm -fr zabbix-*.deb apt-get -y --only-upgrade install zabbix-server-mysql zabbix-agent DEBIAN_FRONTEND=noninteractive apt-mark hold zabbix-server-mysql zabbix-frontend-php -cat "$filefrontendconf" >"/usr/share/zabbix/conf/zabbix.conf.php" -rm "$filefrontendconf" +cp -rpf /tmp/zabbix/* /etc/zabbix/ +cp -pf /tmp/zabbix.conf.php /usr/share/zabbix/conf/ + +rm -fr /tmp/zabbix* systemctl reload nginx From 08ac03c50a05dca31fce74d70df01beb2f1f3242 Mon Sep 17 00:00:00 2001 From: Mickael-Martin Date: Wed, 12 Dec 2018 18:28:49 +0100 Subject: [PATCH 15/19] Update upgrade --- scripts/upgrade | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index 5f91763..466f3b2 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -87,7 +87,8 @@ rm -fr zabbix-*.deb apt-get -y --only-upgrade install zabbix-server-mysql zabbix-agent DEBIAN_FRONTEND=noninteractive apt-mark hold zabbix-server-mysql zabbix-frontend-php -cp -rpf /tmp/zabbix/* /etc/zabbix/ +rm /usr/share/zabbix/conf/zabbix.conf.php +cp -rpf /tmp/zabbix /etc/ cp -pf /tmp/zabbix.conf.php /usr/share/zabbix/conf/ rm -fr /tmp/zabbix* From 15f5787f3b03a7e760029d14a22f2caabca3efaf Mon Sep 17 00:00:00 2001 From: Mickael-Martin Date: Wed, 12 Dec 2018 18:42:52 +0100 Subject: [PATCH 16/19] launch update only if needed --- scripts/upgrade | 52 ++++++++++++++++++++++++++++++++----------------- 1 file changed, 34 insertions(+), 18 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 466f3b2..0d73e9c 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -71,26 +71,42 @@ path_url=$(ynh_normalize_url_path $path_url) #================================================= # STANDARD UPGRADE STEPS #================================================= -cp -rp /etc/zabbix /tmp/ -cp -p /usr/share/zabbix/conf/zabbix.conf.php /tmp/ -DEBIAN_FRONTEND=noninteractive apt-mark unhold zabbix-server-mysql zabbix-frontend-php ynh_package_update -DEBIAN_FRONTEND=noninteractive apt-get -y download zabbix-frontend-php -ar x *.deb -tar xzf control.tar.gz -sed -i 's/apache2 | httpd, //' control -tar --ignore-failed-read -cvzf control.tar.gz {post,pre}{inst,rm} md5sums control -ar rcs zabbix-frontend-php+stretch_all-noapache2.deb debian-binary control.tar.gz data.tar.xz -dpkg -i zabbix-frontend-php+stretch_all-noapache2.deb -rm -fr zabbix-*.deb -apt-get -y --only-upgrade install zabbix-server-mysql zabbix-agent -DEBIAN_FRONTEND=noninteractive apt-mark hold zabbix-server-mysql zabbix-frontend-php -rm /usr/share/zabbix/conf/zabbix.conf.php -cp -rpf /tmp/zabbix /etc/ -cp -pf /tmp/zabbix.conf.php /usr/share/zabbix/conf/ +zabbix-server-mysql-installedversion=$(apt-cache policy zabbix-server-mysql | grep -Po "Installed: \K(.*)") +zabbix-server-mysql-candidateversion=$(apt-cache policy zabbix-server-mysql | grep -Po "Candidate: \K(.*)") -rm -fr /tmp/zabbix* +zabbix-frontend-php-installedversion=$(apt-cache policy zabbix-frontend-php | grep -Po "Installed: \K(.*)") +zabbix-frontend-php-candidateversion=$(apt-cache policy zabbix-frontend-php | grep -Po "Candidate: \K(.*)") -systemctl reload nginx +zabbix-agent-installedversion=$(apt-cache policy zabbix-agent | grep -Po "Installed: \K(.*)") +zabbix-agent-candidateversion=$(apt-cache policy zabbix-zabbix-agent | grep -Po "Candidate: \K(.*)") + +if [ "$zabbix-server-mysql-installedversion" == "zabbix-server-mysql-installedversion" -a "$zabbix-frontend-php-installedversion" == "zabbix-frontend-php-installedversion" -a "$zabbix-agent-installedversion" == "zabbix-agent-installedversion" ] +then + cp -rp /etc/zabbix /tmp/ + cp -p /usr/share/zabbix/conf/zabbix.conf.php /tmp/ + + DEBIAN_FRONTEND=noninteractive apt-mark unhold zabbix-server-mysql zabbix-frontend-php + DEBIAN_FRONTEND=noninteractive apt-get -y download zabbix-frontend-php + ar x *.deb + tar xzf control.tar.gz + sed -i 's/apache2 | httpd, //' control + tar --ignore-failed-read -cvzf control.tar.gz {post,pre}{inst,rm} md5sums control + ar rcs zabbix-frontend-php+stretch_all-noapache2.deb debian-binary control.tar.gz data.tar.xz + dpkg -i zabbix-frontend-php+stretch_all-noapache2.deb + rm -fr zabbix-*.deb + apt-get -y --only-upgrade install zabbix-server-mysql zabbix-agent + DEBIAN_FRONTEND=noninteractive apt-mark hold zabbix-server-mysql zabbix-frontend-php + + rm /usr/share/zabbix/conf/zabbix.conf.php + cp -rpf /tmp/zabbix /etc/ + cp -pf /tmp/zabbix.conf.php /usr/share/zabbix/conf/ + + rm -fr /tmp/zabbix* + + systemctl reload nginx +else + ynh_print_info "Nothing to update !" +fi From 1590d1f0f45b70e604ad2d15fd62c652f46ecfe3 Mon Sep 17 00:00:00 2001 From: Mickael-Martin Date: Wed, 12 Dec 2018 18:43:47 +0100 Subject: [PATCH 17/19] Update upgrade (syntax) --- scripts/upgrade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index 0d73e9c..0154b6c 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -83,7 +83,7 @@ zabbix-frontend-php-candidateversion=$(apt-cache policy zabbix-frontend-php | gr zabbix-agent-installedversion=$(apt-cache policy zabbix-agent | grep -Po "Installed: \K(.*)") zabbix-agent-candidateversion=$(apt-cache policy zabbix-zabbix-agent | grep -Po "Candidate: \K(.*)") -if [ "$zabbix-server-mysql-installedversion" == "zabbix-server-mysql-installedversion" -a "$zabbix-frontend-php-installedversion" == "zabbix-frontend-php-installedversion" -a "$zabbix-agent-installedversion" == "zabbix-agent-installedversion" ] +if [ "$zabbix-server-mysql-installedversion" == "$zabbix-server-mysql-installedversion" -a "$zabbix-frontend-php-installedversion" == "$zabbix-frontend-php-installedversion" -a "$zabbix-agent-installedversion" == "$zabbix-agent-installedversion" ] then cp -rp /etc/zabbix /tmp/ cp -p /usr/share/zabbix/conf/zabbix.conf.php /tmp/ From b5da6e577673212e7a5374f738361c975f461af4 Mon Sep 17 00:00:00 2001 From: Mickael-Martin Date: Wed, 12 Dec 2018 18:51:44 +0100 Subject: [PATCH 18/19] Update upgrade --- scripts/upgrade | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 0154b6c..6fa7d91 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -74,16 +74,16 @@ path_url=$(ynh_normalize_url_path $path_url) ynh_package_update -zabbix-server-mysql-installedversion=$(apt-cache policy zabbix-server-mysql | grep -Po "Installed: \K(.*)") -zabbix-server-mysql-candidateversion=$(apt-cache policy zabbix-server-mysql | grep -Po "Candidate: \K(.*)") +zabbixServerInstalledVersion=$(apt-cache policy zabbix-server-mysql | grep -Po "Installed: \K(.*)") +zabbixServerCandidateVersion=$(apt-cache policy zabbix-server-mysql | grep -Po "Candidate: \K(.*)") -zabbix-frontend-php-installedversion=$(apt-cache policy zabbix-frontend-php | grep -Po "Installed: \K(.*)") -zabbix-frontend-php-candidateversion=$(apt-cache policy zabbix-frontend-php | grep -Po "Candidate: \K(.*)") +zabbixFrontendInstalledVersion=$(apt-cache policy zabbix-frontend-php | grep -Po "Installed: \K(.*)") +zabbixFrontendCandidateVersion=$(apt-cache policy zabbix-frontend-php | grep -Po "Candidate: \K(.*)") -zabbix-agent-installedversion=$(apt-cache policy zabbix-agent | grep -Po "Installed: \K(.*)") -zabbix-agent-candidateversion=$(apt-cache policy zabbix-zabbix-agent | 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(.*)") -if [ "$zabbix-server-mysql-installedversion" == "$zabbix-server-mysql-installedversion" -a "$zabbix-frontend-php-installedversion" == "$zabbix-frontend-php-installedversion" -a "$zabbix-agent-installedversion" == "$zabbix-agent-installedversion" ] +if [ "$zabbixServerInstalledVersion" == "$zabbixServerCandidateVersion" -a "$zabbixFrontendInstalledVersion" == "$zabbixFrontendCandidateVersion" -a "$zabbixagentInstalledVersion" == "$zabbixagentCandidateVersion" ] then cp -rp /etc/zabbix /tmp/ cp -p /usr/share/zabbix/conf/zabbix.conf.php /tmp/ From f89638ae409724d32152f007bdf0ffeada781782 Mon Sep 17 00:00:00 2001 From: Mickael-Martin Date: Wed, 12 Dec 2018 18:58:48 +0100 Subject: [PATCH 19/19] 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/