Bug #57297 fix.
authorTim Yamin <plasmaroo@gentoo.org>
Fri, 16 Jul 2004 22:52:06 +0000 (22:52 +0000)
committerTim Yamin <plasmaroo@gentoo.org>
Fri, 16 Jul 2004 22:52:06 +0000 (22:52 +0000)
git-svn-id: svn+ssh://svn.gentoo.org/var/svnroot/genkernel/trunk@114 67a159dc-881f-0410-a524-ba9dfbe2cb84

gen_cmdline.sh
gen_funcs.sh
genkernel

index 67863032e51425364296826e98057acf38d4f0c9..54cc8b3c83d305263b0fa475b6df2839aa0580ba 100755 (executable)
@@ -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 "$*"`
index 74ae3d79197337dee1a1a7458132aa7681fd4077..9a49b0126f7a080fc6a550bb15af37eca224a2e5 100755 (executable)
@@ -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}"
index 3cc1b06b3fedd5c5ee6dd3aa2842ff75e6a2e737..0e196d0e4c086ff41158a1162ed425fd4b52bd85 100755 (executable)
--- 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