From 08bcfe9dafb521e3f8e47bcffeb7e39f5b9a29d8 Mon Sep 17 00:00:00 2001 From: Tagada <36127788+Tagadda@users.noreply.github.com> Date: Tue, 13 Jun 2023 09:25:42 +0200 Subject: [PATCH] ynh_add_config keep config panel settings --- helpers/utils | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/helpers/utils b/helpers/utils index 52d7c734f..2e9c06f82 100644 --- a/helpers/utils +++ b/helpers/utils @@ -496,6 +496,11 @@ ynh_add_config() { ynh_die --message="The provided template $template doesn't exist" fi + # Backup variables handled by the config panel + local configpanel_backup_path + configpanel_backup_path="$(mktemp)" + yunohost app config get $app --export > "$configpanel_backup_path" + ynh_backup_if_checksum_is_different --file="$destination" # Make sure to set the permissions before we copy the file @@ -513,6 +518,12 @@ ynh_add_config() { ynh_replace_vars --file="$destination" ynh_store_file_checksum --file="$destination" + + # Restore variables handled by the config panel + yunohost app config set $app -f "$configpanel_backup_path" + ynh_secure_remove --file="$configpanel_backup_path" + ynh_store_file_checksum --file="$destination" + } # Replace variables in a file