summaryrefslogtreecommitdiffstats
path: root/usr.sbin/bsdinstall
diff options
context:
space:
mode:
authorroberto <roberto@FreeBSD.org>2014-06-04 15:31:57 +0000
committerroberto <roberto@FreeBSD.org>2014-06-04 15:31:57 +0000
commit3af9d4776e4145fbccdcb19cef209913b8354c47 (patch)
tree67a02162b2961e6bbe30107fa90a1421c5d53bdd /usr.sbin/bsdinstall
parentff1d21a86cd2787db5c4e551cc4ef6dbb3abc0e8 (diff)
downloadFreeBSD-src-3af9d4776e4145fbccdcb19cef209913b8354c47.zip
FreeBSD-src-3af9d4776e4145fbccdcb19cef209913b8354c47.tar.gz
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
Diffstat (limited to 'usr.sbin/bsdinstall')
-rwxr-xr-xusr.sbin/bsdinstall/scripts/zfsboot29
1 files changed, 17 insertions, 12 deletions
diff --git a/usr.sbin/bsdinstall/scripts/zfsboot b/usr.sbin/bsdinstall/scripts/zfsboot
index fb25257..72629e7 100755
--- a/usr.sbin/bsdinstall/scripts/zfsboot
+++ b/usr.sbin/bsdinstall/scripts/zfsboot
@@ -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
OpenPOWER on IntegriCloud