Enable `set -e` if environment variables `REPORT_TRAP_ERR`
or `FAIL_TRAP_ERR` are set to `yes`.
related to https://github.com/grml/grml-debootstrap/issues/224
# error_handler {{{
if [ "$REPORT_TRAP_ERR" = "yes" ] || [ "$FAIL_TRAP_ERR" = "yes" ]; then
+ set -e
set -E
set -o pipefail
trap "error_handler" ERR
}
if [ "$REPORT_TRAP_ERR" = "yes" ] || [ "$FAIL_TRAP_ERR" = "yes" ]; then
+ set -e
set -E
set -o pipefail
trap "error_handler" ERR
preparechroot execute_pre_scripts chrootscript execute_post_scripts \
remove_configs umount_chroot grub_install umount_target fscktool ; do
if stage "${i}" ; then
- if "$i" ; then
+ "$i"
+ if [ $? -eq 0 ]; then
stage "${i}" 'done' && rm -f "${STAGES}/${i}"
else
bailout 2 "$i"