|
@@ -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
|
|
|
#=================================================
|
|
#=================================================
|
|
@@ -71,87 +58,55 @@ path_url=$(ynh_normalize_url_path $path_url)
|
|
|
#=================================================
|
|
#=================================================
|
|
|
# STANDARD UPGRADE STEPS
|
|
# STANDARD UPGRADE STEPS
|
|
|
#=================================================
|
|
#=================================================
|
|
|
-# DOWNLOAD, CHECK AND UNPACK SOURCE
|
|
|
|
|
-#=================================================
|
|
|
|
|
-
|
|
|
|
|
-# Download, check integrity, uncompress and patch the source from app.src
|
|
|
|
|
-ynh_setup_source "$final_path"
|
|
|
|
|
-
|
|
|
|
|
-#=================================================
|
|
|
|
|
-# NGINX CONFIGURATION
|
|
|
|
|
-#=================================================
|
|
|
|
|
-
|
|
|
|
|
-# Create a dedicated nginx config
|
|
|
|
|
-ynh_add_nginx_config
|
|
|
|
|
-
|
|
|
|
|
-#=================================================
|
|
|
|
|
-# UPGRADE DEPENDENCIES
|
|
|
|
|
-#=================================================
|
|
|
|
|
|
|
|
|
|
-ynh_install_app_dependencies deb1 deb2
|
|
|
|
|
|
|
+ynh_package_update
|
|
|
|
|
|
|
|
-#=================================================
|
|
|
|
|
-# CREATE DEDICATED USER
|
|
|
|
|
-#=================================================
|
|
|
|
|
|
|
+zabbixServerInstalledVersion=$(apt-cache policy zabbix-server-mysql | grep -Po "Installed: \K(.*)")
|
|
|
|
|
+zabbixServerCandidateVersion=$(apt-cache policy zabbix-server-mysql | grep -Po "Candidate: \K(.*)")
|
|
|
|
|
|
|
|
-# Create a dedicated user (if not existing)
|
|
|
|
|
-ynh_system_user_create $app
|
|
|
|
|
|
|
+zabbixFrontendInstalledVersion=$(apt-cache policy zabbix-frontend-php | grep -Po "Installed: \K(.*)")
|
|
|
|
|
+zabbixFrontendCandidateVersion=$(apt-cache policy zabbix-frontend-php | grep -Po "Candidate: \K(.*)")
|
|
|
|
|
|
|
|
-#=================================================
|
|
|
|
|
-# PHP-FPM CONFIGURATION
|
|
|
|
|
-#=================================================
|
|
|
|
|
-
|
|
|
|
|
-# Create a dedicated php-fpm config
|
|
|
|
|
-ynh_add_fpm_config
|
|
|
|
|
-
|
|
|
|
|
-#=================================================
|
|
|
|
|
-# SPECIFIC UPGRADE
|
|
|
|
|
-#=================================================
|
|
|
|
|
-# ...
|
|
|
|
|
-#=================================================
|
|
|
|
|
|
|
+zabbixagentInstalledVersion=$(apt-cache policy zabbix-agent | grep -Po "Installed: \K(.*)")
|
|
|
|
|
+zabbixagentCandidateVersion=$(apt-cache policy zabbix-agent | grep -Po "Candidate: \K(.*)")
|
|
|
|
|
|
|
|
-### 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"
|
|
|
|
|
-
|
|
|
|
|
-#=================================================
|
|
|
|
|
-# 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 ]
|
|
|
|
|
|
|
+if [ "$zabbixServerInstalledVersion" != "$zabbixServerCandidateVersion" -o "$zabbixFrontendInstalledVersion" != "$zabbixFrontendCandidateVersion" -o "$zabbixagentInstalledVersion" != "$zabbixagentCandidateVersion" ]
|
|
|
then
|
|
then
|
|
|
- # unprotected_uris allows SSO credentials to be passed anyway
|
|
|
|
|
- ynh_app_setting_set $app unprotected_uris "/"
|
|
|
|
|
|
|
+ #=================================================
|
|
|
|
|
+ # 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/
|
|
|
|
|
+
|
|
|
|
|
+ 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
|
|
fi
|
|
|
-
|
|
|
|
|
-#=================================================
|
|
|
|
|
-# RELOAD NGINX
|
|
|
|
|
-#=================================================
|
|
|
|
|
-
|
|
|
|
|
-systemctl reload nginx
|
|
|