2 # Filename: ${GRML_FAI_CONFIG}/config/scripts/DEBORPHAN/98-clean-chroot
3 # Purpose: drop as many packages from grml as possible
4 # Authors: (c) Michael Prokop <mika@grml.org>
5 # Bug-Reports: see http://grml.org/bugs/
6 # License: This file is licensed under the GPL v2.
7 ################################################################################
12 if ! [ -x $target/usr/bin/deborphan ] ; then
13 echo "Warning: deborphan not installed"
17 # remove all packages not necessary anymore:
18 echo "Executing apt-get -y --purge autoremove"
19 $ROOTCMD apt-get -y --purge autoremove
21 # remove packages until deborphan does not find anymore:
22 while [ "$($ROOTCMD deborphan)" != "" ] ; do
23 echo "Executing deborphan"
24 $ROOTCMD apt-get -y --purge remove $($ROOTCMD deborphan)
27 # make sure we don't have any removed but not-yet-purged packages left,
28 # otherwise GRMLBASE/03-get-sources might try to download unavailable
29 # packages and will fail doing so
30 PURGE_PACKAGES=$($ROOTCMD dpkg --list | awk '/^rc/ {print $2}')
32 if [ -n "$PURGE_PACKAGES" ] ; then
33 echo "Getting rid of packages which have been removed but not yet purged: $PURGE_PACKAGES"
34 $ROOTCMD dpkg --purge $PURGE_PACKAGES
37 ## END OF FILE #################################################################
38 # vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=2