commit: 9595cfa3498003ca3d5f53aade101f271b3dca24
Author: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
AuthorDate: Fri Jul 26 16:12:01 2019 +0000
Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
CommitDate: Fri Jul 26 16:13:41 2019 +0000
URL: https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=9595cfa3
gen_funcs.sh: gen_die(): Just trigger trap function when died in subshell
This will ensure that only one function will call cleanup().
Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>
gen_funcs.sh | 37 +++++++++++++++++++++----------------
1 file changed, 21 insertions(+), 16 deletions(-)
diff --git a/gen_funcs.sh b/gen_funcs.sh
index 94bf550..97a85dd 100755
--- a/gen_funcs.sh
+++ b/gen_funcs.sh
@@ -282,26 +282,31 @@ gen_die() {
print_error 1 "ERROR: ${1}"
fi
- # Don't trust $LOGFILE before determine_real_args() was called
- if [ -n "${CMD_LOGFILE}" -a -s "${LOGFILE}" ]
+ if [[ -n "${GK_MASTER_PID}" && ${BASHPID} != ${GK_MASTER_PID} ]]
then
- print_error 1 "Please consult '${LOGFILE}' for more information
and any"
- print_error 1 "errors that were reported above."
- print_error 1 ''
- fi
+ # We died in a subshell! Let's trigger trap function...
+ kill -s SIGTERM ${GK_MASTER_PID}
+ else
+ # Don't trust $LOGFILE before determine_real_args() was called
+ if [ -n "${CMD_LOGFILE}" -a -s "${LOGFILE}" ]
+ then
+ print_error 1 "Please consult '${LOGFILE}' for more
information and any"
+ print_error 1 "errors that were reported above."
+ print_error 1 ''
+ fi
- print_error 1 "Report any genkernel bugs to bugs.gentoo.org and"
- print_error 1 "assign your bug to [email protected]. Please include"
- print_error 1 "as much information as you can in your bug report;
attaching"
- print_error 1 "'${LOGFILE}' so that your issue can be dealt with
effectively."
- print_error 1 ''
- print_error 1 "Please do ${BOLD}*not*${NORMAL} report
${BOLD}kernel${NORMAL} compilation failures as genkernel bugs!"
- print_error 1 ''
+ print_error 1 "Report any genkernel bugs to bugs.gentoo.org and"
+ print_error 1 "assign your bug to [email protected]. Please
include"
+ print_error 1 "as much information as you can in your bug
report; attaching"
+ print_error 1 "'${LOGFILE}' so that your issue can be dealt
with effectively."
+ print_error 1 ''
+ print_error 1 "Please do ${BOLD}*not*${NORMAL} report
${BOLD}kernel${NORMAL} compilation failures as genkernel bugs!"
+ print_error 1 ''
- # Cleanup temp dirs and caches if requested
- cleanup
+ # Cleanup temp dirs and caches if requested
+ cleanup
+ fi
- [[ -n "${GK_MASTER_PID}" && ${BASHPID} != ${GK_MASTER_PID} ]] && kill
-s SIGTERM ${GK_MASTER_PID}
exit 1
}