X-Git-Url: https://git.grml.org/?p=grml-debootstrap.git;a=blobdiff_plain;f=grml-debootstrap;h=51960e4df79e8ff5ae734fb678b2719d39e9f17e;hp=0489c52228223913c421bad9d2efa15905427df0;hb=1a229d046e1a03bbdfa7e33da8504eef6666747f;hpb=dd57cf2dbf899f690630019cc10d5657a40c56f6 diff --git a/grml-debootstrap b/grml-debootstrap index 0489c52..51960e4 100755 --- a/grml-debootstrap +++ b/grml-debootstrap @@ -8,36 +8,25 @@ # shellcheck disable=SC2001,SC2181 # error_handler {{{ -[ -n "$REPORT_TRAP_ERR" ] || REPORT_TRAP_ERR='no' -[ -n "$FAIL_TRAP_ERR" ] || FAIL_TRAP_ERR='no' - error_handler() { last_exit_code="$?" last_bash_command="$BASH_COMMAND" - if [ "$REPORT_TRAP_ERR" = "yes" ]; then - echo "Unexpected non-zero exit code $last_exit_code in ${BASH_SOURCE[*]} at line ${BASH_LINENO[*]} detected! + echo "Unexpected non-zero exit code $last_exit_code in ${BASH_SOURCE[*]} at line ${BASH_LINENO[*]} detected! last bash command: $last_bash_command" - fi - if [ ! "$FAIL_TRAP_ERR" = "yes" ]; then - return - fi ## Check if "bailout" function is available. ## This is not the case in chroot-script. if command -v bailout >/dev/null 2>&1; then bailout 1 else - echo 'FAIL_TRAP_ERR is set to "yes", exit 1.' exit 1 fi } -if [ "$REPORT_TRAP_ERR" = "yes" ] || [ "$FAIL_TRAP_ERR" = "yes" ]; then - set -e - set -E - set -o pipefail - trap "error_handler" ERR - export -f "error_handler" -fi +set -e +set -E +set -o pipefail +trap "error_handler" ERR +export -f "error_handler" # }}} # variables {{{