comparison 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
comparison
equal deleted inserted replaced
627:b1e26b956041 628:17209ce80536
533 533
534 _dsname="${1}" 534 _dsname="${1}"
535 [ -z "${_dsname}" ] && { echo "ERROR: no dataset given" >&2; return 2; } 535 [ -z "${_dsname}" ] && { echo "ERROR: no dataset given" >&2; return 2; }
536 536
537 # Just determine whether the given dataset name exists 537 # Just determine whether the given dataset name exists
538 _rootds_mountpoint="$(zfs list -H -o mountpoint -t filesystem "${_dsname}")" || \ 538 _rootds_mountpoint="$(zfs list -H -o mountpoint -t filesystem "${_dsname}" 2>/dev/null)" || { err "dataset not found"; return 1; }
539 { echo "ERROR: dataset not found" >&2; return 1; } 539
540 540 _get_zfs_mounts_for_dataset_tree -r "${_dsname}" \
541 # Check for unexpected spaces
542 if ! check_for_proper_fstab; then
543 fatal 1 "Unexpected spaces in fstab. Please install \`${JQ}'."
544 fi
545 /sbin/mount -t zfs -p \
546 | LC_ALL=C /usr/bin/grep -E "^${_dsname}(/|\s)" \
547 | LC_ALL=C /usr/bin/sort -n -r \
548 | { 541 | {
549 while IFS=' '$'\t' read -r _name _mp _rest ; do 542 while IFS=$'\t' read -r _name _mp _rest ; do
550 echo "Umounting ${_name} on ${_mp}" 543 echo "Umounting ${_name} on ${_mp}"
551 /sbin/umount "${_mp}" || return 1 544 /sbin/umount "${_mp}" || return 1
552 done 545 done
553 return 0 546 return 0
554 } 547 }