diff sbin/fzfs @ 442:a2011285f054

Move "_get_local_zfs_properties_for_create()" into common.subr
author Franz Glasner <fzglas.hg@dom66.de>
date Fri, 03 May 2024 09:35:09 +0200
parents f06998866c01
children 312aebce590c
line wrap: on
line diff
--- a/sbin/fzfs	Fri May 03 09:24:52 2024 +0200
+++ b/sbin/fzfs	Fri May 03 09:35:09 2024 +0200
@@ -41,45 +41,8 @@
 '
 
 
-#:
-#: Determine some important dataset properties that are set locally
-#:
-#: Args:
-#:   $1: the dataset
-#:   $2 ...: the properties to check for
-#:
-#: Output (stdout):
-#:   An option string suited for use in "zfs create"
-#:
-_get_local_zfs_properties_for_create() {
-    local ds
-
-    local _res _prop _value _source
-
-    ds="${1}"
-    shift
-
-    _res=""
-
-    for _prop in "$@" ; do
-        IFS=$'\t' read -r _value _source <<EOF73GHASGJKKJ354
-$(zfs get -H -p -o value,source "${_prop}" "${ds}")
-EOF73GHASGJKKJ354
-        case "${_source}" in
-            local)
-                if [ -z "${_res}" ]; then
-                    _res="-o ${_prop}=${_value}"
-                else
-                    _res="${_res} -o ${_prop}=${_value}"
-                fi
-                ;;
-            *)
-                # VOID
-                ;;
-        esac
-    done
-    echo "${_res}"
-}
+_p_datadir="$(dirname "$0")"/../share/local-bsdtools
+. "${_p_datadir}/common.subr"
 
 
 #