43 echo "${DEBUGCACHE}" >> ${DEBUGFILE}
46 # print_info(debuglevel, print [, newline [, prefixline [, forcefile ] ] ])
55 if [ "$#" -lt '2' ] ; then return 1; fi
57 # IF 3 OR MORE ARGS, CHECK IF WE WANT A NEWLINE AFTER PRINT
68 # IF 4 OR MORE ARGS, CHECK IF WE WANT TO PREFIX WITH A *
79 # IF 5 OR MORE ARGS, CHECK IF WE WANT TO FORCE OUTPUT TO DEBUG
80 # FILE EVEN IF IT DOESN'T MEET THE MINIMUM DEBUG REQS
91 # PRINT TO SCREEN ONLY IF PASSED DEBUGLEVEL IS HIGHER THAN
92 # OR EQUAL TO SET DEBUG LEVEL
93 if [ "$1" -lt "${DEBUGLEVEL}" -o "$1" -eq "${DEBUGLEVEL}" ]
98 # RETURN IF NOT OUTPUTTING ANYWHERE
99 if [ "${SCRPRINT}" != '1' -a "${FORCEFILE}" != '1' ]
104 # STRUCTURE DATA TO BE OUTPUT TO SCREEN, AND OUTPUT IT
105 if [ "${SCRPRINT}" -eq '1' ]
107 if [ "${PREFIXLINE}" = '1' ]
109 STR="${GOOD}*${NORMAL} ${2}"
114 if [ "${NEWLINE}" = '0' ]
122 # STRUCTURE DATA TO BE OUTPUT TO FILE, AND OUTPUT IT
123 if [ "${SCRPRINT}" -eq '1' -o "${FORCEFILE}" -eq '1' ]
126 STRR=${STRR//${BAD}/}
127 STRR=${STRR//${BOLD}/}
128 STRR=${STRR//${NORMAL}/}
130 if [ "${PREFIXLINE}" = '1' ]
137 if [ "${NEWLINE}" = '0' ]
139 if [ "${TODEBUGCACHE}" -eq 1 ]; then
140 DEBUGCACHE="${DEBUGCACHE}${STR}"
142 echo -ne "${STR}" >> ${DEBUGFILE}
145 if [ "${TODEBUGCACHE}" -eq 1 ]; then
146 DEBUGCACHE="${DEBUGCACHE}${STR}"$'\n'
148 echo "${STR}" >> ${DEBUGFILE}
158 GOOD=${BAD} print_info "$@"
163 GOOD=${WARN} print_info "$@"
166 # var_replace(var_name, var_value, string)
168 # $2 = variable value
173 # Escape '\' and '.' in $2 to make it safe to use
174 # in the later sed expression
176 SAFE_VAR=`echo "${2}" | sed -e 's/\([\/\.]\)/\\\\\\1/g'`
178 echo "${3}" | sed -e "s/%%${1}%%/${SAFE_VAR}/g" -
182 var_replace "ARCH" "${ARCH}" "${1}"
186 var_replace "CACHE" "${CACHE_DIR}" "${1}"
190 [ -f "${DEBUGFILE}" ] && echo > "${DEBUGFILE}"
198 print_error 1 "ERROR: ${1}"
201 print_info 1 "-- Grepping log... --"
204 if isTrue ${USECOLOR}
206 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]?)" ${DEBUGFILE}
208 grep -B5 -E "([Ww][Aa][Rr][Nn][Ii][Nn][Gg]|[Ee][Rr][Rr][Oo][Rr][ :,!]|[Ff][Aa][Ii][Ll][Ee]?[Dd]?)" ${DEBUGFILE}
211 print_info 1 "-- End log... --"
213 print_info 1 "Please consult ${DEBUGFILE} for more information and any"
214 print_info 1 "errors that were reported above."
216 print_info 1 "Report any genkernel bugs to bugs.gentoo.org and"
217 print_info 1 "assign your bug to genkernel@gentoo.org. Please include"
218 print_info 1 "as much information as you can in your bug report; attaching"
219 print_info 1 "${DEBUGFILE} so that your issue can be dealt with effectively."
221 print_info 1 'Please do *not* report compilation failures as genkernel bugs!'
227 dmesg | egrep -q '^loop:'
228 if [ -e '/dev/loop0' -o -e '/dev/loop/0' -a ${PIPESTATUS[1]} ]
230 # We found devfs or standard dev loop device, assume
231 # loop is compiled into the kernel or the module is loaded
240 for mo in `grep ' /boot ' /proc/mounts | cut -d ' ' -f 4 | sed -e 's/,/ /'`
242 if [ "x${mo}x" == "xrox" ]