From d2e9c3f6c61684d30fe2006cdca69dda920648b0 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Tue, 1 Jun 2021 21:50:02 +0200 Subject: [PATCH] Fix --- scripts/install | 6 +++++- scripts/restore | 14 +++++--------- scripts/upgrade | 14 +++++--------- 3 files changed, 15 insertions(+), 19 deletions(-) diff --git a/scripts/install b/scripts/install index 039d0cc..5a3e191 100644 --- a/scripts/install +++ b/scripts/install @@ -63,7 +63,7 @@ ynh_install_app_dependencies $pkg_dependencies ynh_script_progression --message="Configuring system user..." --weight=3 # Create a system user -ynh_system_user_create --username=$app +ynh_system_user_create --username=$app --home_dir="$final_path" #================================================= # NGINX CONFIGURATION @@ -83,6 +83,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" +chmod 750 "$final_path" +chmod -R o-rwx "$final_path" +chown -R $app:www-data "$final_path" + #================================================= # SPECIFIC SETUP #================================================= diff --git a/scripts/restore b/scripts/restore index 8672a9b..4eb8c4b 100755 --- a/scripts/restore +++ b/scripts/restore @@ -53,7 +53,7 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_script_progression --message="Recreating the dedicated system user..." --weight=3 # Create the dedicated user (if not existing) -ynh_system_user_create --username=$app +ynh_system_user_create --username=$app --home_dir="$final_path" #================================================= # RESTORE OF THE MAIN DIR OF THE APP @@ -63,6 +63,10 @@ ynh_script_progression --message="Restoring the app main directory..." --weight= mkdir -p "$(dirname "$final_path")" ynh_restore_file --origin_path="$final_path" +chmod 750 "$final_path" +chmod -R o-rwx "$final_path" +chown -R $app:www-data "$final_path" + #================================================= # INSTALL DEPENDENCIES #================================================= @@ -70,14 +74,6 @@ ynh_script_progression --message="Reinstalling dependencies..." --weight=35 ynh_install_app_dependencies $pkg_dependencies -#================================================= -# SPECIFIC RESTORE -#================================================= -# RESTORE USER RIGHTS -#================================================= - -chown -R $app: "$final_path" - #================================================= # RESTORE THE UWSGI CONFIG #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index b63fc82..36899b4 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -73,7 +73,7 @@ ynh_install_app_dependencies $pkg_dependencies 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 +ynh_system_user_create --username=$app --home_dir="$final_path" #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE @@ -87,6 +87,10 @@ then ynh_setup_source --dest_dir="$final_path" --keep="$final_path/searx/settings.yml" fi +chmod 750 "$final_path" +chmod -R o-rwx "$final_path" +chown -R $app:www-data "$final_path" + #================================================= # NGINX CONFIGURATION #================================================= @@ -119,14 +123,6 @@ set +u; source $final_path/bin/activate; set -u pip3 install -U setuptools pip3 install --requirement $final_path/requirements-ynh.txt --upgrade -#================================================= -# GENERIC FINALISATION -#================================================= -# SECURING FILES AND DIRECTORIES -#================================================= - -chown -R $app: "$final_path" - #================================================= # CONFIGURE UWSGI FOR SEARX #=================================================