From 43074757733712180431903a8b79767910bd6d7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Hertzog?= Date: Tue, 3 Dec 2019 14:58:45 +0100 Subject: [PATCH] Avoid conffiles prompts for newly diverted files during upgrades --- debian/kali-themes.preinst | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/debian/kali-themes.preinst b/debian/kali-themes.preinst index 38505e99..7c652f02 100644 --- a/debian/kali-themes.preinst +++ b/debian/kali-themes.preinst @@ -19,7 +19,15 @@ FILES_TO_DIVERT=" setup_diversion() { local file="$1" - dpkg-divert --rename --package kali-themes \ + divert_opts="--rename" + if [ -e "$file" ]; then + if dpkg --search "$file" >/dev/null 2>&1; then + # Keep original file to avoid spurious dpkg prompt + cp "$file" "$file.original" + divert_opts="--no-rename" + fi + fi + dpkg-divert $divert_opts --package kali-themes \ --divert "$file.original" \ --add "$file" }