From 3e3a1d5bf55c9ce40c59040e2001308e62eec705 Mon Sep 17 00:00:00 2001 From: tituspijean Date: Wed, 1 May 2024 09:25:24 +0200 Subject: [PATCH] Fix packaging v2 migration --- manifest.toml | 1 - scripts/upgrade | 9 +++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/manifest.toml b/manifest.toml index 55aa865..065b9bf 100644 --- a/manifest.toml +++ b/manifest.toml @@ -57,7 +57,6 @@ ram.runtime = "50M" [resources.install_dir] [resources.data_dir] - dir = "/var/lib/__APP__" [resources.ports] diff --git a/scripts/upgrade b/scripts/upgrade index 9950335..1e9125e 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -23,6 +23,15 @@ ynh_systemd_action --service_name="$app" --action="stop" --log_path="systemd" #================================================= ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 +# Fixes specific to packaging v2 migration +if ynh_compare_current_package_version --comparison le --version 3.0.6.1196~ynh3 +then + # In packaging v1, final_path=/var/lib/$app but actually held the data. No data_dir was defined + # Upon migration, the core moves /var/lib/$app to /var/www/$app, so let's move it to the data_dir + ynh_print_warn --message="Fix manivest v2 migration: moving contents of $install_dir to $data_dir... (this may take a while)" + mv $install_dir/* $data_dir +fi + if [ ! -L "$data_dir/logs" ]; then ynh_secure_remove --file="$data_dir/logs" ln -s "/var/log/$app" "$data_dir/logs"