[arch-projects] [devtools] [PATCH] Fix return code handling
From: "Jan Alexander Steffens (heftig)" <jan.steffens@gmail.com> Stop trap_exit from forcing a 0 exit code. This fixes makechrootpkg, which used to always return success, even if the build failed. --- lib/common.sh | 2 +- makechrootpkg.in | 4 ++-- mkarchroot.in | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/common.sh b/lib/common.sh index 74b251f..b39bbbc 100644 --- a/lib/common.sh +++ b/lib/common.sh @@ -78,7 +78,7 @@ trap_abort() { trap_exit() { trap - EXIT INT QUIT TERM HUP - cleanup 0 + cleanup } die() { diff --git a/makechrootpkg.in b/makechrootpkg.in index 0535c8c..6c0b013 100644 --- a/makechrootpkg.in +++ b/makechrootpkg.in @@ -213,12 +213,12 @@ if ! grep -q 'SRCDEST="/srcdest"' "$copydir/etc/makepkg.conf"; then echo 'SRCDEST="/srcdest"' >> "$copydir/etc/makepkg.conf" fi -if [[ -n $MAKEFLAGS ]]; then +if [[ -n $MAKEFLAGS ]]; then sed -i '/^MAKEFLAGS=/d' "$copydir/etc/makepkg.conf" echo "MAKEFLAGS='${MAKEFLAGS}'" >> "$copydir/etc/makepkg.conf" fi -if [[ -n $PACKAGER ]]; then +if [[ -n $PACKAGER ]]; then sed -i '/^PACKAGER=/d' "$copydir/etc/makepkg.conf" echo "PACKAGER='${PACKAGER}'" >> "$copydir/etc/makepkg.conf" fi diff --git a/mkarchroot.in b/mkarchroot.in index 7ea90e1..76ad840 100644 --- a/mkarchroot.in +++ b/mkarchroot.in @@ -160,7 +160,8 @@ copy_hostconf () { } trap_chroot_umount () { - trap 'trap_exit' EXIT INT QUIT TERM HUP + trap 'trap_abort' INT QUIT TERM HUP + trap 'trap_exit' EXIT for cache_dir in ${cache_dirs[@]}; do umount "${working_dir}/${cache_dir}" -- 1.8.0
participants (1)
-
Jan Alexander Steffens (heftig)