svn commit: r266555 - head/usr.sbin/bsdinstall/scripts

Devin Teske dteske at FreeBSD.org
Thu May 22 19:36:30 UTC 2014


Author: dteske
Date: Thu May 22 19:36:29 2014
New Revision: 266555
URL: http://svnweb.freebsd.org/changeset/base/266555

Log:
  Fix syntax error thrown at the point of creating the root pool, caused by
  an embedded newline appearing within the options string surrounded by
  double-quotes. Rework the logic that goes into setting dataset options on
  the root pool dataset while we're here -- added two new variables (which
  can be altered via scripting) ZFSBOOT_POOL_CREATE_OPTIONS and also
  ZFSBOOT_BOOT_POOL_CREATE_OPTIONS for setting pool/dataset attributes at
  the time of pool creation. The former is for setting options on the root
  pool (zroot) and the latter is for setting options on the optional separate
  boot pool (bootpool) implicitly enabled when using either GELI or MBR. The
  default value for the root pool variable (ZFSBOOT_POOL_CREATE_OPTIONS) is
  "-O compress=lz4 -O atime=off" and the default value for separate boot pool
  variable (ZFSBOOT_BOOT_POOL_CREATE_OPTIONS) is NULL (no additional options
  for the separate boot pool dataset).
  
  Reviewed by:	allanjude
  MFC after:	7 days
  X-MFC-with:	r266107-266109

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

Modified: head/usr.sbin/bsdinstall/scripts/zfsboot
==============================================================================
--- head/usr.sbin/bsdinstall/scripts/zfsboot	Thu May 22 19:25:41 2014	(r266554)
+++ head/usr.sbin/bsdinstall/scripts/zfsboot	Thu May 22 19:36:29 2014	(r266555)
@@ -45,6 +45,11 @@ f_include $BSDCFG_SHARE/variable.subr
 : ${ZFSBOOT_POOL_NAME:=zroot}
 
 #
+# Default options to use when creating zroot pool
+#
+: ${ZFSBOOT_POOL_CREATE_OPTIONS:=-O compress=lz4 -O atime=off}
+
+#
 # Default name for the boot environment parent dataset
 #
 : ${ZFSBOOT_BEROOT_NAME:=ROOT}
@@ -82,6 +87,11 @@ f_include $BSDCFG_SHARE/variable.subr
 : ${ZFSBOOT_BOOT_POOL=}
 
 #
+# Options to use when creating separate boot pool (if any)
+#
+: ${ZFSBOOT_BOOT_POOL_CREATE_OPTIONS:=}
+
+#
 # Default name for boot pool when enabled (e.g., geli(8) or MBR)
 #
 : ${ZFSBOOT_BOOT_POOL_NAME:=bootpool}
@@ -942,6 +952,7 @@ zfs_create_boot()
 	local disks="$*" disk
 	local isswapmirror
 	local bootpart targetpart swappart # Set by zfs_create_diskpart() below
+	local create_options
 
 	#
 	# Pedantic checks; should never be seen
@@ -1066,7 +1077,9 @@ zfs_create_boot()
 		f_count nvdevs $boot_vdevs
 		[ $nvdevs -gt 1 ] && bootpool_vdevtype=mirror
 
+		create_options="$ZFSBOOT_BOOT_POOL_CREATE_OPTIONS"
 		bootpool_options="-o altroot=$BSDINSTALL_CHROOT"
+		bootpool_options="$bootpool_options $create_options"
 		bootpool_options="$bootpool_options -m \"/$bootpool_name\" -f"
 		f_eval_catch $funcname zpool "$ZPOOL_CREATE_WITH_OPTIONS" \
 		             "$bootpool_options" "$bootpool_name" \
@@ -1148,19 +1161,11 @@ zfs_create_boot()
 	# Create the ZFS root pool with desired type and disk devices
 	#
 	f_dprintf "$funcname: Creating root pool..."
+	create_options="$ZFSBOOT_POOL_CREATE_OPTIONS"
 	f_eval_catch $funcname zpool "$ZPOOL_CREATE_WITH_OPTIONS" \
-	             "-o altroot=$BSDINSTALL_CHROOT -O compress=lz4
-	             -m none -f" \
-	             "$zroot_name" "$zroot_vdevtype" "$zroot_vdevs" ||
-	             return $FAILURE
-
-	# Customize the zroot a bit...
-	local option
-	f_dprintf "$funcname: Setting miscellaneous options on root pool..."
-	for option in atime=off; do
-		f_eval_catch $funcname zfs "$ZFS_SET" $option "$zroot_name" ||
-			return $FAILURE
-	done
+		"-o altroot=$BSDINSTALL_CHROOT $create_options -m none -f" \
+		"$zroot_name" "$zroot_vdevtype" "$zroot_vdevs" ||
+		return $FAILURE
 
 	#
 	# Create ZFS dataset layout within the new root pool


More information about the svn-src-head mailing list