Changeset 6830
- Timestamp:
- 09/11/05 00:14:32 (3 years ago)
- Files:
-
- trunk/bootscripts/CHANGELOG (modified) (1 diff)
- trunk/bootscripts/contrib/enhanced/init.d/functions (modified) (1 diff)
- trunk/bootscripts/contrib/enhanced/sysconfig/rc (modified) (1 diff)
- trunk/bootscripts/lfs/init.d/functions (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/bootscripts/CHANGELOG
r6829 r6830 1 n/a - September 10, 2005 1 n/a - September 11, 2005 2 * Removed text wraping and boot logging. 2 3 * Changed killproc to use warning if not running 3 4 * Changed 'print_status warning' to use old style output 4 5 * Fixed display error with LSB init-functions script 5 6 * Made above killproc/print_status changes in enhanced 7 bootscripts. 8 * Made logger service configurable in enhanced 6 9 bootscripts. (DJ Lucas) 7 10 trunk/bootscripts/contrib/enhanced/init.d/functions
r6829 r6830 226 226 cat >> /media/boottemp/.logcache 227 227 else 228 /bin/logger -p local2.info -t bootlog "${@}"228 /bin/logger -p "${BLSERVICE}".info -t bootlog "${@}" 229 229 fi 230 230 else trunk/bootscripts/contrib/enhanced/sysconfig/rc
r6384 r6830 26 26 # End setup for interactive 27 27 28 # Set service for bootlogging 29 BLSERVICE="local2" 30 28 31 # End /etc/sysconfig/rc trunk/bootscripts/lfs/init.d/functions
r6829 r6830 61 61 BRACKET="\\033[1;34m" # Brackets are blue 62 62 63 ## Set screen and bootlog message values to zero64 BOOTMESG="" # text meant for the logfile65 BOOTMESGPRN="" # text meant for the console66 CUR_LENGTH="0" # the current line length67 CHARS_LEFT="${WCOL}" # avilible space on the current line68 63 STRING_LENGTH="0" # the length of the current message 69 BMSEP="" # contains neline separated bootmessage70 BMSEPCT="" # used for character counts of each word in BMSEP71 BMWORD="" # last printed word before a newline when wrapping text72 64 73 65 #******************************************************************************* … … 82 74 # 83 75 # Dependencies: - sed for parsing strings. 84 # - grep, for counting \n's in a variable.76 # - grep for counting string length. 85 77 # 86 # Todo: - This function was created for the purpose of storing 87 # information to be passed to a bootup log and for better 88 # formatting of text sent to the screen. The logging support 89 # now pushes messages to the local2 service which is now 90 # configured by LFS default in syslog.conf. This also 91 # requires that /usr/bin/logger be moved to /bin. 92 # Support for parallel bootscripts is not added *yet*... 78 # Todo: 93 79 #******************************************************************************* 94 80 boot_mesg() 95 81 { 96 82 local ECHOPARM="" 97 ##### NOTE!!!! A single message cannot span two complete lines98 ##### (longer than WCOL) or exceed 100 words.99 83 100 84 while true … … 115 99 done 116 100 117 ## Figure out the length of what is to be printed. 118 # This is effectivly eqivelent to wc -m. 119 STRING_LENGTH="$(( `echo "${1}" | sed \ 120 -e 's,.,.,g' -e 'l 1' | grep -c \$` - 2 ))" 121 122 # Append to BOOTMESG for logging 123 BOOTMESG="${BOOTMESG} ${1}" 124 125 # Find out how much room is left to work with 126 CHARS_LEFT="$(( ${WCOL} - ${CUR_LENGTH} ))" 127 128 # If the message doesn't exceed the remaining columns 129 # of the current line, just print it... 130 if [ "${STRING_LENGTH}" -le "${CHARS_LEFT}" ]; then 131 CUR_LENGTH="$(( ${CUR_LENGTH} + ${STRING_LENGTH} ))" 132 BOOTMESGPRN="${1}" 133 134 # Avoid a null value being passed to sed 135 if [ "${STRING_LENGTH}" -eq "${CHARS_LEFT}" ]; then 136 # set CUR_LENGTH to zero 137 CUR_LENGTH="0" 138 fi 139 140 else 141 142 ## Do some adjustments to the output because it 143 ## it is too long to fit on one line 144 145 # BMSEP is the boot message with each word 146 # on one line of it's own 147 BMSEP=`echo "${1}" | sed 's/ /\\\n/g'` 148 149 # To work proerly with unicode, each character 150 # is replaced with a single dot (.) for counting. 151 ### Note that this is still broken for Chinese, 152 ### Japanese, and Korean because of characters 153 ### that actually use two columns when printed 154 ### to the screen. 155 BMSEPCT=`echo -e "${BMSEP}" | sed 's/././g'` 156 157 # keep adding the character count of each line 158 # untill the count exceeds the value of CHARS_LEFT 159 # There is a ceiling of 100 words! 160 n="1" 161 while [ "${n}" -lt "100" ]; do 162 char_count="$(( `echo -e "${BMSEPCT}" | \ 163 sed -n "${n}"'~0p' | sed 'l 1' | \ 164 grep -c \$` - 2 ))" 165 if [ "$(( ${CUR_LENGTH} + ${char_count} ))" \ 166 -lt "${WCOL}" ]; then 167 let n++ 168 CUR_LENGTH="$(( ${CUR_LENGTH} + ${char_count} + 1 ))" 169 else 170 let n-- 171 break; 172 fi 173 done 174 175 # The number of words that will fit is now 176 # represented by 'n'. Find the nth word. 177 BMWORD="$( echo -e "${BMSEP}" | sed -n "${n}"'~0p' )" 178 179 # Get rid of the extra space 180 BMWORD="${BMWORD} " 181 182 # And format the message as needed. 183 BOOTMESGPRN=`echo "${1}" | \ 184 sed "s/${BMWORD}/${BMWORD}\\\n/"` 185 186 # Now, determine the length of the second line 187 CUR_LENGTH=$(( `echo -e "${BOOTMESGPRN}" | sed -n '2~0p' | \ 188 sed -e 's,.,.,g' -e 'l 1' | grep -c \$` - 2 )) 189 fi 190 191 # Print the results to the screen 192 echo ${ECHOPARM} -e "${2}${BOOTMESGPRN}" 101 ## Figure out the length of what is to be printed to be used 102 ## for warning messges. 103 STRING_LENGTH="`echo "${1}" | sed \ 104 -e 's,.,.,g' -e 'l 1' | grep -c \$`" 105 106 # Print the message to the screen 107 echo ${ECHOPARM} -e "${2}${1}" 193 108 194 # if CUR_LENGTH was set to zero, then end the line195 if [ "${CUR_LENGTH}" = "0" ]; then196 echo ""197 fi198 109 } 199 110 200 111 boot_mesg_flush() 201 112 { 202 # Do not log null messages 203 if [ -z "${BOOTMESG}" ]; then 204 return 0 205 else 206 boot_log "${BOOTMESG}${@}" 207 fi 208 209 # Reset boot message buffers to keep from bleeding over again 210 BOOTMESG="" 211 BOOTMESGPRN="" 212 CUR_LENGTH="0" 213 CHARS_LEFT="${WCOL}" 113 # Reset STRING_LENGTH for next message 214 114 STRING_LENGTH="0" 215 BMSEP=""216 BMSEPCT=""217 BMWORD=""218 115 } 219 116 220 117 boot_log() 221 118 { 222 if [ -f /bin/logger ]; then 223 /bin/logger -p local2.info -t bootlog "${@}" 224 else 225 return 0 226 fi 119 # Left in for backwards compatibility 120 echo -n "" 227 121 } 228 122 … … 307 201 fi 308 202 203 # boot_mesg_flush 204 # echo_warning 205 309 206 case "${1}" in 310 207 … … 319 216 running) 320 217 echo -e -n "${CURS_UP}" 321 echo -e -n "\\033[${ CUR_LENGTH}G "218 echo -e -n "\\033[${STRING_LENGTH}G " 322 219 boot_mesg "Already running." ${WARNING} 323 220 echo_warning … … 325 222 not_running) 326 223 echo -e -n "${CURS_UP}" 327 echo -e -n "\\033[${ CUR_LENGTH}G "224 echo -e -n "\\033[${STRING_LENGTH}G " 328 225 boot_mesg "Not running." ${WARNING} 329 226 echo_warning … … 331 228 not_available) 332 229 echo -e -n "${CURS_UP}" 333 echo -e -n "\\033[${ CUR_LENGTH}G "230 echo -e -n "\\033[${STRING_LENGTH}G " 334 231 boot_mesg "Not available." ${WARNING} 335 232 echo_warning … … 674 571 fi 675 572 573 # Change.... 676 574 if [ -n "${pidlist}" ]; then 677 575 for pid in ${pidlist} … … 715 613 fi 716 614 717 evaluate_retval 615 evaluate_retval # This is "Probably" not LSB compliant, but required to be compatible with older bootscripts 718 616 719 617 else
