# HG changeset patch # User Franz Glasner # Date 1661085485 -7200 # Node ID 92e5db34eb2b3853016d711b9774e5448b7cf034 # Parent fcfa674c844448fa31413b09cf68283e173f0243 Implent a "-O" flag for mounts that allows to mount also datasets with configured mountpoints outside their "natural" mountpoints within the dataset hierarchy diff -r fcfa674c8444 -r 92e5db34eb2b sbin/fjail --- a/sbin/fjail Sun Aug 21 14:22:40 2022 +0200 +++ b/sbin/fjail Sun Aug 21 14:38:05 2022 +0200 @@ -40,11 +40,13 @@ -T Create only an extra tiny set of datasets -u Do not automatically mount newly created datasets - mount [-u] [-n] DATASET MOUNTPOINT + mount [-O] [-u] [-n] DATASET MOUNTPOINT Mount the ZFS dataset DATASET and all its children to mountpoint MOUNTPOINT + -O Also mount datasets at mountpoints outside of their natural + and inherited mountpoints -n Do not really mount but show what would be mounted where -u Alias of -n @@ -364,11 +366,15 @@ local _dsname _mountpoint local _name _mp _canmount _mounted local _rootds_mountpoint _relative_mp _real_mp - local _dry_run + local _dry_run _mount_outside _dry_run="" - while getopts "nu" _opt ; do + _mount_outside="" + while getopts "Onu" _opt ; do case ${_opt} in + O) + _mount_outside="yes" + ;; n|u) _dry_run="yes" ;; @@ -433,8 +439,16 @@ fi ;; *) - # XXX FIXME Option to do a zfs mount $_name ??? - echo "Skipping ${_name} because its configured mountpoint is not relative to given root dataset" 2>&1 + if [ "${_mount_outside}" = "yes" ]; then + if [ "${_dry_run}" = "yes" ]; then + echo "Would mount ${_name} on configured dataset mountpoint ${_mp}" + else + echo "Mounting ${_name} on configured dataset mountpoint ${_mp}" + zfs mount "${_name}" || return 1 + fi + else + echo "Skipping ${_name} because its configured mountpoint is not relative to given root dataset" 2>&1 + fi ;; esac done