Mercurial > hgrepos > FreeBSD > ports > sysutils > local-bsdtools
changeset 426:2cd4777821fc
More work on "fzfs copy-tree"
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Thu, 21 Sep 2023 09:35:07 +0200 |
| parents | 3ebaa936b2b2 |
| children | 7056e5b7712d |
| files | sbin/fzfs |
| diffstat | 1 files changed, 17 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- 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 }
