From 192d3f263841d64a3f39a0dd20e041587cb25f73 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 21 Mar 2021 22:48:29 +0100 Subject: [PATCH] Create user before source install --- manifest.json | 2 +- scripts/install | 16 ++++++++-------- scripts/restore | 16 ++++++++-------- scripts/upgrade | 16 ++++++++-------- 4 files changed, 25 insertions(+), 25 deletions(-) diff --git a/manifest.json b/manifest.json index 01ae05e..7a7c868 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Multi-protocols bridge for online communications", "fr": "Connecteur entre une série de protocoles de discussion" }, - "version": "1.21.0~ynh2", + "version": "1.21.0~ynh3", "url": "https://github.com/42wim/matterbridge", "license": "Apache-2.0", "maintainer": { diff --git a/scripts/install b/scripts/install index 0fcd99f..ef94df5 100644 --- a/scripts/install +++ b/scripts/install @@ -32,6 +32,14 @@ ynh_script_progression --message="Validating installation parameters..." --weigh final_path=/opt/yunohost/$app test ! -e "$final_path" || ynh_die --message="This path already contains a folder" +#================================================= +# CREATE DEDICATED USER +#================================================= +ynh_script_progression --message="Configuring system user..." --weight=5 + +# Create a system user +ynh_system_user_create --username=$app --home_dir="$final_path" + #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= @@ -41,14 +49,6 @@ ynh_app_setting_set --app=$app --key=final_path --value=$final_path # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir="$final_path" --source_id="$architecture" -#================================================= -# CREATE DEDICATED USER -#================================================= -ynh_script_progression --message="Configuring system user..." --weight=5 - -# Create a system user -ynh_system_user_create --username=$app - #================================================= # MODIFY A CONFIG FILE #================================================= diff --git a/scripts/restore b/scripts/restore index 6eeec54..a4429f9 100644 --- a/scripts/restore +++ b/scripts/restore @@ -24,20 +24,20 @@ app=$YNH_APP_INSTANCE_NAME final_path=$(ynh_app_setting_get --app=$app --key=final_path) -#================================================= -# RESTORE THE APP MAIN DIR -#================================================= -ynh_script_progression --message="Restoring the app main directory..." --weight=1 - -ynh_restore_file --origin_path="$final_path" - #================================================= # RECREATE THE DEDICATED USER #================================================= ynh_script_progression --message="Recreating the dedicated system user..." --weight=4 # Create the dedicated user (if not existing) -ynh_system_user_create --username=$app +ynh_system_user_create --username=$app --home_dir="$final_path" + +#================================================= +# RESTORE THE APP MAIN DIR +#================================================= +ynh_script_progression --message="Restoring the app main directory..." --weight=1 + +ynh_restore_file --origin_path="$final_path" #================================================= # RESTORE USER RIGHTS diff --git a/scripts/upgrade b/scripts/upgrade index ea67284..3d45c33 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -48,6 +48,14 @@ ynh_script_progression --message="Stopping a systemd service..." --weight=1 ynh_systemd_action --service_name=$app --action=stop --log_path="/var/log/$app/$app.log" +#================================================= +# CREATE DEDICATED USER +#================================================= +ynh_script_progression --message="Making sure dedicated system user exists..." --weight=4 + +# Create a dedicated user (if not existing) +ynh_system_user_create --username=$app --home_dir="$final_path" + #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= @@ -60,14 +68,6 @@ then ynh_setup_source --dest_dir="$final_path" --source_id="$architecture" fi -#================================================= -# CREATE DEDICATED USER -#================================================= -ynh_script_progression --message="Making sure dedicated system user exists..." --weight=4 - -# Create a dedicated user (if not existing) -ynh_system_user_create --username=$app - #================================================= # SETUP SYSTEMD #=================================================