ignore exit codes of umount during cleanup function
authorPatrick Schleizer <adrelanos@whonix.org>
Thu, 26 Oct 2023 17:42:08 +0000 (13:42 -0400)
committerPatrick Schleizer <adrelanos@whonix.org>
Thu, 7 Dec 2023 18:51:56 +0000 (13:51 -0500)
because the cleanup function gets run by the error handler and should
not be nested

grml-debootstrap

index 5173dc1..29ae03f 100755 (executable)
@@ -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