Mercurial > hgrepos > FreeBSD > ports > sysutils > local-bsdtools
changeset 202:6b7a084ddf1d
Replace all calls to "zfs get" to "zfs list -o".
This is to get rid of some "read" calls.
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Sun, 21 Aug 2022 12:08:59 +0200 |
| parents | 687210f46b8f |
| children | eb95c986cc59 |
| files | sbin/fjail |
| diffstat | 1 files changed, 4 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/sbin/fjail Sun Aug 21 11:43:01 2022 +0200 +++ b/sbin/fjail Sun Aug 21 12:08:59 2022 +0200 @@ -135,7 +135,7 @@ # parent ZFS dataset -- child ZFS dataset name local _pds _cds # and its mount point - local _pmp _get _dummy + local _pmp _get # full name of the dataset local _ds # dynamic ZFS options -- create cache for freebsd-update -- use a more tiny layout @@ -174,10 +174,7 @@ echo "ERROR: no parent dataset given" >&2 return 2 fi - _get=$(zfs get -H mountpoint "${_pds}" 2>/dev/null) || { echo "ERROR: dataset \`${_pds}' does not exist" >&2; return 1; } - IFS=$'\t' read _dummy _dummy _pmp _dummy <<EOF -${_get} -EOF + _pmp=$(zfs list -H -o mountpoint "${_pds}" 2>/dev/null) || { echo "ERROR: dataset \`${_pds}' does not exist" >&2; return 1; } case "${_pmp}" in none) echo "ERROR: dataset \`${_pds}' has no mountpoint" >&2 @@ -198,7 +195,7 @@ fi _ds="${_pds}/${_cds}" echo "Resulting new root dataset is \`${_ds}' at mountpoint \`${_pmp}/${_cds}'" - if zfs get -H mountpoint "${_ds}" >/dev/null 2>/dev/null; then + if zfs list -H -o mountpoint "${_ds}" >/dev/null 2>/dev/null; then echo "ERROR: dataset \`${_ds}' does already exist" >&2 return 1 fi @@ -499,10 +496,7 @@ _vestatus="" _veds="$(_get_dataset_for_varempty "${_mp}")" if [ $? -eq 0 ]; then - _get=$(zfs get -H readonly ${_veds} 2>/dev/null) || { echo "ERROR: cannot determine readonly status of ${_mp}/var/empty" >&2; return 1; } - IFS=$'\t' read _dummy _dummy _vestatus _dummy <<EOF -${_get} -EOF + _vestatus=$(zfs list -H -o readonly ${_veds} 2>/dev/null) || { echo "ERROR: cannot determine readonly status of ${_mp}/var/empty" >&2; return 1; } if [ "${_vestatus}" = "on" ]; then zfs set readonly=off ${_veds} 1> /dev/null || { echo "ERROR: cannot reset readonly-status of ${_mp}/var/empty" >&2; return 1; } fi
