From 27891e4e8be3e42ca80950eb61298ebf013357ac Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 26 Dec 2020 19:38:35 +0100 Subject: [PATCH] Update upgrade --- scripts/upgrade | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/scripts/upgrade b/scripts/upgrade index 210ff0d..ad4ccf2 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -62,11 +62,23 @@ if [ "$upgrade_type" == "UPGRADE_APP" ] then ynh_script_progression --message="Upgrading source files..." --weight=5 + # Create a temporary directory + tmpdir="$(mktemp -d)" + + # Backup the config file in the temp dir + cp -R "$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 -RT "$tmpdir/data" "$final_path/data" + + # Remove the tmp directory securely + ynh_secure_remove --file="$tmpdir" fi #=================================================