summaryrefslogtreecommitdiff
path: root/debian/postrm
diff options
context:
space:
mode:
authorJoey Hess <joey@gnu.kitenet.net>2009-05-06 14:40:02 -0400
committerJoey Hess <joey@gnu.kitenet.net>2009-05-06 14:47:56 -0400
commit61f7f5cf84c604062b8034deba436f2bddfa340e (patch)
tree641426c35ff6593a2db50dc4c65199564ce3433b /debian/postrm
parentc732475d89ae616de5ddd2b05190ae15ebce30ba (diff)
Uninit on purge, guarded by a debconf prompt. Closes: #527218
Diffstat (limited to 'debian/postrm')
-rw-r--r--debian/postrm31
1 files changed, 31 insertions, 0 deletions
diff --git a/debian/postrm b/debian/postrm
new file mode 100644
index 0000000..1dc53aa
--- /dev/null
+++ b/debian/postrm
@@ -0,0 +1,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 high 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#