From 8aa267f713030a669b5d891ee0bfabd7c5d60fd6 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 5 Apr 2017 19:30:22 +0200 Subject: Purging packages that got removed/replaced during container creation. Signed-off-by: Daniel Baumann --- share/scripts/debconf | 10 ++++++++++ 1 file changed, 10 insertions(+) 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" -- cgit v1.2.3