From 8ba002fe08b09619108d835b1a9ed7857b53d570 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Tue, 25 May 2021 10:35:22 +0200 Subject: [PATCH] Fix --- manifest.json | 5 +++- scripts/install | 41 ++++++++++++++++-------------- scripts/restore | 12 ++++++--- scripts/upgrade | 66 +++++++++++++++++++++++++++---------------------- 4 files changed, 70 insertions(+), 54 deletions(-) diff --git a/manifest.json b/manifest.json index a35b745..a2857f6 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Videoconferencing server that is easy to deploy", "fr": "Serveur de visioconférence facile à déployer" }, - "version": "0.3.5~ynh2", + "version": "0.3.5~ynh1", "url": "https://galene.org/", "upstream": { "license": "MIT", @@ -71,7 +71,10 @@ { "name": "group_description", "type": "string", +<<<<<<< HEAD "optional": true, +======= +>>>>>>> parent of 4342431 (Cleaning up) "ask": { "en": "Choose a description for the group you want to create", "fr": "Décrivez le groupe que vous souhaitez créer" diff --git a/scripts/install b/scripts/install index 0b7ab54..485839c 100755 --- a/scripts/install +++ b/scripts/install @@ -76,14 +76,6 @@ ynh_script_progression --message="Configuring firewall..." --weight=1 ynh_exec_warn_less yunohost firewall allow Both $turn_port -#================================================= -# CREATE DEDICATED USER -#================================================= -ynh_script_progression --message="Configuring system user..." --weight=3 - -# Create a system user -ynh_system_user_create --username=$app --home_dir="$final_path" - #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= @@ -93,10 +85,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" -# Set permissions to app files -chown -R $app: $final_path -chmod -R 750 $final_path - #================================================= # CREATE DATA AND GROUPS FOLDER #================================================= @@ -130,15 +118,12 @@ ynh_script_progression --message="Configuring NGINX web server..." --weight=2 ynh_add_nginx_config #================================================= -# MODIFY A CONFIG FILE +# CREATE DEDICATED USER #================================================= +ynh_script_progression --message="Configuring system user..." --weight=3 -ynh_add_config --template="../conf/passwd" --destination="$final_path/data/passwd" - -ynh_add_config --template="../conf/groupname.json" --destination="$final_path/groups/$group_name.json" - -chmod 400 "$final_path/data/passwd" -chown $app:$app "$final_path/data/passwd" +# Create a system user +ynh_system_user_create --username=$app --home_dir="$final_path" #================================================= # SETUP SYSTEMD @@ -150,6 +135,24 @@ public_ip4="$(curl -s ip.yunohost.org)" || true # Create a dedicated systemd config ynh_add_systemd_config +#================================================= +# MODIFY A CONFIG FILE +#================================================= + +ynh_add_config --template="../conf/passwd" --destination="$final_path/data/passwd" + +ynh_add_config --template="../conf/groupname.json" --destination="$final_path/groups/$group_name.json" + +#================================================= +# GENERIC FINALIZATION +#================================================= +# SECURE FILES AND DIRECTORIES +#================================================= + +# Set permissions to app files +chown -R $app: $final_path +chmod -R 750 $final_path + #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= diff --git a/scripts/restore b/scripts/restore index 67abb11..27da783 100755 --- a/scripts/restore +++ b/scripts/restore @@ -51,6 +51,13 @@ test ! -d $final_path \ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" +#================================================= +# 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 #================================================= @@ -60,11 +67,8 @@ ynh_script_progression --message="Recreating the dedicated system user..." --wei ynh_system_user_create --username=$app --home_dir="$final_path" #================================================= -# RESTORE THE APP MAIN DIR +# RESTORE USER RIGHTS #================================================= -ynh_script_progression --message="Restoring the app main directory..." --weight=1 - -ynh_restore_file --origin_path="$final_path" # Restore permissions on app files chown -R $app: $final_path diff --git a/scripts/upgrade b/scripts/upgrade index ac00377..d3669f2 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -31,6 +31,24 @@ architecture=$(ynh_detect_arch) upgrade_type=$(ynh_check_app_version_changed) +#================================================= +# ENSURE DOWNWARD COMPATIBILITY +#================================================= +ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 + +# If final_path doesn't exist, create it +if [ -z "$final_path" ]; then + final_path=/opt/yunohost/$app + ynh_app_setting_set --app=$app --key=final_path --value=$final_path +fi + +# Cleaning legacy permissions +if ynh_legacy_permissions_exists; then + ynh_legacy_permissions_delete_all + + ynh_app_setting_delete --app=$app --key=is_public +fi + #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= @@ -54,32 +72,6 @@ ynh_script_progression --message="Stopping a systemd service..." --weight=3 ynh_systemd_action --service_name=$app --action=stop --log_path="/var/log/$app/$app.log" -#================================================= -# ENSURE DOWNWARD COMPATIBILITY -#================================================= -ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 - -# If final_path doesn't exist, create it -if [ -z "$final_path" ]; then - final_path=/opt/yunohost/$app - ynh_app_setting_set --app=$app --key=final_path --value=$final_path -fi - -# Cleaning legacy permissions -if ynh_legacy_permissions_exists; then - ynh_legacy_permissions_delete_all - - ynh_app_setting_delete --app=$app --key=is_public -fi - -#================================================= -# CREATE DEDICATED USER -#================================================= -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" - #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= @@ -118,10 +110,6 @@ then popd fi -# Set permissions on app files -chown -R $app: $final_path -chmod -R 750 $final_path - #================================================= # NGINX CONFIGURATION #================================================= @@ -130,6 +118,14 @@ ynh_script_progression --message="Upgrading NGINX web server configuration..." - # Create a dedicated NGINX config ynh_add_nginx_config +#================================================= +# CREATE DEDICATED USER +#================================================= +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" + #================================================= # SETUP SYSTEMD #================================================= @@ -140,6 +136,16 @@ public_ip4="$(curl -s ip.yunohost.org)" || true # Create a dedicated systemd config ynh_add_systemd_config +#================================================= +# GENERIC FINALIZATION +#================================================= +# SECURE FILES AND DIRECTORIES +#================================================= + +# Set permissions on app files +chown -R $app: $final_path +chmod -R 750 $final_path + #================================================= # INTEGRATE SERVICE IN YUNOHOST #=================================================