don't suppress stderr of rmdir "$MNTPOINT"
[grml-debootstrap.git] / grml-debootstrap
index cff0116..f956978 100755 (executable)
@@ -257,7 +257,9 @@ cleanup() {
 
   # Remove temporary mountpoint again
   if echo "$MNTPOINT" | grep -q '/mnt/debootstrap\.' ; then
-    rmdir "$MNTPOINT" 2>/dev/null
+    if [ -d "$MNTPOINT" ] ; then
+      rmdir "$MNTPOINT"
+    fi
   fi
 
   # make sure $TARGET is not mounted when exiting grml-debootstrap
@@ -297,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