2017-01-05 23:37:07 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
2017-07-21 22:11:45 +02:00
|
|
|
# Source YunoHost helpers
|
|
|
|
source /usr/share/yunohost/helpers
|
2017-01-31 21:26:13 +01:00
|
|
|
|
2017-07-21 22:11:45 +02:00
|
|
|
# Stop script if errors
|
|
|
|
ynh_abort_if_errors
|
2017-01-31 21:26:13 +01:00
|
|
|
|
2017-07-21 22:11:45 +02:00
|
|
|
# Import common cmd
|
|
|
|
source ../settings/scripts/_common.sh
|
2017-01-05 23:37:07 +01:00
|
|
|
|
|
|
|
# Retrieve old app settings
|
|
|
|
domain=$(ynh_app_setting_get "$app" domain)
|
2017-07-21 22:11:45 +02:00
|
|
|
path=$(ynh_normalize_url_path $(ynh_app_setting_get "$app" path))
|
2017-01-05 23:37:07 +01:00
|
|
|
|
|
|
|
# Check domain/path availability
|
2017-07-21 22:11:45 +02:00
|
|
|
ynh_webpath_available $domain $path || ynh_die "$domain/$path is not available, please use an other domain or path."
|
|
|
|
|
|
|
|
# Download package
|
|
|
|
get_source
|
2017-01-05 23:37:07 +01:00
|
|
|
|
|
|
|
# Install package
|
2017-07-21 22:11:45 +02:00
|
|
|
install_dependances
|
2017-01-05 23:37:07 +01:00
|
|
|
|
2017-07-21 22:11:45 +02:00
|
|
|
# Create user for database
|
2017-01-05 23:37:07 +01:00
|
|
|
dbuser=$app
|
|
|
|
dbpass=$(ynh_app_setting_get "$app" mysqlpwd)
|
2017-07-21 22:11:45 +02:00
|
|
|
ynh_mysql_create_user $dbuser $dbpass
|
2017-01-05 23:37:07 +01:00
|
|
|
|
2017-07-21 22:11:45 +02:00
|
|
|
# Restore all config and data
|
2017-08-16 14:46:25 +02:00
|
|
|
ynh_secure_remove /etc/monitorix # we remove the directory because if it is not empty the ynh_restore cmd fail
|
2017-10-30 21:59:43 +01:00
|
|
|
ynh_secure_remove /var/lib/monitorix
|
2017-07-21 22:11:45 +02:00
|
|
|
ynh_restore
|
2017-01-05 23:37:07 +01:00
|
|
|
|
2017-08-16 14:46:25 +02:00
|
|
|
# Reload nginx
|
|
|
|
systemctl reload nginx.service
|
|
|
|
|
2017-07-21 22:11:45 +02:00
|
|
|
# Reload services
|
|
|
|
systemctl restart monitorix.service
|