From: Patrick Schleizer Date: Thu, 26 Oct 2023 17:42:08 +0000 (-0400) Subject: ignore exit codes of umount during cleanup function X-Git-Tag: v0.106~7^2~8 X-Git-Url: https://git.grml.org/?p=grml-debootstrap.git;a=commitdiff_plain;h=d39c8dfd5a06ae1ce0edb31600e8ed7da2ac02dd ignore exit codes of umount during cleanup function because the cleanup function gets run by the error handler and should not be nested --- diff --git a/grml-debootstrap b/grml-debootstrap index 5173dc1..29ae03f 100755 --- a/grml-debootstrap +++ b/grml-debootstrap @@ -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