From 0595fdf24b7c4834c236f682ec2b2690cc612cb2 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Wed, 20 Jul 2022 00:39:03 +0200 Subject: [PATCH] fix upgrade --- scripts/_common.sh | 2 +- scripts/upgrade | 13 ++++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index f201f26..94f245b 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -98,7 +98,7 @@ function compile_server { ynh_secure_remove --file="$final_path/.cargo" ynh_secure_remove --file="$final_path/.rustup" - ynh_exec_as $app ln -sf "$final_path/assets" "$data_path/assets" + ynh_exec_as $app ln -sf "$final_path/live/assets" "$data_path/assets" set_permissions } diff --git a/scripts/upgrade b/scripts/upgrade index 451f522..2ca02b7 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -21,6 +21,7 @@ get_app_settings #================================================= # CHECK VERSION #================================================= +ynh_script_progression --message="Checking version..." upgrade_type=$(ynh_check_app_version_changed) @@ -30,7 +31,7 @@ upgrade_type=$(ynh_check_app_version_changed) ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=10 # Backup the current version of the app -ynh_backup_before_upgrade +#ynh_backup_before_upgrade ynh_clean_setup () { ynh_clean_check_starting # Restore it if the upgrade fails @@ -53,6 +54,16 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app #================================================= ynh_script_progression --message="Ensuring downward compatibility..." +if [ ! -d "$final_path/live" ] +then + tempdir=/opt/yunohost/$(ynh_string_random --length=8) + mkdir -p $tempdir + mv $final_path/ $tempdir/ + mkdir -p $final_path + mv $tempdir/$app $final_path/live/ + ynh_secure_remove --file="$tempdir" +fi + #================================================= # CREATE DEDICATED USER #=================================================