From 35900c94eb293696c8617722a80deacfbd914ae5 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 19 Jun 2021 23:10:54 +0200 Subject: [PATCH] Update upgrade --- scripts/upgrade | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index 13aa578..54c58f0 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -80,8 +80,22 @@ if [ "$upgrade_type" == "UPGRADE_APP" ] then ynh_script_progression --message="Upgrading source files..." --weight=1 + # Create a temporary directory + tmpdir="$(mktemp -d)" + + # Backup the config file in the temp dir + cp -a "$final_path/config.json" "$tmpdir/config.json" + + # 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" --keep="$final_path/config.json" + ynh_setup_source --dest_dir="$final_path" #--keep="$final_path/config.json" + # Copy the admin saved settings from tmp directory to final path + cp -a "$tmpdir/config.json" "$final_path/config.json" + + # Remove the tmp directory securely + ynh_secure_remove --file="$tmpdir" fi chmod 750 "$final_path"