check for mounted target in mkfs() step already instead of mount_target()
authorMichael Prokop <mika@grml.org>
Fri, 8 May 2009 13:43:58 +0000 (15:43 +0200)
committerMichael Prokop <mika@grml.org>
Fri, 8 May 2009 13:43:58 +0000 (15:43 +0200)
debian/changelog
grml-debootstrap

index 302e64b..4accc0a 100644 (file)
@@ -13,11 +13,12 @@ grml-debootstrap (0.27) unstable; urgency=low
     - Drop 'do not prompt for partition dialog if swraid has been
       configured already' which doesn't make any sense in most situations
   * Minor changes:
     - Drop 'do not prompt for partition dialog if swraid has been
       configured already' which doesn't make any sense in most situations
   * Minor changes:
+    - check for mounted target in mkfs() step already instead of mount_target()
     - use '.. to the debootstrap command' in description of --debopt
   * Debian Package:
     - bump Standard Version to 3.8.1 (no further changes).
 
     - use '.. to the debootstrap command' in description of --debopt
   * Debian Package:
     - bump Standard Version to 3.8.1 (no further changes).
 
- -- Michael Prokop <mika@grml.org>  Fri, 08 May 2009 15:37:58 +0200
+ -- Michael Prokop <mika@grml.org>  Fri, 08 May 2009 15:43:02 +0200
 
 grml-debootstrap (0.26) unstable; urgency=low
 
 
 grml-debootstrap (0.26) unstable; urgency=low
 
index 46d2526..b11ee7c 100755 (executable)
@@ -675,6 +675,11 @@ stage() {
 
 # create filesystem {{{
 mkfs() {
 
 # 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 "$MKFS" ] ; then
      einfo "Running $MKFS on $TARGET"
      $MKFS $TARGET
   if [ -n "$MKFS" ] ; then
      einfo "Running $MKFS on $TARGET"
      $MKFS $TARGET
@@ -700,7 +705,7 @@ mount_target() {
      einfo "Running grml-debootstrap on a directory, nothing to mount."
   else
      if grep -q $TARGET /proc/mounts ; then
      einfo "Running grml-debootstrap on a directory, nothing to mount."
   else
      if grep -q $TARGET /proc/mounts ; then
-        eerror "$TARGET already mounted, exiting."
+        ewarn "$TARGET already mounted, continuing anyway." ; eend 0
      else
        [ -d "$MNTPOINT" ] || mkdir -p "$MNTPOINT"
        einfo "Mounting $TARGET to $MNTPOINT"
      else
        [ -d "$MNTPOINT" ] || mkdir -p "$MNTPOINT"
        einfo "Mounting $TARGET to $MNTPOINT"