summaryrefslogtreecommitdiff
path: root/debian/dselect.postrm
diff options
context:
space:
mode:
authorGuillem Jover <guillem@debian.org>2019-11-03 01:12:49 +0100
committerGuillem Jover <guillem@debian.org>2019-11-26 02:42:44 +0100
commitebbb81b5329f567f89ca576279bdeabafd291253 (patch)
tree1c9d4d4cdc4c0fb919c8b5c39b1dc215eeb69c30 /debian/dselect.postrm
parentb41fe887e8caf09107cd65d8f561b00d043561d9 (diff)
downloaddpkg-ebbb81b5329f567f89ca576279bdeabafd291253.tar.gz
dselect: Remove methods state files on purge
Ref: #930788 Spotted-by: Sven Joachim <svenjoac@gmx.de>
Diffstat (limited to 'debian/dselect.postrm')
-rwxr-xr-xdebian/dselect.postrm34
1 files changed, 34 insertions, 0 deletions
diff --git a/debian/dselect.postrm b/debian/dselect.postrm
new file mode 100755
index 000000000..7376dd672
--- /dev/null
+++ b/debian/dselect.postrm
@@ -0,0 +1,34 @@
+#!/bin/sh
+# See deb-postrm(5).
+
+set -e
+
+# Remove dselect methods state.
+purge_state() {
+ admindir=${DPKG_ADMINDIR:-/var/lib/dpkg}
+
+ rm -f $admindir/cmethopt 2>/dev/null
+ for method in disk ftp mnt multicd; do
+ rm -rf $admindir/methods/$method/* 2>/dev/null
+ done
+}
+
+case "$1" in
+remove)
+ ;;
+purge)
+ purge_state
+ ;;
+upgrade)
+ ;;
+failed-upgrade|disappear|abort-install|abort-upgrade)
+ ;;
+*)
+ echo "$0 called with unknown argument '$1'" 1>&2
+ exit 1
+ ;;
+esac
+
+#DEBHELPER#
+
+exit 0