# HG changeset patch # User Franz Glasner # Date 1663053501 -7200 # Node ID 95a81116471af4a5224538307e1ebec5738f4d94 # Parent 947ccf0a99fdd27b6e3a967e1d77cb8f05fef64a Implement a mount option to allow only the mount of children whem mounting a dataset tree diff -r 947ccf0a99fd -r 95a81116471a sbin/fjail --- a/sbin/fjail Tue Sep 13 00:13:05 2022 +0200 +++ b/sbin/fjail Tue Sep 13 09:18:21 2022 +0200 @@ -49,6 +49,7 @@ -O Also mount datasets at mountpoints outside of their "natural" and inherited mountpoints -N Mount at their "natural" configured ZFS mountpoints (MOUNTPOINT is not required) + -P Do not mount the given prent DATASET but only its children -n Do not really mount but show what would be mounted where -u Alias of -n @@ -497,12 +498,13 @@ local _dsname _mountpoint local _name _mp _canmount _mounted local _rootds_mountpoint _relative_mp _real_mp - local _dry_run _mount_outside _mount_natural + local _dry_run _mount_outside _mount_natural _mount_children_only _dry_run="" _mount_outside="" _mount_natural="" - while getopts "ONnu" _opt ; do + _mount_children_only="" + while getopts "ONPnu" _opt ; do case ${_opt} in O) _mount_outside="yes" @@ -510,6 +512,9 @@ N) _mount_natural="yes" ;; + P) + _mount_children_only="yes" + ;; n|u) _dry_run="yes" ;; @@ -560,6 +565,8 @@ [ "${_mounted}" = "yes" ] && continue # Skip filesystems that must not be mounted [ "${_canmount}" = "off" ] && continue + # Mount only the children and skip the given dataset it required + [ \( "${_mount_children_only}" = "yes" \) -a \( "${_name}" = "${_dsname}" \) ] && continue case "${_mp}" in "none"|"legacy") # Do nothing for filesystem with unset or legacy mountpoints