From c31739b1add3309d6e26fcc0f9fb423de8314cc1 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Thu, 13 May 2021 22:15:02 +0200 Subject: [PATCH] Apply last example_ynh --- scripts/change_url | 4 ++-- scripts/install | 2 +- scripts/remove | 2 +- scripts/restore | 4 ++-- scripts/upgrade | 48 +++++++++++++++++++++++----------------------- 5 files changed, 30 insertions(+), 30 deletions(-) diff --git a/scripts/change_url b/scripts/change_url index 29e33d5..354a070 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -71,7 +71,7 @@ fi #================================================= ynh_script_progression --message="Stopping a systemd service..." -ynh_systemd_action --service_name=$app --action=stop --log_path=systemd --line_match="Stopped wikijs service" +ynh_systemd_action --service_name=$app --action="stop" --log_path=systemd --line_match="Stopped wikijs service" #================================================= # MODIFY URL IN NGINX CONF @@ -110,7 +110,7 @@ fi ynh_script_progression --message="Starting a systemd service..." # Start a systemd service -ynh_systemd_action --service_name=$app --action=start --log_path=systemd --line_match="HTTP Server:" +ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="HTTP Server:" #================================================= # RELOAD NGINX diff --git a/scripts/install b/scripts/install index bc99cd9..4eff355 100644 --- a/scripts/install +++ b/scripts/install @@ -159,7 +159,7 @@ yunohost service add $app --description="$app daemon for Wiki.js" --log="/var/lo ynh_script_progression --message="Starting a systemd service..." # Start a systemd service -ynh_systemd_action --service_name=$app --action=start --log_path=systemd --line_match="HTTP Server:" +ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="HTTP Server:" #================================================= # SETUP SSOWAT diff --git a/scripts/remove b/scripts/remove index 2536b4a..d9d022c 100644 --- a/scripts/remove +++ b/scripts/remove @@ -50,7 +50,7 @@ ynh_remove_systemd_config ynh_script_progression --message="Removing the PostgreSQL database..." # Remove a database if it exists, along with the associated user -ynh_psql_remove_db --db_user="$db_user" --db_name="$db_name" +ynh_psql_remove_db --db_user=$db_user --db_name=$db_name #================================================= # REMOVE DEPENDENCIES diff --git a/scripts/restore b/scripts/restore index cca969e..3e1b9ff 100644 --- a/scripts/restore +++ b/scripts/restore @@ -51,7 +51,7 @@ test ! -d $final_path \ #================================================= # RESTORE THE NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Restoring the NGINX web server configuration..." +ynh_script_progression --message="Restoring the NGINX configuration..." ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" @@ -116,7 +116,7 @@ yunohost service add $app --description="$app daemon for Wiki.js" --log="/var/lo #================================================= ynh_script_progression --message="Starting a systemd service..." -ynh_systemd_action --service_name=$app --action=start --log_path=systemd --line_match="HTTP Server:" +ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="HTTP Server:" #================================================= # CREATE LDAP USER diff --git a/scripts/upgrade b/scripts/upgrade index 067c4cb..7ba8e5d 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -33,6 +33,29 @@ ynh_script_progression --message="Checking version..." upgrade_type=$(ynh_check_app_version_changed) +#================================================= +# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP +#================================================= +ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." + +# 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 +#================================================= +# STOP SYSTEMD SERVICE +#================================================= +ynh_script_progression --message="Stopping a systemd service..." + +ynh_systemd_action --service_name=$app --action=stop --log_path=systemd --line_match="Stopped wikijs service" + #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= @@ -74,29 +97,6 @@ if ynh_legacy_permissions_exists; then ynh_app_setting_delete --app=$app --key=is_public fi -#================================================= -# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP -#================================================= -ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." - -# 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 -#================================================= -# STOP SYSTEMD SERVICE -#================================================= -ynh_script_progression --message="Stopping a systemd service..." - -ynh_systemd_action --service_name=$app --action=stop --log_path=systemd --line_match="Stopped wikijs service" - #================================================= # CREATE DEDICATED USER #================================================= @@ -192,7 +192,7 @@ yunohost service add $app --description="$app daemon for Wiki.js" --log="/var/lo #================================================= ynh_script_progression --message="Starting a systemd service..." -ynh_systemd_action --service_name=$app --action=start --log_path=systemd --line_match="HTTP Server:" +ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="HTTP Server:" #================================================= # RELOAD NGINX