summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Baumann <mail@daniel-baumann.ch>2016-07-25 10:26:47 +0000
committerDaniel Baumann <mail@daniel-baumann.ch>2016-07-25 11:11:15 +0000
commitcae7474ee8e0c969ef4df5ef1a473f328916e743 (patch)
tree4fd1052e6de9340120343dd1ce429a0e3a667f95
parentReleasing debian version 20160701-1. (diff)
downloadopen-infrastructure-compute-tools-cae7474ee8e0c969ef4df5ef1a473f328916e743.tar.xz
open-infrastructure-compute-tools-cae7474ee8e0c969ef4df5ef1a473f328916e743.zip
Adding postrm script to remove empty directories and symlinks on package removal (Closes: #832346).
Signed-off-by: Daniel Baumann <mail@daniel-baumann.ch>
-rw-r--r--debian/open-infrastructure-container-tools.postrm48
1 files changed, 48 insertions, 0 deletions
diff --git a/debian/open-infrastructure-container-tools.postrm b/debian/open-infrastructure-container-tools.postrm
new file mode 100644
index 0000000..848286f
--- /dev/null
+++ b/debian/open-infrastructure-container-tools.postrm
@@ -0,0 +1,48 @@
+#!/bin/sh
+
+set -e
+
+Remove ()
+{
+ DEFAULT="${1}"
+
+ if [ -h "${DEFAULT}" ]
+ then
+ TARGET="$(readlink -f ${DEFAULT})"
+ else
+ TARGET=""
+ fi
+
+ for ITEM in ${DEFAULT} ${TARGET}
+ do
+ if dpkg-statoverride --list "${ITEM}" > /dev/null 2>&1
+ then
+ dpkg-statoverride --quiet --remove "${ITEM}"
+ fi
+
+ rm -f ${ITEM} > /dev/null 2>&1 || true
+ rmdir --ignore-fail-on-non-empty --parents ${ITEM} > /dev/null 2>&1 || true
+ done
+}
+
+case "${1}" in
+ remove|purge)
+ Remove "/var/lib/machines"
+ Remove "/etc/container-tools/config"
+ Remove "/etc/container-tools/debconf"
+ Remove "/var/cache/container-tools"
+ ;;
+
+ upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
+
+ ;;
+
+ *)
+ echo "postrm called with unknown argument \`$1'" >&2
+ exit 1
+ ;;
+esac
+
+#DEBHELPER#
+
+exit 0