From: Michael Prokop Date: Tue, 7 Jul 2009 23:40:09 +0000 (+0200) Subject: Fix -t option when not using a device X-Git-Tag: v0.29~13 X-Git-Url: https://git.grml.org/?p=grml-debootstrap.git;a=commitdiff_plain;h=444d8dfca8c5fe66bad93e8e74d7d2eb4777712e Fix -t option when not using a device --- diff --git a/debian/changelog b/debian/changelog index ab80461..9fe3101 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,8 +2,12 @@ grml-debootstrap (0.29) UNRELEASED; urgency=low * Install busybox in kernel stage to be able to debug initramfs problems (thanks, gebi). + * Check whether we are installing into a directory in stage mkfs + so we don't skip if the target is already mounted. + * Mention "default: lenny" instead of "default: stable" in help + text as "stable" is invalid. Thanks, gebi. - -- Michael Prokop Wed, 08 Jul 2009 01:20:00 +0200 + -- Michael Prokop Wed, 08 Jul 2009 01:37:57 +0200 grml-debootstrap (0.28) unstable; urgency=low diff --git a/grml-debootstrap b/grml-debootstrap index 23cf187..02015ce 100755 --- a/grml-debootstrap +++ b/grml-debootstrap @@ -39,7 +39,7 @@ Bootstrap options: -m, --mirror Mirror which should be used for apt-get/aptitude. -i, --iso Mountpoint where a Debian ISO is mounted to, for use instead of fetching packages from a mirror. - -r, --release Release of new Debian system (default: stable). + -r, --release Release of new Debian system (default: lenny). -t, --target Target partition (/dev/...) or directory. -p, --mntpoint Mountpoint used for mounting the target system. --debopt Extra parameters passed to the debootstrap command. @@ -637,7 +637,12 @@ bailout(){ [ -x "$MNTPOINT"/bin/umount ] && chroot "$MNTPOINT" umount /proc 1>/dev/null 2>&1 [ -x "$MNTPOINT"/bin/umount ] && chroot "$MNTPOINT" umount /proc 1>/dev/null 2>&1 [ -d "$MNTPOINT/$ISODIR" ] && umount "$MNTPOINT/$ISODIR" 1>/dev/null 2>&1 - einfo "Unmounting $MNTPOINT" ; umount "$MNTPOINT" ; eend $? + + if [ -n "$DIRECTORY" ] ; then + einfo "Not unmounting $MNTPOINT as you requested me to install into a directory of your own choice." ; eend 0 + else + einfo "Unmounting $MNTPOINT" ; umount "$MNTPOINT" ; eend $? + fi if [ -n "$STAGES" ] ; then echo -n "Removing stages directory ${STAGES}: " @@ -675,16 +680,21 @@ stage() { # create filesystem {{{ mkfs() { - if grep -q $TARGET /proc/mounts ; then - eerror "$TARGET already mounted, exiting to avoid possible damage. (Manually unmount $TARGET)" ; eend 1 - exit 1 - fi + if [ -n "$DIRECTORY" ] ; then + einfo "Running grml-debootstrap on a directory, skipping mkfs stage." + else + if grep -q "$TARGET" /proc/mounts ; then + eerror "$TARGET already mounted, exiting to avoid possible damage. (Manually unmount $TARGET)" ; eend 1 + exit 1 + fi + + if [ -n "$MKFS" ] ; then + einfo "Running $MKFS on $TARGET" + $MKFS $TARGET + TARGET_UUID="$(vol_id -u $TARGET 2>/dev/null || echo '')" + eend $? + fi - if [ -n "$MKFS" ] ; then - einfo "Running $MKFS on $TARGET" - $MKFS $TARGET - TARGET_UUID="$(vol_id -u $TARGET 2>/dev/null || echo '')" - eend $? fi } # }}} @@ -897,6 +907,7 @@ umount_chroot() { eend $? fi fi + if grep -q "$MNTPOINT" /proc/mounts ; then if [ -n "$PARTITION" ] ; then einfo "Unmount $MNTPOINT"