From 6d58ed46fdae8b4fd7e15e1b6d43813ebe5b5eee Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Thu, 30 Mar 2023 20:59:37 +0200 Subject: [PATCH] fix data_dir/data/ --- manifest.toml | 2 -- scripts/install | 9 +++++---- scripts/restore | 10 +++++----- scripts/upgrade | 8 ++++---- 4 files changed, 14 insertions(+), 15 deletions(-) diff --git a/manifest.toml b/manifest.toml index 5aac6fb..5b06bef 100644 --- a/manifest.toml +++ b/manifest.toml @@ -64,8 +64,6 @@ ram.runtime = "50M" [resources.install_dir] [resources.data_dir] - dir = "/home/yunohost.app/__APP__/data" - owner = "__APP__:www-data" [resources.permissions] main.url = "/" diff --git a/scripts/install b/scripts/install index 28db172..9c8e64f 100644 --- a/scripts/install +++ b/scripts/install @@ -45,11 +45,12 @@ ynh_add_nginx_config #================================================= ynh_script_progression --message="Creating a data directory..." --weight=1 -mkdir -p $data_dir/{static,media,music} +mkdir -p $data_dir/data +mkdir -p $data_dir/data/{static,media,music} -chmod 750 "$data_dir" -chmod -R o-rwx "$data_dir" -chown -R $app:www-data "$data_dir" +chmod 750 "$data_dir/data/" +chmod -R o-rwx "$data_dir/data/" +chown -R $app:www-data "$data_dir/data/" #================================================= # ADD A CONFIGURATION diff --git a/scripts/restore b/scripts/restore index 939c888..7b7f1d3 100644 --- a/scripts/restore +++ b/scripts/restore @@ -25,13 +25,13 @@ chown -R $app:www-data "$install_dir" #================================================= ynh_script_progression --message="Restoring the data directory..." --weight=1 -ynh_restore_file --origin_path="$data_dir" --not_mandatory +ynh_restore_file --origin_path="$data_dir/data/" --not_mandatory -mkdir -p $data_dir/{static,media,music} +mkdir -p $data_dir/data/{static,media,music} -chmod 750 "$data_dir" -chmod -R o-rwx "$data_dir" -chown -R $app:www-data "$data_dir" +chmod 750 "$data_dir/data/" +chmod -R o-rwx "$data_dir/data/" +chown -R $app:www-data "$data_dir/data/" #================================================= # RESTORE THE NGINX CONFIGURATION diff --git a/scripts/upgrade b/scripts/upgrade index 913437c..01b3d2a 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -31,7 +31,7 @@ ynh_systemd_action --action="stop" --service_name="${app}-worker" --log_path="sy #================================================= # If data_dir doesn't exist, create it -if [ -z "$data_dir" ]; then +if [ -z "$data_dir/data/" ]; then # Do a full backup before moving datas yunohost backup create --apps $app @@ -74,9 +74,9 @@ if [ -z "$data_dir" ]; then ynh_secure_remove --file="$install_dir/import" ynh_secure_remove --file="$install_dir/code/data/music" - chmod 750 "$data_dir" - chmod -R o-rwx "$data_dir" - chown -R $app:www-data "$data_dir" + chmod 750 "$data_dir/data/" + chmod -R o-rwx "$data_dir/data/" + chown -R $app:www-data "$data_dir/data/" upgrade_type="UPGRADE_APP" fi