Bump version to 3.4.41
[genkernel.git] / gen_funcs.sh
index 6af595efb91e3425ffd6c1f63131cc6725f9678f..48a338253883275dc75cd8ad39e3f1c9ff775132 100755 (executable)
@@ -22,7 +22,7 @@ isTrue() {
        return 1
 }
 
-setColorVars() { 
+setColorVars() {
 if isTrue ${USECOLOR}
 then
        GOOD=$'\e[32;01m'
@@ -144,7 +144,7 @@ print_info() {
                                DEBUGCACHE="${DEBUGCACHE}${STR}"
                        else
                                echo -ne "${STR}" >> ${LOGFILE}
-                       fi      
+                       fi
                else
                        if [ "${TODEBUGCACHE}" = '1' ]; then
                                DEBUGCACHE="${DEBUGCACHE}${STR}"$'\n'
@@ -178,7 +178,7 @@ var_replace()
   # in the later sed expression
   local SAFE_VAR
   SAFE_VAR=`echo "${2}" | sed -e 's/\([\/\.]\)/\\\\\\1/g'`
-  
+
   echo "${3}" | sed -e "s/%%${1}%%/${SAFE_VAR}/g" -
 }
 
@@ -186,10 +186,6 @@ arch_replace() {
   var_replace "ARCH" "${ARCH}" "${1}"
 }
 
-kv_replace() {
-  var_replace "KV" "${KV}" "${1}"
-}
-
 cache_replace() {
   var_replace "CACHE" "${CACHE_DIR}" "${1}"
 }
@@ -198,7 +194,7 @@ clear_log() {
     if [ -f "${LOGFILE}" ]
     then
        (echo > "${LOGFILE}") 2>/dev/null || small_die "Genkernel: Could not write to ${LOGFILE}."
-    fi   
+    fi
 }
 
 gen_die() {
@@ -208,29 +204,30 @@ gen_die() {
        then
                print_error 1 "ERROR: ${1}"
        fi
-       echo
-       print_info 1 "-- Grepping log... --"
-       echo
+       print_error 1 ''
+       print_error 1 "-- Grepping log... --"
+       print_error 1 ''
 
        if isTrue ${USECOLOR}
        then
-               GREP_COLOR='1' grep -B5 -E --colour=always "([Ww][Aa][Rr][Nn][Ii][Nn][Gg]|[Ee][Rr][Rr][Oo][Rr][ :,!]|[Ff][Aa][Ii][Ll][Ee]?[Dd]?)" ${LOGFILE}
+               GREP_COLOR='1' grep -B5 -E --colour=always "([Ww][Aa][Rr][Nn][Ii][Nn][Gg]|[Ee][Rr][Rr][Oo][Rr][ :,!]|[Ff][Aa][Ii][Ll][Ee]?[Dd]?)" ${LOGFILE} \
+                               | sed -s "s|^\(*\)\?|${BAD}*${NORMAL}|"
        else
                grep -B5 -E "([Ww][Aa][Rr][Nn][Ii][Nn][Gg]|[Ee][Rr][Rr][Oo][Rr][ :,!]|[Ff][Aa][Ii][Ll][Ee]?[Dd]?)" ${LOGFILE}
        fi
-       echo
-       print_info 1 "-- End log... --"
-       echo
-       print_info 1 "Please consult ${LOGFILE} for more information and any"
-       print_info 1 "errors that were reported above."
-       echo
-       print_info 1 "Report any genkernel bugs to bugs.gentoo.org and"
-       print_info 1 "assign your bug to genkernel@gentoo.org. Please include"
-       print_info 1 "as much information as you can in your bug report; attaching"
-       print_info 1 "${LOGFILE} so that your issue can be dealt with effectively."
-       print_info 1 ''
-       print_info 1 'Please do *not* report compilation failures as genkernel bugs!'
-       print_info 1 ''
+       print_error 1 ''
+       print_error 1 "-- End log... --"
+       print_error 1 ''
+       print_error 1 "Please consult ${LOGFILE} for more information and any"
+       print_error 1 "errors that were reported above."
+       print_error 1 ''
+       print_error 1 "Report any genkernel bugs to bugs.gentoo.org and"
+       print_error 1 "assign your bug to genkernel@gentoo.org. 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 *not* report compilation failures as genkernel bugs!'
+       print_error 1 ''
 
        # Cleanup temp dirs and caches if requested
        cleanup
@@ -261,7 +258,7 @@ fi
 
 clear_tmpdir()
 {
-if ! isTrue ${CMD_NOINSTALL}
+if isTrue ${CMD_INSTALL}
 then
        TMPDIR_CONTENTS=`ls ${TMPDIR}`
        print_info 1 "Removing tmp dir contents"
@@ -271,7 +268,7 @@ then
                rm ${TMPDIR}/${i}
        done
 fi
-}      
+}
 
 #
 # Function to copy various kernel boot image products to the boot directory,
@@ -448,7 +445,7 @@ set_config_with_override() {
        # Syntax check the function arguments.
        #
        case "$VarType" in
-               1|2)
+               BOOL|STRING)
                        ;;
                *)
                        gen_die "Illegal variable type \"$VarType\" passed to set_config_with_override()."
@@ -484,7 +481,7 @@ set_config_with_override() {
                fi
        fi
 
-       if [ "${VarType}" = "1" ]
+       if [ "${VarType}" = BOOL ]
        then
                if isTrue "${Result}"
                then
@@ -498,7 +495,7 @@ set_config_with_override() {
 }
 
 check_distfiles() {
-       for i in $BUSYBOX_SRCTAR $DEVICE_MAPPER_SRCTAR $MULTIPATH_SRCTAR $LVM_SRCTAR $DMRAID_SRCTAR $E2FSPROGS_SRCTAR $ISCSI_SRCTAR $GPG_SRCTAR
+       for i in $BUSYBOX_SRCTAR $MULTIPATH_SRCTAR $LVM_SRCTAR $DMRAID_SRCTAR $ISCSI_SRCTAR $GPG_SRCTAR
        do
                if [ ! -f "${i}" ]
                then