From: Michael Prokop Date: Mon, 16 Apr 2007 11:28:20 +0000 (+0200) Subject: Improve error handling inside debootstrap_system() X-Git-Tag: 0.7~30 X-Git-Url: https://git.grml.org/?p=grml-debootstrap.git;a=commitdiff_plain;h=3efe9674b9290cf10ce188ae1725a3ebc7fc3367 Improve error handling inside debootstrap_system() --- diff --git a/grml-debootstrap b/grml-debootstrap index 9b0574c..7a14e5f 100644 --- a/grml-debootstrap +++ b/grml-debootstrap @@ -117,7 +117,7 @@ bailout(){ [ -x "$MNTPOINT"/etc/init.d/mdadm ] && "$MNTPOINT"/etc/init.d/mdadm stop [ -x "$MNTPOINT"/bin/umount ] && chroot "$MNTPOINT" umount /sys [ -x "$MNTPOINT"/bin/umount ] && chroot "$MNTPOINT" umount /proc - echo "Unmounting $MNTPOINT" ; umount "$MNTPOINT" + einfo "Unmounting $MNTPOINT" ; umount "$MNTPOINT" ; eend $? fi fi [ -n "$1" ] && EXIT="$1" || EXIT="1" @@ -195,9 +195,17 @@ mount_target() { # install main chroot {{{ debootstrap_system() { - einfo "Running $DEBOOTSTRAP for release ${RELEASE}${ARCHINFO} using mirror $MIRROR" - $DEBOOTSTRAP $ARCHCMD $RELEASE $MNTPOINT $MIRROR - eend $? + if ! grep -q $MNTPOINT /proc/mounts ; then + mount_target + fi + if grep -q $MNTPOINT /proc/mounts ; then + einfo "Running $DEBOOTSTRAP for release ${RELEASE}${ARCHINFO} using mirror $MIRROR" + $DEBOOTSTRAP $ARCHCMD $RELEASE $MNTPOINT $MIRROR + eend $? + else + eerror "Error: $MNTPOINT not mounted, can not continue." + eend 1 + fi } # }}}