File: logcheck.preinst

package info (click to toggle)
logcheck 1.4.7
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,648 kB
  • sloc: sh: 1,143; perl: 274; makefile: 78
file content (30 lines) | stat: -rw-r--r-- 1,370 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/sh
set -e

# whole file can be removed once trixie is stable (see also postinst)
if [ "$1" = "install" ] || [ "$1" = "upgrade" ]; then
	# preserve deletion of /etc/logcheck/header.txt if upgrading from <= 1.4.1 --- see #1049412
	if [ "$1" = "upgrade" ] && [ ! -f /etc/logcheck/header.txt ] && dpkg --compare-versions "$2" le-nl 1.4.1; then
		echo "You deleted /etc/logcheck/header.txt before bookworm: this deletion will be preserved. However, it would be better to set INTRO=0 in /etc/logcheck.conf instead."
		touch /etc/logcheck/header.txt.was-deleted-before-bookworm || :
	fi

	if dpkg --compare-versions "$2" lt-nl "1.4.3~" ; then
		# Update /etc/logcheck/header.txt if it matches a known
		# shipped version (woody to jessie) - see #1039591
		# (this can be removed once trixie is stable)
		if [ -f "/etc/logcheck/header.txt" ] && [ -f "/usr/share/logcheck/header.txt" ]; then
			# 1bc54d3bfb0d1e61104d5780a318ced2 (woody)
			# dbc1e8d136180d247b572f6a19c4e92e (lenny)
			# a32fc12d69628d96756fd3af3f8b3ecd (squeeze, wheezy, jessie)
			md5=$(md5sum "/etc/logcheck/header.txt" | awk '{print $1}')
			if [ "$md5" = "dbc1e8d136180d247b572f6a19c4e92e" ] ||
				 [ "$md5" = "a32fc12d69628d96756fd3af3f8b3ecd" ] ||
				 [ "$md5" = "1bc54d3bfb0d1e61104d5780a318ced2" ]; then
				cp -p -v /usr/share/logcheck/header.txt /etc/logcheck
			fi
		fi
	fi
fi

#DEBHELPER#