comparison sbin/fjail @ 198:dd8a9bbdf8c0

Better error handling when changing privileges and flags of var/empty
author Franz Glasner <fzglas.hg@dom66.de>
date Sun, 21 Aug 2022 11:00:58 +0200
parents 3181a6b5758e
children a8b6584d24ec
comparison
equal deleted inserted replaced
197:3181a6b5758e 198:dd8a9bbdf8c0
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} >/dev/null 2>/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" 507 chmod 0555 "${_mp}/var/empty" || { echo "WARNING: Cannot chmod on var/empty" >&2; }
508 chflags schg "${_mp}/var/empty" 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} >/dev/null 2>/dev/null || { echo "ERROR: cannot reactivate readonly-status of ${_mp}/var/empty" >&2; return 1; }
512 fi 512 fi
513 } 513 }