X-Git-Url: https://git.grml.org/?p=grml-live.git;a=blobdiff_plain;f=etc%2Fgrml%2Ffai%2Fconfig%2Fscripts%2FDEBORPHAN%2F98-clean-chroot;h=68136eab3fd9c3b1a9ee32db33ac5ecc7dd39c91;hp=f5c1a942eb0e2b14416e564aa6de0d1d7859a51d;hb=f565065789c9c28146a9acd2efe5a5a1d2b0d2fb;hpb=649b40f7780079f8af4fcd7b12284a7d1d8cccfc diff --git a/etc/grml/fai/config/scripts/DEBORPHAN/98-clean-chroot b/etc/grml/fai/config/scripts/DEBORPHAN/98-clean-chroot index f5c1a94..68136ea 100755 --- a/etc/grml/fai/config/scripts/DEBORPHAN/98-clean-chroot +++ b/etc/grml/fai/config/scripts/DEBORPHAN/98-clean-chroot @@ -14,6 +14,12 @@ if ! [ -x $target/usr/bin/deborphan ] ; then exit 0 fi +# avoid file-rc being considered for removal by deborphan +if [ -d $target/usr/share/file-rc -a -x $target/usr/bin/deborphan ] ; then + echo "Adding file-rc to keep-list of deborphan to avoid accidental removal" + $ROOTCMD deborphan --add-keep file-rc || /bin/true +fi + # remove all packages not necessary anymore: $ROOTCMD apt-get -y --purge autoremove @@ -22,5 +28,14 @@ while [ "$($ROOTCMD deborphan)" != "" ] ; do $ROOTCMD apt-get -y --purge remove $($ROOTCMD deborphan) done +# 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 + $ROOTCMD dpkg --purge $PURGE_PACKAGES +fi + ## END OF FILE ################################################################# # vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=2