Fix -t option when not using a device
authorMichael Prokop <mika@grml.org>
Tue, 7 Jul 2009 23:40:09 +0000 (01:40 +0200)
committerMichael Prokop <mika@grml.org>
Tue, 7 Jul 2009 23:40:09 +0000 (01:40 +0200)
debian/changelog
grml-debootstrap

index ab80461..9fe3101 100644 (file)
@@ -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 <mika@grml.org>  Wed, 08 Jul 2009 01:20:00 +0200
+ -- Michael Prokop <mika@grml.org>  Wed, 08 Jul 2009 01:37:57 +0200
 
 grml-debootstrap (0.28) unstable; urgency=low
 
index 23cf187..02015ce 100755 (executable)
@@ -39,7 +39,7 @@ Bootstrap options:
   -m, --mirror <URL>     Mirror which should be used for apt-get/aptitude.
   -i, --iso <mnt>        Mountpoint where a Debian ISO is mounted to, for use
                            instead of fetching packages from a mirror.
-  -r, --release <name>   Release of new Debian system (default: stable).
+  -r, --release <name>   Release of new Debian system (default: lenny).
   -t, --target <target>  Target partition (/dev/...) or directory.
   -p, --mntpoint <mnt>   Mountpoint used for mounting the target system.
       --debopt <params>  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"