DEBORPHAN/98-clean-chroot: Make sure deborphan exists in chroot.
authorMichael Prokop <mika@grml.org>
Tue, 28 Jun 2011 09:49:36 +0000 (11:49 +0200)
committerMichael Prokop <mika@grml.org>
Tue, 28 Jun 2011 09:49:36 +0000 (11:49 +0200)
etc/grml/fai/config/scripts/DEBORPHAN/98-clean-chroot

index a5515f0..f5c1a94 100755 (executable)
@@ -9,12 +9,17 @@
 set -u
 set -e
 
+if ! [ -x $target/usr/bin/deborphan ] ; then
+  echo "Warning: deborphan not installed"
+  exit 0
+fi
+
 # remove all packages not necessary anymore:
 $ROOTCMD apt-get -y --purge autoremove
 
 # remove packages until deborphan does not find anymore:
 while [ "$($ROOTCMD deborphan)" != "" ] ; do
-  $ROOTCMD apt-get -y --purge remove $(deborphan)
+  $ROOTCMD apt-get -y --purge remove $($ROOTCMD deborphan)
 done
 
 ## END OF FILE #################################################################