1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/monitorix_ynh.git synced 2024-09-03 19:46:06 +02:00
monitorix_ynh/scripts/upgrade

84 lines
2.4 KiB
Text
Raw Normal View History

2017-01-05 23:37:07 +01:00
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
2020-11-17 23:37:38 +01:00
# Import common cmd
source ./experimental_helper.sh
source ./_common.sh
2017-07-21 22:11:45 +02:00
# Source YunoHost helpers
source /usr/share/yunohost/helpers
# Stop script if errors
ynh_abort_if_errors
ynh_script_progression --message="Loading installation settings..."
2017-01-05 23:37:07 +01:00
# Retrieve app settings
domain=$(ynh_app_setting_get --app $app --key domain)
path_url=$(ynh_normalize_url_path --path_url $(ynh_app_setting_get --app $app --key path))
port=$(ynh_app_setting_get --app $app --key http_port)
nginx_status_port=$(ynh_app_setting_get --app $app --key nginx_status_port)
2017-01-05 23:37:07 +01:00
dbuser=$app
dbname=$app
dbpass=$(ynh_app_setting_get --app $app --key mysqlpwd)
2017-01-05 23:37:07 +01:00
2017-11-11 00:04:32 +01:00
# Stop services
ynh_script_progression --message="Stoping services..."
2017-11-11 00:04:32 +01:00
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
#=================================================
# STANDARD UPGRADE STEPS
#=================================================
# Install package
ynh_script_progression --message="Installing dependencies..." --weight=6
install_dependances
2017-10-31 23:08:23 +01:00
# Download package and install it
ynh_script_progression --message="Upgrading source files..." --weight=6
2017-10-31 23:08:23 +01:00
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
ynh_script_progression --message="Configuring application..."
2017-07-21 22:11:45 +02:00
config_monitorix
2017-01-05 23:37:07 +01:00
2018-08-31 14:52:48 +02:00
# Remove old hook if exist
ynh_secure_remove --file=/usr/share/yunohost/hooks/post_iptable_rules/50-$app
#=================================================
# GENERIC FINALIZATION
#=================================================
# Set access
ynh_script_progression --message="Protecting directory..."
set_permission
2020-11-17 23:37:38 +01:00
# register yunohost service
yunohost service add monitorix
2018-05-01 21:00:07 +02:00
# Reload monitorix
# 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
ynh_script_progression --message="Starting monitorix services..." --weight=3
systemctl stop monitorix.service
2018-05-01 21:00:07 +02:00
sleep 1
pkill -f "monitorix-httpd listening on" || true
ynh_systemd_action -l ' - Ok, ready.' -p '/var/log/monitorix'
ynh_script_progression --message="Upgrade of $app completed" --last