From af6c0a0f6a7644f583f2d83ba7a61e82b77bdc37 Mon Sep 17 00:00:00 2001 From: Dave Reisner Date: Sun, 1 Jun 2014 23:54:20 -0400 Subject: common.sh: propagate error through trap_exit Fixes a breakage introduced in 6db31cc16a80442 which leads to errors being masked from makechrootpkg. --- lib/common.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/common.sh b/lib/common.sh index b885080..104850b 100644 --- a/lib/common.sh +++ b/lib/common.sh @@ -79,8 +79,9 @@ trap_abort() { } trap_exit() { + local r=$? trap - EXIT INT QUIT TERM HUP - cleanup + cleanup $r } die() { -- cgit v1.2.3-70-g09d2 From 98841eb694fa3cd575fde60e562586cf33415c5b Mon Sep 17 00:00:00 2001 From: Dave Reisner Date: Sat, 10 May 2014 09:31:26 -0400 Subject: common: remove unreachable statement We run from a non-interactive shell, so the exec which is inevitably called will replace the current process and 'die' will never run under any circumstances. This also fixes a bug with the su fallback which would cause multiple arguments to be concatenated without any whitespace between them. --- lib/common.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/common.sh b/lib/common.sh index 104850b..f6aea93 100644 --- a/lib/common.sh +++ b/lib/common.sh @@ -238,7 +238,6 @@ check_root() { if type -P sudo >/dev/null; then exec sudo -- "$@" else - exec su root -c "$(printf '%q' "$@")" + exec su root -c "$(printf ' %q' "$@")" fi - die 'This script must be run as root.' } -- cgit v1.2.3-70-g09d2