New version of the patch fixing a wrong checksum. Now logcheck upgrade paths starting from ancient releases look clean ;-)

Andreas
From a8cd5174cfef50fb344a17377ccc77e82ff4c9cd Mon Sep 17 00:00:00 2001
From: Andreas Beckmann <[email protected]>
Date: Tue, 27 Jun 2023 21:29:06 +0200
Subject: [PATCH] update ancient header.txt in preinst

---
 debian/changelog        |  8 ++++++++
 debian/logcheck.preinst | 21 +++++++++++++++++++++
 2 files changed, 29 insertions(+)
 create mode 100644 debian/logcheck.preinst

diff --git a/debian/changelog b/debian/changelog
index 3c46c56e..567896a7 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+logcheck (1.4.3) UNRELEASED; urgency=medium
+
+  * Add logcheck.preinst to upgrade header.txt if it matches a known shipped
+    version predating stretch to avoid dpkg complaining about a modified
+    conffile.  (Closes: #1039591)
+
+ -- Andreas Beckmann <[email protected]>  Tue, 27 Jun 2023 20:05:42 +0200
+
 logcheck (1.4.2) unstable; urgency=medium
 
   * More explicitly mention the default checking of the systemd journal
diff --git a/debian/logcheck.preinst b/debian/logcheck.preinst
new file mode 100644
index 00000000..263bfba3
--- /dev/null
+++ b/debian/logcheck.preinst
@@ -0,0 +1,21 @@
+#!/bin/sh
+set -e
+
+if [ "$1" = "install" ] || [ "$1" = "upgrade" ]; then
+	if dpkg --compare-versions "$2" lt-nl "1.4.3~" ; then
+		# Update /etc/logcheck/header.txt if it matches a known
+		# shipped version predating stretch to avoid dpkg
+		# complaining about a modified conffile
+		if [ -f "/etc/logcheck/header.txt" ] && [ -f "/usr/share/logcheck/header.txt" ]; then
+			# dbc1e8d136180d247b572f6a19c4e92e (lenny)
+			# a32fc12d69628d96756fd3af3f8b3ecd (squeeze, wheezy, jessie)
+			md5=$(md5sum "/etc/logcheck/header.txt" | awk '{print $1}')
+			if [ "$md5" = "dbc1e8d136180d247b572f6a19c4e92e" ] ||
+			   [ "$md5" = "a32fc12d69628d96756fd3af3f8b3ecd" ]; then
+				cp -p -v /usr/share/logcheck/header.txt /etc/logcheck
+			fi
+		fi
+	fi
+fi
+
+#DEBHELPER#
-- 
2.20.1

Reply via email to