the first `rmdir "$MNTPOINT"` needs `|| true`
[grml-debootstrap.git] / grml-debootstrap
index 5173dc1..bac28b0 100755 (executable)
@@ -258,7 +258,7 @@ cleanup() {
   # Remove temporary mountpoint again
   if echo "$MNTPOINT" | grep -q '/mnt/debootstrap\.' ; then
     if [ -d "$MNTPOINT" ] ; then
-      rmdir "$MNTPOINT"
+      rmdir "$MNTPOINT" || true
     fi
   fi
 
@@ -272,17 +272,17 @@ cleanup() {
         fi
       done
 
-      [ -x "$MNTPOINT"/bin/umount ] && chroot "$MNTPOINT" umount -a >/dev/null 2>&1
+      [ -x "$MNTPOINT"/bin/umount ] && chroot "$MNTPOINT" umount -a >/dev/null 2>&1 || true
 
       # ugly, but make sure we really don't leave anything (/proc /proc and
       # /dev /dev are intended, trying to work around timing issues, see #657023)
       for ARG in /run/udev /sys /proc /proc /dev/pts /dev/pts /dev /dev ; do
-        [ -x "$MNTPOINT"/bin/umount ] && chroot "$MNTPOINT" umount $ARG >/dev/null 2>&1
-        umount "$MNTPOINT"/$ARG >/dev/null 2>&1
+        [ -x "$MNTPOINT"/bin/umount ] && chroot "$MNTPOINT" umount $ARG >/dev/null 2>&1 || true
+        umount "$MNTPOINT"/$ARG >/dev/null 2>&1 || true
       done
 
       if [ -n "$ISODIR" ] ; then
-        [ -d "$MNTPOINT/$ISODIR" ] && umount "$MNTPOINT/$ISODIR" >/dev/null 2>&1
+        [ -d "$MNTPOINT/$ISODIR" ] && umount "$MNTPOINT/$ISODIR" >/dev/null 2>&1 || true
       fi
 
       if [ -n "$DIRECTORY" ] ; then