2017-01-05 23:37:07 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
2018-01-31 16:07:43 +01:00
|
|
|
#=================================================
|
|
|
|
# GENERIC START
|
|
|
|
#=================================================
|
|
|
|
|
2017-07-21 22:11:45 +02:00
|
|
|
# Source YunoHost helpers
|
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
|
|
|
# Stop script if errors
|
|
|
|
ynh_abort_if_errors
|
|
|
|
|
2017-01-05 23:37:07 +01:00
|
|
|
# Import common cmd
|
2018-01-31 16:07:43 +01:00
|
|
|
source ./experimental_helper.sh
|
2017-01-05 23:37:07 +01:00
|
|
|
source ./_common.sh
|
|
|
|
|
|
|
|
# Retrieve app settings
|
|
|
|
domain=$(ynh_app_setting_get "$app" domain)
|
2018-05-07 23:08:03 +02:00
|
|
|
path_url=$(ynh_normalize_url_path $(ynh_app_setting_get "$app" path))
|
|
|
|
port=$(ynh_app_setting_get "$app" http_port)
|
2017-01-05 23:37:07 +01:00
|
|
|
nginx_status_port=$(ynh_app_setting_get "$app" nginx_status_port)
|
|
|
|
dbuser=$app
|
|
|
|
dbname=$app
|
|
|
|
dbpass=$(ynh_app_setting_get "$app" mysqlpwd)
|
|
|
|
|
2017-11-11 00:04:32 +01:00
|
|
|
# Stop services
|
|
|
|
systemctl stop monitorix.service
|
|
|
|
|
2018-01-13 21:31:48 +01:00
|
|
|
# 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
|
|
|
|
|
2018-01-31 16:07:43 +01:00
|
|
|
#=================================================
|
|
|
|
# STANDARD UPGRADE STEPS
|
|
|
|
#=================================================
|
|
|
|
|
2017-10-31 23:08:23 +01:00
|
|
|
# Download package and install it
|
|
|
|
get_install_source
|
2017-01-05 23:37:07 +01:00
|
|
|
|
2017-07-21 22:11:45 +02:00
|
|
|
# Update nginx config
|
|
|
|
config_nginx
|
2017-01-05 23:37:07 +01:00
|
|
|
|
|
|
|
# Update monitorix configuration
|
2017-07-21 22:11:45 +02:00
|
|
|
config_monitorix
|
2017-01-05 23:37:07 +01:00
|
|
|
|
2018-04-30 21:41:07 +02:00
|
|
|
# Add hook
|
|
|
|
mkdir -p /usr/share/yunohost/hooks/post_iptable_rules
|
|
|
|
cp ../conf/post_iptable_rules_hook /usr/share/yunohost/hooks/post_iptable_rules/50-$app
|
|
|
|
|
2018-01-31 16:07:43 +01:00
|
|
|
#=================================================
|
|
|
|
# GENERIC FINALIZATION
|
|
|
|
#=================================================
|
|
|
|
|
2018-01-29 18:57:10 +01:00
|
|
|
# Set access
|
|
|
|
set_permission
|
|
|
|
|
2018-05-01 21:00:07 +02:00
|
|
|
# Reload monitorix
|
2018-05-07 23:08:03 +02:00
|
|
|
# While we stop monitorix sometime the built-in web server is not stopped cleanly. So are sure that everything is cleanly stoped by that
|
2018-05-01 21:00:07 +02:00
|
|
|
# So this fix that
|
|
|
|
sudo systemctl stop monitorix.service
|
|
|
|
sleep 1
|
2018-05-07 23:08:03 +02:00
|
|
|
pkill -f "monitorix-httpd listening on" || true
|
|
|
|
ynh_check_starting ' - Ok, ready.' '/var/log/monitorix'
|