Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 4 Jun 2014 15:31:57 +0000 (UTC)
From:      Ollivier Robert <roberto@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r267061 - stable/10/usr.sbin/bsdinstall/scripts
Message-ID:  <201406041531.s54FVvxc062785@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: roberto
Date: Wed Jun  4 15:31:57 2014
New Revision: 267061
URL: http://svnweb.freebsd.org/changeset/base/267061

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

Modified:
  stable/10/usr.sbin/bsdinstall/scripts/zfsboot
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/usr.sbin/bsdinstall/scripts/zfsboot
==============================================================================
--- stable/10/usr.sbin/bsdinstall/scripts/zfsboot	Wed Jun  4 15:30:49 2014	(r267060)
+++ stable/10/usr.sbin/bsdinstall/scripts/zfsboot	Wed Jun  4 15:31:57 2014	(r267061)
@@ -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



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