diff options
author | dteske <dteske@FreeBSD.org> | 2013-11-11 02:13:47 +0000 |
---|---|---|
committer | dteske <dteske@FreeBSD.org> | 2013-11-11 02:13:47 +0000 |
commit | ff748f24da84217db463415c751ee2dcb9f8b1a6 (patch) | |
tree | d6b1665b23fed0633dc4cdac57b15bc8c45f61b8 /usr.sbin | |
parent | 34ec6f44ca7b8b0c7a210761b9e368ea011ec059 (diff) | |
download | FreeBSD-src-ff748f24da84217db463415c751ee2dcb9f8b1a6.zip FreeBSD-src-ff748f24da84217db463415c751ee2dcb9f8b1a6.tar.gz |
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.
Diffstat (limited to 'usr.sbin')
-rwxr-xr-x | usr.sbin/bsdinstall/scripts/zfsboot | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/usr.sbin/bsdinstall/scripts/zfsboot b/usr.sbin/bsdinstall/scripts/zfsboot index 938d80c..149be3b 100755 --- a/usr.sbin/bsdinstall/scripts/zfsboot +++ b/usr.sbin/bsdinstall/scripts/zfsboot @@ -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 |