From 25bdd9ab0a9659706bc75d0d0f714db68b9ac2ec Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 5 Jun 2021 08:14:50 +0200 Subject: [PATCH] Fix --- scripts/remove | 12 ++++++------ scripts/restore | 49 ++++++++++++++++++------------------------------- scripts/upgrade | 4 ++-- 3 files changed, 26 insertions(+), 39 deletions(-) diff --git a/scripts/remove b/scripts/remove index 9d222cb..96acc80 100644 --- a/scripts/remove +++ b/scripts/remove @@ -16,12 +16,12 @@ ynh_script_progression --message="Loading installation settings..." --weight=1 app=$YNH_APP_INSTANCE_NAME -domain=$(ynh_app_setting_get "$app" domain) -path=$(ynh_app_setting_get "$app" path) -port=$(ynh_app_setting_get "$app" port) -port_web=$(ynh_app_setting_get "$app" port_web) -mumbleweb=$(ynh_app_setting_get "$app" mumbleweb) -final_path=$(ynh_app_setting_get "$app" final_path) +domain=$(ynh_app_setting_get --app=$app --key=domain) +path=$(ynh_app_setting_get --app=$app --key=path) +port=$(ynh_app_setting_get --app=$app --key=port) +port_web=$(ynh_app_setting_get --app=$app --key=port_web) +mumbleweb=$(ynh_app_setting_get --app=$app --key=mumbleweb) +final_path=$(ynh_app_setting_get --app=$app --key=final_path) #================================================= # STANDARD REMOVE diff --git a/scripts/restore b/scripts/restore index 6f67f86..8844cbb 100644 --- a/scripts/restore +++ b/scripts/restore @@ -22,9 +22,9 @@ ynh_script_progression --message="Loading installation settings..." --weight=1 app=$YNH_APP_INSTANCE_NAME -domain=$(ynh_app_setting_get --app="$app" --key=domain) -path_url=$(ynh_app_setting_get --app="$app" --key=path) -final_path=$(ynh_app_setting_get --app"$app" --key=final_path) +domain=$(ynh_app_setting_get --app=$app --key=domain) +path_url=$(ynh_app_setting_get --app=$app --key=path) +final_path=$(ynh_app_setting_get --app=$app --key=final_path) #================================================= @@ -47,6 +47,15 @@ test ! -d $final_path \ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" +#================================================= +# RECREATE THE DEDICATED USER +#================================================= + +ynh_script_progression --message="Recreating the dedicated system user..." --weight=1 + +# Create the dedicated user (if not existing) +ynh_system_user_create --username="$app" --home_dir="$final_path" + #================================================= # RESTORE THE APP MAIN DIR #================================================= @@ -55,20 +64,13 @@ ynh_script_progression --message="Restoring the app main directory..." --weight= ynh_restore_file --origin_path="$final_path" #================================================= -# RECREATE THE DEDICATED USER +# REINSTALL DEPENDENCIES #================================================= - -ynh_script_progression --message="Recreating the dedicated system user..." --weight=1 - -# Create the dedicated user (if not existing) -ynh_system_user_create --username="$app" - ynh_script_progression --message="Reinstalling dependencies..." --weight=4 # Define and install dependencies ynh_install_app_dependencies $pkg_dependencies - #================================================= # RESTORE USER RIGHTS #================================================= @@ -77,16 +79,6 @@ ynh_install_app_dependencies $pkg_dependencies chmod -R 770 "$final_path" chown -R :mumble-server "$final_path" -#================================================= -# SPECIFIC RESTORATION -#================================================= -# REINSTALL DEPENDENCIES -#================================================= -ynh_script_progression --message="Reinstalling dependencies..." --weight=1 - -# Define and install dependencies -ynh_install_app_dependencies $pkg_dependencies - #================================================= # Add user to ssl-cert so it can read certificates #================================================= @@ -114,10 +106,10 @@ yunohost service add $app --description="Mumble server" --log="/var/log/$app/$ap ynh_script_progression --message="Restoring the systemd configuration..." --weight=1 ynh_restore_file --origin_path="/etc/systemd/system/$app.service" -systemctl enable "$app.service" +systemctl enable "$app.service" --quiet -ynh_restore_file --origin_path="/etc/systemd/system/$app-web.service" -systemctl enable "$app-web.service" +ynh_restore_file --origin_path="/etc/systemd/system/mumble-web.service" +systemctl enable "mumble-web.service" --quiet #================================================= # START SYSTEMD SERVICE @@ -125,22 +117,17 @@ systemctl enable "$app-web.service" ynh_script_progression --message="Starting a systemd service..." --weight=1 ynh_systemd_action --service_name="$app" --action="start" -ynh_systemd_action --service_name="$app-web" --action="start" +ynh_systemd_action --service_name="mumble-web" --action="start" #================================================= # GENERIC FINALIZATION #================================================= # RELOAD NGINX AND PHP-FPM #================================================= -ynh_script_progression --message="Reloading nginx web server..." --weight=1 +ynh_script_progression --message="Reloading NGINX web server..." --weight=1 ynh_systemd_action --service_name=nginx --action=reload -ynh_script_progression --message="Restoring the systemd configuration..." --weight=1 - -ynh_restore_file --origin_path="/etc/systemd/system/$app.service" -systemctl enable $app.service --quiet - #================================================= # START SYSTEMD SERVICE #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 8367043..34888b5 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -130,7 +130,7 @@ ynh_systemd_action --service_name="mumble-web" --action="stop" #================================================= # CREATE DEDICATED USER #================================================= -ynh_script_progression --message="Making sure dedicated system user exists..." --time --weight=1 +ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1 # Create a dedicated user (if not existing) ynh_system_user_create --username="$app" --home_dir="$final_path" @@ -150,7 +150,7 @@ fi #================================================= # NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Upgrading NGINX web server configuration..." --time --weight=1 +ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=5 # Create a dedicated nginx config ynh_add_nginx_config