Mercurial > hgrepos > FreeBSD > ports > sysutils > local-bsdtools
comparison sbin/fjail @ 203:eb95c986cc59
Use -t filesystem in all "zfs list" calls
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Sun, 21 Aug 2022 12:18:15 +0200 |
| parents | 6b7a084ddf1d |
| children | ef397b84b047 |
comparison
equal
deleted
inserted
replaced
| 202:6b7a084ddf1d | 203:eb95c986cc59 |
|---|---|
| 172 _pds="$1" | 172 _pds="$1" |
| 173 if [ -z "${_pds}" ]; then | 173 if [ -z "${_pds}" ]; then |
| 174 echo "ERROR: no parent dataset given" >&2 | 174 echo "ERROR: no parent dataset given" >&2 |
| 175 return 2 | 175 return 2 |
| 176 fi | 176 fi |
| 177 _pmp=$(zfs list -H -o mountpoint "${_pds}" 2>/dev/null) || { echo "ERROR: dataset \`${_pds}' does not exist" >&2; return 1; } | 177 _pmp=$(zfs list -H -o mountpoint -t filesystem "${_pds}" 2>/dev/null) || { echo "ERROR: dataset \`${_pds}' does not exist" >&2; return 1; } |
| 178 case "${_pmp}" in | 178 case "${_pmp}" in |
| 179 none) | 179 none) |
| 180 echo "ERROR: dataset \`${_pds}' has no mountpoint" >&2 | 180 echo "ERROR: dataset \`${_pds}' has no mountpoint" >&2 |
| 181 return 1 | 181 return 1 |
| 182 ;; | 182 ;; |
| 193 echo "ERROR: no child dataset given" >&2 | 193 echo "ERROR: no child dataset given" >&2 |
| 194 return 2 | 194 return 2 |
| 195 fi | 195 fi |
| 196 _ds="${_pds}/${_cds}" | 196 _ds="${_pds}/${_cds}" |
| 197 echo "Resulting new root dataset is \`${_ds}' at mountpoint \`${_pmp}/${_cds}'" | 197 echo "Resulting new root dataset is \`${_ds}' at mountpoint \`${_pmp}/${_cds}'" |
| 198 if zfs list -H -o mountpoint "${_ds}" >/dev/null 2>/dev/null; then | 198 if zfs list -H -o mountpoint -t filesystem "${_ds}" >/dev/null 2>/dev/null; then |
| 199 echo "ERROR: dataset \`${_ds}' does already exist" >&2 | 199 echo "ERROR: dataset \`${_ds}' does already exist" >&2 |
| 200 return 1 | 200 return 1 |
| 201 fi | 201 fi |
| 202 | 202 |
| 203 # | 203 # |
| 494 # make it writeable temporarily if it is mounted read-only: | 494 # make it writeable temporarily if it is mounted read-only: |
| 495 # | 495 # |
| 496 _vestatus="" | 496 _vestatus="" |
| 497 _veds="$(_get_dataset_for_varempty "${_mp}")" | 497 _veds="$(_get_dataset_for_varempty "${_mp}")" |
| 498 if [ $? -eq 0 ]; then | 498 if [ $? -eq 0 ]; then |
| 499 _vestatus=$(zfs list -H -o readonly ${_veds} 2>/dev/null) || { echo "ERROR: cannot determine readonly status of ${_mp}/var/empty" >&2; return 1; } | 499 _vestatus=$(zfs list -H -o readonly -t filesystem ${_veds} 2>/dev/null) || { echo "ERROR: cannot determine readonly status of ${_mp}/var/empty" >&2; return 1; } |
| 500 if [ "${_vestatus}" = "on" ]; then | 500 if [ "${_vestatus}" = "on" ]; then |
| 501 zfs set readonly=off ${_veds} 1> /dev/null || { echo "ERROR: cannot reset readonly-status of ${_mp}/var/empty" >&2; return 1; } | 501 zfs set readonly=off ${_veds} 1> /dev/null || { echo "ERROR: cannot reset readonly-status of ${_mp}/var/empty" >&2; return 1; } |
| 502 fi | 502 fi |
| 503 fi | 503 fi |
| 504 # Set the access rights and the file flags as given in mtree | 504 # Set the access rights and the file flags as given in mtree |
