From b2b803c50147146dc6eeeeb804296b3c07b52663 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Tue, 10 Jan 2023 23:43:23 +0100 Subject: [PATCH] upgrade: Fix when upgrading from /opt, we forgot to update the final_path variable and setting../.. --- scripts/upgrade | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 483e891..7b56df0 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -60,6 +60,17 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app #================================================= ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 +# Moved fron /opt to /var/www +if [ -d "/opt/yunohost/$app" ]; then + # Changing final_path... + final_path=/var/www/$app + ynh_app_setting_set --app="$app" --key=final_path --value="$final_path" + + # Moving old final_path to new final_path... + ynh_secure_remove "$final_path" + mv "/opt/yunohost/$app" "$final_path" +fi + #================================================= # CREATE DEDICATED USER #================================================= @@ -72,12 +83,6 @@ ynh_system_user_create --username=$app --home_dir="$final_path" # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= -# Moved fron /opt to /var/www -if [ -d "/opt/yunohost/$app" ]; then - ynh_secure_remove -f "$final_path" - mv "/opt/yunohost/$app" "$final_path" -fi - if [ "$upgrade_type" == "UPGRADE_APP" ] then ynh_script_progression --message="Upgrading source files..." --weight=1