# HG changeset patch # User Franz Glasner # Date 1695281707 -7200 # Node ID 2cd4777821fc0a0476fa47582f4c1db72a0ebdef # Parent 3ebaa936b2b241f667b57aa57fad743883e1b9c6 More work on "fzfs copy-tree" diff -r 3ebaa936b2b2 -r 2cd4777821fc sbin/fzfs --- a/sbin/fzfs Wed Sep 20 17:25:16 2023 +0200 +++ b/sbin/fzfs Thu Sep 21 09:35:07 2023 +0200 @@ -259,7 +259,8 @@ local _opt_mountpoint _opt_mount_noauto _opt_nomount _opt_dry_run local _ds_source_base _ds_source_snapshot _snapshot_suffix - local _ds_tree _ds _ds_relname + local _ds_tree _ds _ds_relname _ds_canmount + local _rflags _opt_mountpoint="" _opt_mount_noauto="" @@ -336,20 +337,31 @@ for _ds in ${_ds_tree}; do # Determine the relative name of the dataset _ds_relname="${_ds#${_ds_source_base}}" - echo "REL: $_ds --- $_ds_relname" + + _ds_canmount=$(zfs get -H -o value canmount "${_ds}") + echo "REL: $_ds --- $_ds_relname --- $_ds_canmount" + + _rflags="" + + if [ "${_ds_canmount}" = "off" ]; then + _rflags="-o canmount=off" + else + _rflags="${_opt_mount_noauto}" + fi if [ -z "${_ds_relname}" ]; then # # Source root to target root # if [ -z "${_opt_mountpoint}" ]; then + _rflags="${_rflags} -x mountpoint" else + _rflags="${_rflags} -o mountpoint="'"'"${_opt_mountpoint}"'"' fi else - if [ -z "${_opt_mountpoint}" ]; then - else - fi + _rflags="${_rflags} -x mountpoint" fi + echo "zfs send -Lec -p -v ${_ds}${_ds_source_snapshot} | zfs receive -v $_opt_nomount ${_rflags} ${_ds_target}${_ds_relname}" done }