From 61dd2fed3c9281d7b7704b1acce2e28e64e2c9d0 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 14 Aug 2021 23:17:26 +0200 Subject: [PATCH] Fix --- scripts/restore | 20 ++++++++++++-------- scripts/upgrade | 6 ++++-- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/scripts/restore b/scripts/restore index b699b72..ff9ef4a 100644 --- a/scripts/restore +++ b/scripts/restore @@ -53,6 +53,14 @@ ynh_script_progression --message="Restoring the NGINX configuration..." 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 #================================================= @@ -60,13 +68,9 @@ ynh_script_progression --message="Restoring $app main directory..." --weight=10 ynh_restore_file --origin_path="$final_path" -#================================================= -# 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 +chmod 750 "$final_path" +chmod -R o-rwx "$final_path" +chown -R $app:www-data "$final_path" #================================================= # RESTORE THE MYSQL DATABASE @@ -97,7 +101,7 @@ yunohost service add $app --description="Lightweight Git forge" --log="/var/log/ #================================================= ynh_script_progression --message="Starting a systemd service..." --weight=3 -ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="HTTP Server listening" +ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" #================================================= # RESTORE THE LOGROTATE CONFIGURATION diff --git a/scripts/upgrade b/scripts/upgrade index 6f1aba4..0f31634 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -88,6 +88,10 @@ 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" +chmod 750 "$final_path" +chmod -R o-rwx "$final_path" +chown -R $app:www-data "$final_path" + ynh_backup_if_checksum_is_different "$final_path/custom/conf/app.ini" cp ../conf/app.ini "$final_path/custom/conf" @@ -140,10 +144,8 @@ ynh_add_nginx_config #================================================= # Set permissions to app files -chown -R $app:$app "$final_path" chown -R $app:$app "/home/$app" chown -R $app:$app "/var/log/$app" -chmod u=rwX,g=rX,o= "$final_path" chmod u=rwX,g=rX,o= "/home/$app" chmod u=rwX,g=rX,o= "/var/log/$app"