From 850523975a3e3de2677dcdb5939ba903a9dc51d5 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Tue, 8 Jun 2021 22:09:26 +0200 Subject: [PATCH] Update upgrade --- scripts/upgrade | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 40692c8..ef810a6 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -19,8 +19,6 @@ app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get --app=$app --key=domain) path_url=$(ynh_app_setting_get --app=$app --key=path) final_path=$(ynh_app_setting_get --app=$app --key=final_path) -language=$(ynh_app_setting_get --app=$app --key=language) -title=$(ynh_app_setting_get --app=$app --key=title) #================================================= # CHECK VERSION @@ -58,8 +56,20 @@ if [ "$upgrade_type" == "UPGRADE_APP" ] then ynh_script_progression --message="Upgrading source files..." --weight=1 + # Create a temporary directory + tmpdir="$(mktemp -d)" + cp -a "$final_path/configuration.ini" "$tmpdir/configuration.ini" + cp -a "$final_path/pages/*" "$tmpdir/pages/" + + ynh_secure_remove --file="$final_path" #Download, check integrity, uncompress and patch the source from app.src - ynh_setup_source --dest_dir="$final_path" + ynh_setup_source --dest_dir="$final_path" #--keep="$final_path/configuration.ini" + + # Copy the admin saved settings from tmp directory to final config path + cp -a "$tmpdir/configuration.ini" "$final_path/configuration.ini" + cp -a "$tmpdir/pages/*" "$final_path/pages/" + # Remove the tmp directory securely + ynh_secure_remove --file="$tmpdir" fi chmod 750 "$final_path" @@ -74,16 +84,6 @@ ynh_script_progression --message="Upgrading NGINX web server configuration..." - # Create a dedicated NGINX config ynh_add_nginx_config -#================================================= -# ADD A CONFIGURATION -#================================================= -ynh_script_progression --message="Adding a configuration file..." --weight=1 - -ynh_add_config --template="../conf/configuration.ini" --destination="$final_path/configuration.ini" - -chmod 400 "$final_path/configuration.ini" -chown $app "$final_path/configuration.ini" - #================================================= # PHP-FPM CONFIGURATION #=================================================