X-Git-Url: http://git.grml.org/?a=blobdiff_plain;f=grml-debootstrap;h=4758bce340e2d6ae15832c00eefe32b82768beae;hb=bee27f04aa76d4618788a41f15271fd7a3364910;hp=cff0116a0cdf4a9c6579f89cc32db9d6ef16563d;hpb=e0dc8d8a758b5a7ae2b3553391642c3dc603895f;p=grml-debootstrap.git diff --git a/grml-debootstrap b/grml-debootstrap index cff0116..4758bce 100755 --- a/grml-debootstrap +++ b/grml-debootstrap @@ -244,11 +244,11 @@ check4progs(){ # helper functions {{{ cleanup() { if [ -n "$CHROOT_VARIABLES" ] ; then - einfo "Removing ${CHROOT_VARIABLES}" ; rm "$CHROOT_VARIABLES" ; eend $? + einfo "Removing ${CHROOT_VARIABLES}" ; rm "$CHROOT_VARIABLES" || eend $? fi if [ -n "$STAGES" ] ; then - einfo "Removing ${STAGES}" ; rmdir "$STAGES" ; eend $? + einfo "Removing ${STAGES}" ; rmdir "$STAGES" || eend $? fi if [ -n "$ARM_EFI_TARGET" ]; then @@ -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