diff --git a/check_process b/check_process index 6398508..a4478f2 100644 --- a/check_process +++ b/check_process @@ -16,7 +16,6 @@ upgrade=1 from_commit=d79ec131b3038ff4695c3317b5d3ee4eda9c8932 backup_restore=1 multi_instance=0 - incorrect_path=1 port_already_use=1 (4711) change_url=1 ;;; Levels diff --git a/scripts/change_url b/scripts/change_url index 639d46c..453d098 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -30,14 +30,21 @@ ynh_script_progression --message="Load settings" --weight=2 final_path=$(ynh_app_setting_get $app final_path) #================================================= -# CHECK THE SYNTAX OF THE PATHS +# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= -ynh_script_progression --message="Check the syntax of the paths" +ynh_script_progression --message="Backing up the app before changing its url (may take a while)..." --weight=11 -test -n "$old_path" || old_path="/" -test -n "$new_path" || new_path="/" -new_path=$(ynh_normalize_url_path $new_path) -old_path=$(ynh_normalize_url_path $old_path) +# Backup the current version of the app +ynh_backup_before_upgrade +ynh_clean_setup () { + # Remove the new domain config file, the remove script won't do it as it doesn't know yet its location. + ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" + + # restore it if the upgrade fails + ynh_restore_upgradebackup +} +# Exit if an error occurs during the execution of the script +ynh_abort_if_errors #================================================= # ACTIVATE MAINTENANCE MODE diff --git a/scripts/install b/scripts/install index 5dad0f4..c62a480 100644 --- a/scripts/install +++ b/scripts/install @@ -357,7 +357,7 @@ cp ../conf/dnsmasq_regenconf_hook /usr/share/yunohost/hooks/conf_regen/50-dnsmas # ADVERTISE SERVICE IN ADMIN PANEL #================================================= -yunohost service add pihole-FTL --log "/var/log/pihole-FTL.log" +yunohost service add pihole-FTL --description "PiHole backend service" --log "/var/log/pihole-FTL.log" #================================================= # RESTRAIN THE ACCESS TO THE ADMIN ONLY diff --git a/scripts/remove b/scripts/remove index fd657ff..f0bb7ac 100755 --- a/scripts/remove +++ b/scripts/remove @@ -26,7 +26,7 @@ port=$(ynh_app_setting_get $app port) #================================================= # Check if the service is declared in YunoHost -if yunohost service status | grep -q pihole-FTL +if ynh_exec_fully_quiet yunohost service status pihole-FTL then ynh_print_info "Remove pihole-FTL service" >&2 yunohost service remove pihole-FTL diff --git a/scripts/restore b/scripts/restore index 5f957ca..39e495b 100644 --- a/scripts/restore +++ b/scripts/restore @@ -102,7 +102,7 @@ ynh_install_app_dependencies $app_depencencies # ADVERTISE SERVICE IN ADMIN PANEL #================================================= -yunohost service add pihole-FTL --log "/var/log/pihole-FTL.log" +yunohost service add pihole-FTL --description "PiHole backend service" --log "/var/log/pihole-FTL.log" #================================================= # RESTORE THE CRON FILE