+# make sure we don't have any removed but not-yet-purged packages left,
+# otherwise GRMLBASE/03-get-sources might try to download unavailable
+# packages and will fail doing so
+PURGE_PACKAGES=$($ROOTCMD dpkg --list | awk '/^rc/ {print $2}')
+
+if [ -n "$PURGE_PACKAGES" ] ; then
+ echo "Getting rid of packages which have been removed but not yet purged: $PURGE_PACKAGES"
+ $ROOTCMD dpkg --purge $PURGE_PACKAGES
+fi
+