summaryrefslogtreecommitdiffstats
path: root/share/scripts/debconf
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@open-infrastructure.net>2017-04-05 17:30:22 +0000
committerDaniel Baumann <daniel.baumann@open-infrastructure.net>2017-05-09 14:32:11 +0000
commit8aa267f713030a669b5d891ee0bfabd7c5d60fd6 (patch)
tree5c30194607c1bd38328e6b23d27eaca0b2a8d6f7 /share/scripts/debconf
parentPurging packages when autoremoving them. (diff)
downloadcompute-tools-8aa267f713030a669b5d891ee0bfabd7c5d60fd6.tar.xz
compute-tools-8aa267f713030a669b5d891ee0bfabd7c5d60fd6.zip
Purging packages that got removed/replaced during container creation.
Signed-off-by: Daniel Baumann <daniel.baumann@open-infrastructure.net>
Diffstat (limited to 'share/scripts/debconf')
-rwxr-xr-xshare/scripts/debconf10
1 files changed, 10 insertions, 0 deletions
diff --git a/share/scripts/debconf b/share/scripts/debconf
index c90e851..dee4dcd 100755
--- a/share/scripts/debconf
+++ b/share/scripts/debconf
@@ -187,6 +187,16 @@ Cleanup_system ()
Chroot "${DIRECTORY}" "apt-get --yes --purge autoremove"
Chroot "${DIRECTORY}" "apt-get clean"
+ CRUFT="$(Chroot "${DIRECTORY}" "dpkg --get-selections | awk '/deinstall$/ { print $1 }'")"
+
+ if [ -n "${CRUFT}" ]
+ then
+ for PACKAGE in ${CRUFT}
+ do
+ Chroot "${DIRECTORY}" "apt-get purge ${PACKAGE}"
+ done
+ fi
+
# Cleanup
rm -f "${DIRECTORY}/etc/dpkg/dpkg.cfg.d/container-tools"
rm -f "${DIRECTORY}/usr/sbin/policy-rc.d"