bsdinstall: improve zfsboots ability to handle datasets under a BE

Currently we only set canmount=noauto on the root of the BE, this
change makes it so we set it on all datasets under the BE as well.

Reviewed by:	allanjude
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D35422
This commit is contained in:
Brad Davis 2022-06-07 11:11:02 -06:00
parent 7958889716
commit a320e9dd51

View File

@ -1473,9 +1473,18 @@ zfs_create_boot()
# Set canmount=noauto so that the default Boot Environment (BE) does
# not get mounted if a different BE is selected from the beastie menu
#
f_dprintf "$funcname: Set canmount=noauto for the root of the pool..."
f_eval_catch $funcname zfs "$ZFS_SET" "canmount=noauto" \
"$zroot_name/$ZFSBOOT_BEROOT_NAME/$ZFSBOOT_BOOTFS_NAME"
f_dprintf "$funcname: Set canmount=noauto for any datasets under the BE..."
echo "$ZFSBOOT_DATASETS" | while read dataset options; do
# Skip blank lines and comments
case "$dataset" in "#"*|"") continue; esac
options="${options%%#*}"
#
case "$dataset" in "/$ZFSBOOT_BEROOT_NAME/$ZFSBOOT_BOOTFS_NAME"*)
f_eval_catch $funcname zfs "$ZFS_SET" "canmount=noauto" \
"$zroot_name$dataset" || return $FAILURE ;;
*) continue ;;
esac
done
# Last, but not least... required lines for rc.conf(5)/loader.conf(5)
# NOTE: We later concatenate these into their destination