Mercurial > hgrepos > FreeBSD > ports > sysutils > local-bsdtools
comparison sbin/fjail @ 196:a4fd3bcbbf1c
Use "mount -p" instead of "zfs mount" when determining devices for the real mountpoints
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Sun, 21 Aug 2022 10:27:14 +0200 |
| parents | 4a0cb73945a8 |
| children | 3181a6b5758e |
comparison
equal
deleted
inserted
replaced
| 195:4a0cb73945a8 | 196:a4fd3bcbbf1c |
|---|---|
| 81 # Reset to standard umask | 81 # Reset to standard umask |
| 82 umask 0022 | 82 umask 0022 |
| 83 | 83 |
| 84 | 84 |
| 85 _get_dataset_for_mountpoint() { | 85 _get_dataset_for_mountpoint() { |
| 86 : 'Use `zfs mount` to determine the ZFS dataset for a given mountpoint. | 86 : 'Use `mount -t zfs -p` to determine the ZFS dataset for a given mountpoint. |
| 87 | 87 |
| 88 ' | 88 ' |
| 89 local _mountpoint | 89 local _mountpoint |
| 90 local _ds _mount | 90 local _ds _mount _rest |
| 91 | 91 |
| 92 _mountpoint="$1" | 92 _mountpoint="$1" |
| 93 | 93 |
| 94 while read -r _ds _mount; do | 94 while IFS=' '$'\t' read -r _ds _mount _rest ; do |
| 95 if [ "$_mount" = "$_mountpoint" ]; then | 95 if [ "$_mount" = "$_mountpoint" ]; then |
| 96 echo $_ds | 96 echo "${_ds}" |
| 97 return 0 | 97 return 0 |
| 98 fi | 98 fi |
| 99 done <<EOF__GDSFM | 99 done <<EOF__GDSFM |
| 100 $(zfs mount) | 100 $(mount -t zfs -p) |
| 101 EOF__GDSFM | 101 EOF__GDSFM |
| 102 return 1 | 102 return 1 |
| 103 } | 103 } |
| 104 | 104 |
| 105 | 105 |
| 490 # | 490 # |
| 491 # Handle <mountpoint>/var/empty specially: | 491 # Handle <mountpoint>/var/empty specially: |
| 492 # make it writeable temporarily if it is mounted read-only: | 492 # make it writeable temporarily if it is mounted read-only: |
| 493 # | 493 # |
| 494 _vestatus="" | 494 _vestatus="" |
| 495 _veds=$(_get_dataset_for_varempty "${_mp}") | 495 _veds="$(_get_dataset_for_varempty "${_mp}")" |
| 496 if [ $? -eq 0 ]; then | 496 if [ $? -eq 0 ]; then |
| 497 _get=$(zfs get -H readonly ${_veds} 2>/dev/null) || { echo "ERROR: cannot determine readonly status of ${_mp}/var/empty" >&2; return 1; } | 497 _get=$(zfs get -H readonly ${_veds} 2>/dev/null) || { echo "ERROR: cannot determine readonly status of ${_mp}/var/empty" >&2; return 1; } |
| 498 IFS=$'\t' read _dummy _dummy _vestatus _dummy <<EOF | 498 IFS=$'\t' read _dummy _dummy _vestatus _dummy <<EOF |
| 499 ${_get} | 499 ${_get} |
| 500 EOF | 500 EOF |
