git: a320e9dd51e6 - main - bsdinstall: improve zfsboots ability to handle datasets under a BE
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 23 Jun 2022 15:21:49 UTC
The branch main has been updated by brd: URL: https://cgit.FreeBSD.org/src/commit/?id=a320e9dd51e6e58715a1390f2e00790a94017dfb commit a320e9dd51e6e58715a1390f2e00790a94017dfb Author: Brad Davis <brd@FreeBSD.org> AuthorDate: 2022-06-07 17:11:02 +0000 Commit: Brad Davis <brd@FreeBSD.org> CommitDate: 2022-06-23 15:21:08 +0000 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 --- usr.sbin/bsdinstall/scripts/zfsboot | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/usr.sbin/bsdinstall/scripts/zfsboot b/usr.sbin/bsdinstall/scripts/zfsboot index dc9d35feaa78..1e771710cb7c 100755 --- a/usr.sbin/bsdinstall/scripts/zfsboot +++ b/usr.sbin/bsdinstall/scripts/zfsboot @@ -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