From 6bc45775a06fc77aea95a15c294e2da6d593476a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Mon, 16 Oct 2023 18:29:45 +0200 Subject: [PATCH] Installation of deb packages will overwrite the configuration files, so to prevent a warning we backup those files beforehand. --- scripts/upgrade | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/scripts/upgrade b/scripts/upgrade index e268d2d..3edf134 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -86,6 +86,12 @@ ynh_app_setting_set --app=$app --key=discovery_client --value=$discovery_client #================================================= ynh_script_progression --message="Upgrading packages..." --weight=3 +# Backup the configuration files to prevent yunohost to see a manual edit +bakdir=$(mktemp -d) +for name in system.xml network.xml logging.json; do + cp "$config_path/$name" "$bakdir/$name" +done + # ynh_package_install passes --no-remove so the ffmpeg5 -> ffmpeg6 migration is blocked. # So we remove the packages before installing the new ones. if ynh_package_is_installed "jellyfin-ffmpeg5"; then @@ -111,6 +117,12 @@ ynh_add_nginx_config #================================================= ynh_script_progression --message="Updating a configuration file..." --weight=2 +# Restore the files we just backed up before installing the debs... +for name in system.xml network.xml logging.json; do + mv -f "$bakdir/$name" "$config_path/$name" +done +ynh_secure_remove "$bakdir" + # TODO: investigate if we can avoid overriding system.xml #ynh_add_config --template="system.xml" --destination="$config_path/system.xml" ynh_add_config --template="network.xml" --destination="$config_path/network.xml"