From 3efe9674b9290cf10ce188ae1725a3ebc7fc3367 Mon Sep 17 00:00:00 2001 From: Michael Prokop Date: Mon, 16 Apr 2007 13:28:20 +0200 Subject: [PATCH 1/1] Improve error handling inside debootstrap_system() --- grml-debootstrap | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) 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 } # }}} -- 2.1.4