From 8b32d0d4a84804222070b25246ef0f4c592e74bd Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Mon, 22 Nov 2021 22:51:12 +0100 Subject: [PATCH] Update upgrade --- scripts/upgrade | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index 0ffffa9..bf271b8 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -83,8 +83,20 @@ if [ "$upgrade_type" == "UPGRADE_APP" ] then ynh_script_progression --message="Upgrading source files..." --weight=3 + # Create a temporary directory + tmpdir="$(mktemp -d)" + + # Backup the config file in the temp dir + cp -a "$final_path/searx/settings.yml" "$tmpdir/settings.yml" + # Download, check integrity, uncompress and patch the source from app.src - ynh_setup_source --dest_dir="$final_path" --keep="$final_path/searx/settings.yml" + ynh_setup_source --dest_dir="$final_path" + + # Copy the admin saved settings from tmp directory to final path + cp -a "$tmpdir/settings.yml" "$final_path/searx/settings.yml" + + # Remove the tmp directory securely + ynh_secure_remove --file="$tmpdir" fi #=================================================