From 0f421c514505a4f445e43440e37c0c61da085286 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 26 Dec 2020 19:05:38 +0100 Subject: [PATCH] Fix --- scripts/install | 1 + scripts/restore | 1 + scripts/upgrade | 18 ++++++++++++++++-- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/scripts/install b/scripts/install index 340ef04..845e4c1 100644 --- a/scripts/install +++ b/scripts/install @@ -104,6 +104,7 @@ ynh_store_file_checksum --file="$final_path/data/config.php" # Set permissions to app files chown -R $app: $final_path +chmod -R 755 $final_path/data #================================================= # INTEGRATE SERVICE IN YUNOHOST diff --git a/scripts/restore b/scripts/restore index 310e62d..ae4d2e8 100644 --- a/scripts/restore +++ b/scripts/restore @@ -77,6 +77,7 @@ ynh_add_fpm_config --package="$extra_php_dependencies" # Restore permissions on app files chown -R $app: $final_path +chmod -R 755 $final_path/data #================================================= # INTEGRATE SERVICE IN YUNOHOST diff --git a/scripts/upgrade b/scripts/upgrade index d485a90..3c4c2b2 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -62,8 +62,22 @@ if [ "$upgrade_type" == "UPGRADE_APP" ] then ynh_script_progression --message="Upgrading source files..." --weight=5 - # Download, check integrity, uncompress and patch the source from app.src - ynh_setup_source --dest_dir="$final_path" + tmpdir="$(mktemp -d)" + + # Backup the config file in the temp dir + cp -a "$final_path/data" "$tmpdir/data" + + # Remove the app directory securely + ynh_secure_remove --file="$final_path" + + # Download, check integrity, uncompress and patch the source from app.src + ynh_setup_source --dest_dir="$final_path" + + # Copy the admin saved settings from tmp directory to final path + cp -a "$tmpdir/data" "$final_path/config/data" + + # Remove the tmp directory securely + ynh_secure_remove --file="$tmpdir" fi #=================================================