Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2011-10-13 11:25:09 -0500
committerDan McGee <dan@archlinux.org>2011-10-13 11:25:50 -0500
commitff8704635440fe890ac8621722cc8301a3875e48 (patch)
tree2e932feb61e23808c2d68c347381f4fa3e81f7f7 /scripts
parent35e6136f4b1b45a7cb736ca0608da7f44c74b233 (diff)
parent04fd320e97770911894fb06ba98f3c17fc30c7d9 (diff)
Merge branch 'maint'
Conflicts: src/pacman/util.c
Diffstat (limited to 'scripts')
-rw-r--r--scripts/makepkg.sh.in4
-rw-r--r--scripts/repo-add.sh.in16
2 files changed, 15 insertions, 5 deletions
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index 50cf2725..09c1e963 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -179,7 +179,9 @@ clean_up() {
##
set -E
trap 'clean_up' 0
-trap 'trap_exit "$(gettext "TERM signal caught. Exiting...")"' TERM HUP QUIT
+for signal in TERM HUP QUIT; do
+ trap "trap_exit \"$(gettext "%s signal caught. Exiting...")\" \"$signal\"" "$signal"
+done
trap 'trap_exit "$(gettext "Aborted by user! Exiting...")"' INT
trap 'trap_exit "$(gettext "An unknown error has occurred. Exiting...")"' ERR
diff --git a/scripts/repo-add.sh.in b/scripts/repo-add.sh.in
index ff3511c1..fc008fc4 100644
--- a/scripts/repo-add.sh.in
+++ b/scripts/repo-add.sh.in
@@ -520,13 +520,19 @@ remove() {
}
trap_exit() {
+ # unhook all traps to avoid race conditions
+ trap '' EXIT TERM HUP QUIT INT ERR
+
echo
error "$@"
- exit 1
+ clean_up 1
}
clean_up() {
- local exit_code=$?
+ local exit_code=${1:-$?}
+
+ # unhook all traps to avoid race conditions
+ trap '' EXIT TERM HUP QUIT INT ERR
[[ -d $tmpdir ]] && rm -rf "$tmpdir"
(( CLEAN_LOCK )) && [[ -f $LOCKFILE ]] && rm -f "$LOCKFILE"
@@ -566,9 +572,11 @@ tmpdir=$(mktemp -d "${TMPDIR:-/tmp}/repo-tools.XXXXXXXXXX") || (\
mkdir $tmpdir/tree
trap 'clean_up' EXIT
-trap 'trap_exit "$(gettext "TERM signal caught. Exiting...")"' TERM HUP QUIT
+for signal in TERM HUP QUIT; do
+ trap "trap_exit \"$(gettext "%s signal caught. Exiting...")\" \"$signal\"" "$signal"
+done
trap 'trap_exit "$(gettext "Aborted by user! Exiting...")"' INT
-trap 'trap_exit "$(gettext "An unknown error has occured. Exiting...")"' ERR
+trap 'trap_exit "$(gettext "An unknown error has occurred. Exiting...")"' ERR
declare -a args
success=0