File: spampd.postinst

package info (click to toggle)
spampd 2.30-22.2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 224 kB
  • ctags: 80
  • sloc: perl: 557; sh: 272; makefile: 88
file content (56 lines) | stat: -rw-r--r-- 1,696 bytes parent folder | download | duplicates (4)
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/bash -e

handle_init_errs ()
{
	RET=$?
	if [ "$RET" = "6" ]; then
		return 0
	else
		exit $RET
	fi
	set -e
}

case "$1" in 
	install|configure)
		adduser --system --group \
		        --no-create-home --home /nonexistent \
			--quiet spampd 
		INSTOVERR=0
		dpkg --compare-versions "$2" lt 2.30-5 && INSTOVERR=1
		if echo $2 | grep -q bpo; then
			# special case backports.org versions
			dpkg-compare-versions "$2" gt 2.30-4 || INSTOVERR=1
		fi
		if [ "$INSTOVERR" = 1 ]; then
			dpkg-statoverride --update --add spampd spampd 775 /var/cache/spampd \
			|| echo "Warning: statoverride couldn't be created for /var/cache/spampd" >&2
			dpkg-statoverride --update --add root spampd 640 /etc/spampd.conf \
			|| echo "Warning: statoverride couldn't be created for /etc/spampd.conf" >&2
		fi
		;;
	abort-upgrade)
		# Aborting an upgrade, check wether it was actually a downgrade
		# which removed the stat overrides
		INSTOVERR=0
		echo "spampd.postinst: Aborting upgrade"
		dpkg --compare-versions "$2" lt 2.30-5 && INSTOVERR=1
		if echo $2 | grep -q bpo; then
			# special case backports.org versions
			echo "spampd.postinst: Special casing bpo version: $2"
			dpkg-compare-versions "$2" gt 2.30-4 || INSTOVERR=1
		fi
		if [ "$INSTOVERR" = 1 ]; then
			dpkg-statoverride --update --add spampd spampd 775 /var/cache/spampd \
			|| echo "Warning: statoverride couldn't be created for /var/cache/spampd" >&2
			dpkg-statoverride --update --add root spampd 640 /etc/spampd.conf \
			|| echo "Warning: statoverride couldn't be created for /etc/spampd.conf" >&2
		else
			echo "spampd.postinst: Not creating statoverrides on abort-upgrade. other version: $2"
		fi
		;;
	*)
		;;
esac

#DEBHELPER#