summaryrefslogtreecommitdiff
path: root/debian/postrm
blob: 7fd06f67c4f9867827e376cbbbe8d6ef04d1a4bc (plain)
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
#!/bin/sh
set -e

if [ "$1" = purge ]; then
	if [ -e /etc/.etckeeper ]; then
		. /usr/share/debconf/confmodule
	
		# uninit on purge is tricky because etckeeper's configuration
		# and code has been removed at this point. This relies on a
		# stashed away copy.
		if [ -e /var/cache/etckeeper/stash/etckeeper.conf ] &&
		   [ -d /var/cache/etckeeper/stash/uninit.d ] &&
		   [ -x /var/cache/etckeeper/stash/etckeeper ]; then
			. /var/cache/etckeeper/stash/etckeeper.conf
			if [ -n "$VCS" ]; then
				db_subst etckeeper/purge VCS "$VCS"
				db_input critical etckeeper/purge || true
				db_go || true
				db_get etckeeper/purge
				if [ "$RET" = true ]; then
					ETCKEEPER_CONF_DIR=/var/cache/etckeeper/stash
					export ETCKEEPER_CONF_DIR
					/var/cache/etckeeper/stash/etckeeper uninit -f || true
				fi
			fi
		fi
	fi
	rm -rf /var/cache/etckeeper
fi

#DEBHELPER#