comparison sbin/ftjail @ 657:db22766df6a4

ftjail: redirect stderr when determining the existence of a ZFS dataset snapshot
author Franz Glasner <fzglas.hg@dom66.de>
date Sat, 28 Sep 2024 14:55:57 +0200
parents a8052a57a921
children 260a81d769a6
comparison
equal deleted inserted replaced
656:a8052a57a921 657:db22766df6a4
901 901
902 [ -z "${_directory}" ] && { echo "ERROR: no directory given" 1>&2; return 2; } 902 [ -z "${_directory}" ] && { echo "ERROR: no directory given" 1>&2; return 2; }
903 [ -d "${_directory}" ] || { echo "ERROR: directory \`${_directory}' does not exist" 1>&2; return 1; } 903 [ -d "${_directory}" ] || { echo "ERROR: directory \`${_directory}' does not exist" 1>&2; return 1; }
904 904
905 [ -z "${_new_origin}" ] && { echo "ERROR: no new origin given" 1>&2; return 2; } 905 [ -z "${_new_origin}" ] && { echo "ERROR: no new origin given" 1>&2; return 2; }
906 zfs list -H -o name -t snapshot "${_new_origin}" >/dev/null || { echo "ERROR: ZFS dataset for the new origin \`${_new_origin}' does not exist" 1>&2; return 1; } 906 zfs list -H -o name -t snapshot "${_new_origin}" >/dev/null 2>/dev/null || { echo "ERROR: ZFS dataset snapshot for the new origin \`${_new_origin}' does not exist" 1>&2; return 1; }
907 if [ -n "${_etcupdate_tarball}" ]; then 907 if [ -n "${_etcupdate_tarball}" ]; then
908 [ -r "${_etcupdate_tarball}" ] || { echo "ERROR: given etcupdate tarball does not exist and/or is not readable" 1>&2; return 1; } 908 [ -r "${_etcupdate_tarball}" ] || { echo "ERROR: given etcupdate tarball does not exist and/or is not readable" 1>&2; return 1; }
909 fi 909 fi
910 910
911 _dir_basename="$(basename "${_directory}")" 911 _dir_basename="$(basename "${_directory}")"