commit: e04895cd0c01e2b39e33dabf1b42e51bc50cc9c4
Author: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
AuthorDate: Mon Jul 15 14:17:48 2019 +0000
Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
CommitDate: Mon Jul 15 14:21:44 2019 +0000
URL: https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=e04895cd
gen_funcs.sh: trap_cleanup(): Log received signal
Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>
gen_funcs.sh | 21 +++++++++++++++++++--
1 file changed, 19 insertions(+), 2 deletions(-)
diff --git a/gen_funcs.sh b/gen_funcs.sh
index 4136122..caae87b 100755
--- a/gen_funcs.sh
+++ b/gen_funcs.sh
@@ -1041,8 +1041,21 @@ trap_cleanup() {
exec &> /dev/tty
fi
+ local signal_msg=
+ if [ -n "${GK_TRAP_SIGNAL}" ]
+ then
+ case "${GK_TRAP_SIGNAL}" in
+ SIGABRT|SIGHUP|SIGQUIT|SIGINT|SIGTERM)
+ signal_msg=" (signal ${GK_TRAP_SIGNAL}
received)"
+ ;;
+ *)
+ signal_msg=" (unknown signal ${GK_TRAP_SIGNAL}
received)"
+ ;;
+ esac
+ fi
+
echo ''
- print_error 1 "Genkernel was unexpectedly terminated."
+ print_error 1 "Genkernel was unexpectedly terminated${signal_msg}."
print_error 1 "Please consult '${LOGFILE}' for more information and any"
print_error 1 "errors that were reported above."
cleanup
@@ -1236,7 +1249,11 @@ unpack() {
}
set_default_gk_trap() {
- trap trap_cleanup SIGABRT SIGHUP SIGQUIT SIGINT SIGTERM
+ local signal
+ for signal in SIGABRT SIGHUP SIGQUIT SIGINT SIGTERM
+ do
+ trap "GK_TRAP_SIGNAL=${signal}; trap_cleanup" ${signal}
+ done
}
#