Mercurial > hgrepos > FreeBSD > ports > sysutils > local-bsdtools
comparison sbin/fjail @ 195:4a0cb73945a8
Use "read -r" for when mounting/unmounting
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Sun, 21 Aug 2022 08:50:20 +0200 |
| parents | 379d3178f3ce |
| children | a4fd3bcbbf1c |
comparison
equal
deleted
inserted
replaced
| 194:379d3178f3ce | 195:4a0cb73945a8 |
|---|---|
| 393 | 393 |
| 394 _rootds_mountpoint="$(zfs list -H -o mountpoint -t filesystem "${_dsname}")" || \ | 394 _rootds_mountpoint="$(zfs list -H -o mountpoint -t filesystem "${_dsname}")" || \ |
| 395 { echo "ERROR: root dataset does not exist" >&2; return 1; } | 395 { echo "ERROR: root dataset does not exist" >&2; return 1; } |
| 396 | 396 |
| 397 zfs list -H -o name,mountpoint,canmount,mounted -s mountpoint -t filesystem -r "${_dsname}" | \ | 397 zfs list -H -o name,mountpoint,canmount,mounted -s mountpoint -t filesystem -r "${_dsname}" | \ |
| 398 while IFS=$'\t' read _name _mp _canmount _mounted ; do | 398 while IFS=$'\t' read -r _name _mp _canmount _mounted ; do |
| 399 # Skip filesystems that are already mounted | 399 # Skip filesystems that are already mounted |
| 400 [ "${_mounted}" = "yes" ] && continue | 400 [ "${_mounted}" = "yes" ] && continue |
| 401 # Skip filesystems that must not be mounted | 401 # Skip filesystems that must not be mounted |
| 402 [ "${_canmount}" = "off" ] && continue | 402 [ "${_canmount}" = "off" ] && continue |
| 403 case "${_mp}" in | 403 case "${_mp}" in |
| 453 _rootds_mountpoint="$(zfs list -H -o mountpoint -t filesystem "${_dsname}")" | return 1 | 453 _rootds_mountpoint="$(zfs list -H -o mountpoint -t filesystem "${_dsname}")" | return 1 |
| 454 | 454 |
| 455 mount -t zfs -p | \ | 455 mount -t zfs -p | \ |
| 456 grep -E "^${_dsname}(/|\s)" | \ | 456 grep -E "^${_dsname}(/|\s)" | \ |
| 457 sort -n -r | \ | 457 sort -n -r | \ |
| 458 while IFS=' '$'\t' read _name _mp _rest ; do | 458 while IFS=' '$'\t' read -r _name _mp _rest ; do |
| 459 echo "Umounting ${_name} on ${_mp}" | 459 echo "Umounting ${_name} on ${_mp}" |
| 460 umount "${_mp}" || return 1 | 460 umount "${_mp}" || return 1 |
| 461 done | 461 done |
| 462 return 0 | 462 return 0 |
| 463 } | 463 } |
