Mercurial > hgrepos > FreeBSD > ports > sysutils > local-bsdtools
diff sbin/ftjail @ 270:dde5967d1e43
Implement the "-M" (custom mountpoint) option for "copy-skel"
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Wed, 14 Sep 2022 09:24:27 +0200 |
| parents | 68f091c9524a |
| children | 570363928b13 |
line wrap: on
line diff
--- a/sbin/ftjail Tue Sep 13 09:31:42 2022 +0200 +++ b/sbin/ftjail Wed Sep 14 09:24:27 2022 +0200 @@ -76,6 +76,8 @@ -A Set "canmount=noauto" for all datasets in the target dataset -L Copy dataset properties optimized for employing a "skeleton" subdirectory + -M MOUNTPOINT Set the "mountpoint" property for the TARGET-DS to + MOUNTPOINT (children will inherit it) -P Copy dataset properties optimized for direct mounts of skeleton children over an already mounted base -u Do not mount the target dataset automatically @@ -707,16 +709,16 @@ #: command_copy_skel() { local _ds_source _snapshot_name _ds_target - local _opt_symlink _opt_nomount + local _opt_symlink _opt_nomount _opt_canmount _opt_mountpoint - local _opt _name _relative_name _opt_canmount + local _opt _name _relative_name _root_canmount _opt_symlink="" _opt_nomount="" _opt_canmount="-o canmount=on" - + _opt_mountpoint="" - while getopts "ALPu" _opt ; do + while getopts "ALM:Pu" _opt ; do case ${_opt} in A) _opt_canmount="-o canmount=noauto" @@ -724,6 +726,9 @@ L) _opt_symlink="yes" ;; + M) + _opt_mountpoint="${OPTARG}" + ;; P) _opt_symlink="no" ;; @@ -760,9 +765,14 @@ if [ -z "${_relative_name}" ]; then # root if [ "${_opt_symlink}" = "yes" ]; then - zfs send -Lec -p -v "${_name}" | zfs receive ${_opt_nomount} -v ${_opt_canmount} -x mountpoint "${_ds_target}${_relative_name}" + _root_canmount="${_opt_canmount}" else - zfs send -Lec -p -v "${_name}" | zfs receive ${_opt_nomount} -v -o canmount=off -x mountpoint "${_ds_target}${_relative_name}" + _root_canmount="-o canmount=off" + fi + if [ -n "${_opt_mountpoint}" ]; then + zfs send -Lec -p -v "${_name}" | zfs receive ${_opt_nomount} -v ${_root_canmount} -o "mountpoint=${_opt_mountpoint}" "${_ds_target}${_relative_name}" + else + zfs send -Lec -p -v "${_name}" | zfs receive ${_opt_nomount} -v ${_root_canmount} -x mountpoint "${_ds_target}${_relative_name}" fi else # child
