From cd7a006c1080324e6bbb9201957360e5dd84413f Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 27 Dec 2020 17:38:48 +0100 Subject: [PATCH] Update upgrade --- scripts/upgrade | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 27c2064..0eb7027 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -77,9 +77,25 @@ ynh_abort_if_errors if [ "$upgrade_type" == "UPGRADE_APP" ] then ynh_script_progression --message="Upgrading source files..." --weight=4 + + tmpdir="$(mktemp -d)" + + # Backup the config file in the temp dir + cp -a "$final_path/public/dist/user.css" "$tmpdir/user.css" + cp -R "$final_path/public/dist/uploads" "$tmpdir/uploads" + + # 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/user.css" "$final_path/public/dist/user.css" + cp -R "$final_path/uploads" "$final_path/public/dist/uploads" + + # Remove the tmp directory securely + ynh_secure_remove --file="$tmpdir" fi #================================================= @@ -128,9 +144,6 @@ ynh_backup_if_checksum_is_different --file="$final_path/.env" # Recalculate and store the checksum of the file for the next upgrade. ynh_store_file_checksum --file="$final_path/.env" -# Setup custom user.css file -cp ../conf/user.css.example $final_path/public/dist/user.css - #================================================= # SECURE FILES AND DIRECTORIES #=================================================