Author: dteske
Date: Mon Nov 11 02:13:47 2013
New Revision: 257939
URL: http://svnweb.freebsd.org/changeset/base/257939

Log:
  Check the partition scheme before blowing away disks, instead of after.
  The effects of this patch would only be noticeable if you were purposefully
  setting a bad value and trying to see what happens; and leaving the disks
  intact if a bad value has been set seems fair.

Modified:
  head/usr.sbin/bsdinstall/scripts/zfsboot

Modified: head/usr.sbin/bsdinstall/scripts/zfsboot
==============================================================================
--- head/usr.sbin/bsdinstall/scripts/zfsboot    Mon Nov 11 02:02:05 2013        
(r257938)
+++ head/usr.sbin/bsdinstall/scripts/zfsboot    Mon Nov 11 02:13:47 2013        
(r257939)
@@ -645,6 +645,18 @@ zfs_create_diskpart()
        fi
        f_dprintf "$funcname: disk=[%s] index=[%s]" "$disk" "$index"
 
+       # Check for unknown partition scheme before proceeding further
+       case "$ZFSBOOT_PARTITION_SCHEME" in
+       ""|MBR|GPT) : known good ;;
+       *)
+               f_dprintf "$funcname: %s is an unsupported partition scheme" \
+                         "$ZFSBOOT_PARTITION_SCHEME"
+               msg_error="$msg_error: $funcname" f_show_err \
+                       "$msg_unsupported_partition_scheme" \
+                       "$ZFSBOOT_PARTITION_SCHEME"
+               return $FAILURE
+       esac
+
        #
        # Destroy whatever partition layout is currently on disk.
        # NOTE: `-F' required to destroy if partitions still exist.
@@ -824,14 +836,6 @@ zfs_create_diskpart()
                fi
                ;;
 
-       *)
-               f_dprintf "$funcname: %s is an unsupported partition scheme" \
-                         "$ZFSBOOT_PARTITION_SCHEME"
-               msg_error="$msg_error: $funcname" f_show_err \
-                       "$msg_unsupported_partition_scheme" \
-                       "$ZFSBOOT_PARTITION_SCHEME"
-               return $FAILURE
-
        esac # $ZFSBOOT_PARTITION_SCHEME
 
        return $SUCCESS
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "[email protected]"

Reply via email to