From d2be7fb21bfd1c28199ddc1959dfd3e15149acc8 Mon Sep 17 00:00:00 2001 From: Patrick Schleizer Date: Wed, 25 Oct 2023 12:02:14 -0400 Subject: [PATCH] fix `cleanup` function only delete `$MNTPOINT` if such a folder actually exists --- grml-debootstrap | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/grml-debootstrap b/grml-debootstrap index 2124614..08e6fe2 100755 --- a/grml-debootstrap +++ b/grml-debootstrap @@ -299,8 +299,10 @@ cleanup() { # remove directory only if we used the default with process id inside the name if echo "$MNTPOINT" | grep -q '/mnt/debootstrap\.' ; then - einfo "Removing directory ${MNTPOINT}" - rmdir "$MNTPOINT" || eend $? + if test -d "$MNTPOINT" ; then + einfo "Removing directory ${MNTPOINT}" + rmdir "$MNTPOINT" || eend $? + fi fi fi fi -- 2.1.4