comparison sbin/fjail @ 199:a8b6584d24ec

FIX: Do not suppress stderr messages from some "zfs set" calls. This gives better error messages.
author Franz Glasner <fzglas.hg@dom66.de>
date Sun, 21 Aug 2022 11:06:19 +0200
parents dd8a9bbdf8c0
children 8f739dd15d7f
comparison
equal deleted inserted replaced
198:dd8a9bbdf8c0 199:a8b6584d24ec
498 _get=$(zfs get -H readonly ${_veds} 2>/dev/null) || { echo "ERROR: cannot determine readonly status of ${_mp}/var/empty" >&2; return 1; } 498 _get=$(zfs get -H readonly ${_veds} 2>/dev/null) || { echo "ERROR: cannot determine readonly status of ${_mp}/var/empty" >&2; return 1; }
499 IFS=$'\t' read _dummy _dummy _vestatus _dummy <<EOF 499 IFS=$'\t' read _dummy _dummy _vestatus _dummy <<EOF
500 ${_get} 500 ${_get}
501 EOF 501 EOF
502 if [ "${_vestatus}" = "on" ]; then 502 if [ "${_vestatus}" = "on" ]; then
503 zfs set readonly=off ${_veds} >/dev/null 2>/dev/null || { echo "ERROR: cannot reset readonly-status of ${_mp}/var/empty" >&2; return 1; } 503 zfs set readonly=off ${_veds} 1> /dev/null || { echo "ERROR: cannot reset readonly-status of ${_mp}/var/empty" >&2; return 1; }
504 fi 504 fi
505 fi 505 fi
506 # Set the access rights and the file flags as given in mtree 506 # Set the access rights and the file flags as given in mtree
507 chmod 0555 "${_mp}/var/empty" || { echo "WARNING: Cannot chmod on var/empty" >&2; } 507 chmod 0555 "${_mp}/var/empty" || { echo "WARNING: Cannot chmod on var/empty" >&2; }
508 chflags schg "${_mp}/var/empty" || { echo "WARNING: Cannot chflags on var/empty" >&2; } 508 chflags schg "${_mp}/var/empty" || { echo "WARNING: Cannot chflags on var/empty" >&2; }
509 # Reset the read-only status of the mountpoint as it was before 509 # Reset the read-only status of the mountpoint as it was before
510 if [ "${_vestatus}" = "on" ]; then 510 if [ "${_vestatus}" = "on" ]; then
511 zfs set readonly=on ${_veds} >/dev/null 2>/dev/null || { echo "ERROR: cannot reactivate readonly-status of ${_mp}/var/empty" >&2; return 1; } 511 zfs set readonly=on ${_veds} 1> /dev/null || { echo "ERROR: cannot reactivate readonly-status of ${_mp}/var/empty" >&2; return 1; }
512 fi 512 fi
513 } 513 }
514 514
515 515
516 # 516 #