diff sbin/ftjail @ 628:17209ce80536

Use the newly implemented "_get_zfs_mounts_for_dataset_tree()" where appropriate. It is in sbin/ftjail and sbin/fzfs.
author Franz Glasner <fzglas.hg@dom66.de>
date Tue, 24 Sep 2024 18:46:15 +0200
parents d173161a3a0f
children f7eda6256ae8
line wrap: on
line diff
--- a/sbin/ftjail	Tue Sep 24 18:20:30 2024 +0200
+++ b/sbin/ftjail	Tue Sep 24 18:46:15 2024 +0200
@@ -535,18 +535,11 @@
     [ -z "${_dsname}" ] && { echo "ERROR: no dataset given" >&2; return 2; }
 
     # Just determine whether the given dataset name exists
-    _rootds_mountpoint="$(zfs list -H -o mountpoint -t filesystem "${_dsname}")" || \
-        { echo "ERROR: dataset not found" >&2; return 1; }
+    _rootds_mountpoint="$(zfs list -H -o mountpoint -t filesystem "${_dsname}" 2>/dev/null)" || { err "dataset not found"; return 1; }
 
-    # Check for unexpected spaces
-    if ! check_for_proper_fstab; then
-        fatal 1 "Unexpected spaces in fstab. Please install \`${JQ}'."
-    fi
-    /sbin/mount -t zfs -p \
-    | LC_ALL=C /usr/bin/grep -E "^${_dsname}(/|\s)" \
-    | LC_ALL=C /usr/bin/sort -n -r \
+    _get_zfs_mounts_for_dataset_tree -r "${_dsname}" \
     | {
-        while IFS=' '$'\t' read -r _name _mp _rest ; do
+        while IFS=$'\t' read -r _name _mp _rest ; do
             echo "Umounting ${_name} on ${_mp}"
             /sbin/umount "${_mp}" || return 1
         done