From 5d81a8c175167d6c534ed04eaacde6894077a95b Mon Sep 17 00:00:00 2001 From: yalh76 Date: Mon, 28 Mar 2022 20:09:08 +0200 Subject: [PATCH] manage rights --- scripts/install | 9 +++++++++ scripts/restore | 5 +++++ scripts/upgrade | 5 +++++ 3 files changed, 19 insertions(+) diff --git a/scripts/install b/scripts/install index ae5a408..1af459f 100644 --- a/scripts/install +++ b/scripts/install @@ -42,6 +42,9 @@ ynh_script_progression --message="Validating installation parameters..." # ynh_die --message="Admin username minimum length is 5" #fi +final_path=/var/www/$app +test ! -e "$final_path" || ynh_die --message="This path already contains a folder" + # Register (book) web path ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url @@ -72,6 +75,12 @@ ynh_script_progression --message="Installing dependencies..." ynh_install_app_dependencies $pkg_dependencies ynh_install_extra_app_dependencies --repo="deb https://packagecloud.io/pufferpanel/pufferpanel/debian/ buster main" --package="pufferpanel" --key="https://packagecloud.io/pufferpanel/pufferpanel/gpgkey" +ynh_app_setting_set --app=$app --key=final_path --value=$final_path + +chmod 750 "$final_path" +chmod -R o-rwx "$final_path" +chown -R $app:www-data "$final_path" + #================================================= # NGINX CONFIGURATION #================================================= diff --git a/scripts/restore b/scripts/restore index a56be37..dd764bd 100644 --- a/scripts/restore +++ b/scripts/restore @@ -29,6 +29,7 @@ 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) #================================================= # CHECK IF THE APP CAN BE RESTORED @@ -55,6 +56,10 @@ ynh_script_progression --message="Reinstalling dependencies..." ynh_install_app_dependencies $pkg_dependencies ynh_install_extra_app_dependencies --repo="deb https://packagecloud.io/pufferpanel/pufferpanel/debian/ buster main" --package="pufferpanel" --key="https://packagecloud.io/pufferpanel/pufferpanel/gpgkey" +chmod 750 "$final_path" +chmod -R o-rwx "$final_path" +chown -R $app:www-data "$final_path" + #================================================= # RESTORE VARIOUS FILES #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index fd9869a..23e8c3b 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -19,6 +19,7 @@ app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get --app=$app --key=domain) path_url=$(ynh_app_setting_get --app=$app --key=path) port=$(ynh_app_setting_get --app=$app --key=port) +final_path=$(ynh_app_setting_get --app=$app --key=final_path) #================================================= # CHECK VERSION @@ -79,6 +80,10 @@ ynh_script_progression --message="Upgrading dependencies..." ynh_install_app_dependencies $pkg_dependencies ynh_install_extra_app_dependencies --repo="deb https://packagecloud.io/pufferpanel/pufferpanel/debian/ buster main" --package="pufferpanel" --key="https://packagecloud.io/pufferpanel/pufferpanel/gpgkey" +chmod 750 "$final_path" +chmod -R o-rwx "$final_path" +chown -R $app:www-data "$final_path" + #================================================= # SPECIFIC UPGRADE #=================================================