Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 11 Nov 2013 02:13:48 +0000 (UTC)
From:      Devin Teske <dteske@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r257939 - head/usr.sbin/bsdinstall/scripts
Message-ID:  <201311110213.rAB2DmiA024355@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201311110213.rAB2DmiA024355>