From: Tim Yamin Date: Fri, 16 Jul 2004 22:52:06 +0000 (+0000) Subject: Bug #57297 fix. X-Git-Tag: v3.4.10.902~638 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=e0af9e201dc09c4f896c25762efeb764890373e2;p=genkernel.git Bug #57297 fix. git-svn-id: svn+ssh://svn.gentoo.org/var/svnroot/genkernel/trunk@114 67a159dc-881f-0410-a524-ba9dfbe2cb84 --- diff --git a/gen_cmdline.sh b/gen_cmdline.sh index 6786303..54cc8b3 100755 --- a/gen_cmdline.sh +++ b/gen_cmdline.sh @@ -228,7 +228,9 @@ parse_cmdline() { ;; --debugfile*) CMD_DEBUGFILE=`parse_opt "$*"` + DEBUGFILE=`parse_opt "$*"` print_info 2 "CMD_DEBUGFILE: $CMD_DEBUGFILE" + print_info 2 "DEBUGFILE: $CMD_DEBUGFILE" ;; --kerneldir*) CMD_KERNELDIR=`parse_opt "$*"` diff --git a/gen_funcs.sh b/gen_funcs.sh index 74ae3d7..9a49b01 100755 --- a/gen_funcs.sh +++ b/gen_funcs.sh @@ -38,6 +38,11 @@ else UNDER='' fi +dump_debugcache() { + TODEBUGCACHE=0 + echo "${DEBUGCACHE}" >> ${DEBUGFILE} +} + # print_info(debuglevel, print [, newline [, prefixline [, forcefile ] ] ]) print_info() { local NEWLINE=1 @@ -131,9 +136,17 @@ print_info() { if [ "${NEWLINE}" = '0' ] then - echo -ne "${STR}" >> ${DEBUGFILE} + if [ "${TODEBUGCACHE}" -eq 1 ]; then + DEBUGCACHE="${DEBUGCACHE}${STR}" + else + echo -ne "${STR}" >> ${DEBUGFILE} + fi else - echo "${STR}" >> ${DEBUGFILE} + if [ "${TODEBUGCACHE}" -eq 1 ]; then + DEBUGCACHE="${DEBUGCACHE}${STR}"$'\n' + else + echo "${STR}" >> ${DEBUGFILE} + fi fi fi @@ -165,11 +178,12 @@ arch_replace() { } clear_log() { - rm -f ${DEBUGFILE} - touch ${DEBUGFILE} + [ -f "${DEBUGFILE}" ] && echo > "${DEBUGFILE}" } gen_die() { + dump_debugcache + if [ "$#" -gt '0' ] then print_error 1 "ERROR: ${1}" diff --git a/genkernel b/genkernel index 3cc1b06..0e196d0 100755 --- a/genkernel +++ b/genkernel @@ -3,6 +3,7 @@ GK_V='3.0.2d' TEMP='/var/tmp/genkernel' +TODEBUGCACHE=1 # Until an error occurs or DEBUGFILE is fully qualified. small_die() { echo $1 @@ -11,7 +12,6 @@ small_die() { source /etc/genkernel.conf || small_die "Could not read /etc/genkernel.conf" source ${GK_BIN}/gen_funcs.sh || small_die "Could not read ${GK_BIN}/gen_funcs.sh" -clear_log source ${GK_BIN}/gen_cmdline.sh || gen_die "Could not read ${GK_BIN}/gen_cmdline.sh" source ${GK_BIN}/gen_arch.sh || gen_die "Could not read ${GK_BIN}/gen_arch.sh" source ${GK_BIN}/gen_determineargs.sh || gen_die "Could not read ${GK_BIN}/gen_determineargs.sh" @@ -38,6 +38,7 @@ then exit 1 fi +clear_log NORMAL=${GOOD} print_info 1 "Gentoo Linux Genkernel; Version ${GK_V}${NORMAL}" # Set ${ARCH} @@ -51,7 +52,9 @@ source ${GK_SHARE}/${ARCH}/modules_load || gen_die "Could not read ${GK_SHARE}/$ # Based on genkernel.conf, arch-specific configs, and commandline options, # get the real arguments for usage... + determine_real_args +dump_debugcache NORMAL=${BOLD} print_info 1 "Compiling Linux Kernel ${BOLD}${KV}${NORMAL} for ${BOLD}${ARCH}${NORMAL}..." echo