From 0589491e111b82ac14d1fae28dfe6f7c3bed9e0e Mon Sep 17 00:00:00 2001 From: Simon Mellerin Date: Sun, 7 Jan 2024 16:47:11 +0100 Subject: [PATCH] fix upgrade script --- scripts/upgrade | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index 85f73f9..12ccc5c 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -46,8 +46,22 @@ if [ "$upgrade_type" == "UPGRADE_APP" ] then ynh_script_progression --message="Upgrading source files..." + # For aeneria source update, we use a temporary directory because + # without it, patches can't be apply correctly: + # In 'app-00-ldap-auth.patch' we create a new file, if we try + # to apply the patch a second time while the file already exists, it + # throws a warning leading to an upgrade fail. + + # Create tmpdir for new sources + tmpdir="$(ynh_smart_mktemp min_size=300)" + # Download, check integrity, uncompress and patch the source from app.src - ynh_setup_source --dest_dir="$install_dir" --full_replace + ynh_setup_source --dest_dir="$tmpdir" + + # Replace the old aeneria by the new one + ynh_secure_remove --file="$install_dir" + mv "$tmpdir" "$install_dir" + ynh_secure_remove --file="$tmpdir" fi chown -R $app:www-data "$install_dir"