diff options
Diffstat (limited to 'scripts/makepkg.sh.in')
-rw-r--r-- | scripts/makepkg.sh.in | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 04ca2a5b..89cd118d 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -118,12 +118,17 @@ error() { # the fakeroot call, the error message will be printed by the main call. ## trap_exit() { + local signal=$1; shift + if (( ! INFAKEROOT )); then echo error "$@" fi [[ -n $srclinks ]] && rm -rf "$srclinks" - exit 1 + + # unset the trap for this signal, and then call the default handler + trap -- "$signal" + kill "-$signal" "$$" } @@ -1071,7 +1076,7 @@ find_libdepends() { for sofile in $(LC_ALL=C readelf -d "$filename" 2>/dev/null | sed -nr 's/.*Shared library: \[(.*)\].*/\1/p') do # extract the library name: libfoo.so - soname="${sofile%%\.so\.*}.so" + soname="${sofile%.so?(+(.+([0-9])))}".so # extract the major version: 1 soversion="${sofile##*\.so\.}" if in_array "${soname}" ${depends[@]}; then @@ -1189,7 +1194,8 @@ write_pkginfo() { if [[ $it = *.so ]]; then # check if the entry has been found by find_libdepends # if not, it's unneeded; tell the user so he can remove it - if [[ ! $libdepends =~ (^|\s)${it}=.* ]]; then + printf -v re '(^|\s)%s=.*' "$it" + if [[ ! $libdepends =~ $re ]]; then error "$(gettext "Cannot find library listed in %s: %s")" "'depends'" "$it" return 1 fi @@ -1983,10 +1989,10 @@ done # setup signal traps trap 'clean_up' 0 for signal in TERM HUP QUIT; do - trap "trap_exit \"$(gettext "%s signal caught. Exiting...")\" \"$signal\"" "$signal" + trap "trap_exit $signal \"$(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 +trap 'trap_exit INT "$(gettext "Aborted by user! Exiting...")"' INT +trap 'trap_exit USR1 "$(gettext "An unknown error has occurred. Exiting...")"' ERR set -E # preserve environment variables and canonicalize path |