mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-11-15 23:05:49 +01:00
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
This commit is contained in:
parent
540a8eac2f
commit
47206692f2
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=266555
@ -44,6 +44,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
|
||||
#
|
||||
@ -81,6 +86,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)
|
||||
#
|
||||
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user