Changeset 6830

Show
Ignore:
Timestamp:
09/11/05 00:14:32 (3 years ago)
Author:
dj
Message:

removed text wrap and boot logging

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/bootscripts/CHANGELOG

    r6829 r6830  
    1 n/a - September 10, 2005 
     1n/a - September 11, 2005 
     2        * Removed text wraping and boot logging. 
    23        * Changed killproc to use warning if not running 
    34        * Changed 'print_status warning' to use old style output 
    45        * Fixed display error with LSB init-functions script 
    56        * Made above killproc/print_status changes in enhanced 
     7          bootscripts. 
     8        * Made logger service configurable in enhanced  
    69          bootscripts. (DJ Lucas) 
    710 
  • trunk/bootscripts/contrib/enhanced/init.d/functions

    r6829 r6830  
    226226                                cat >> /media/boottemp/.logcache 
    227227                else 
    228                         /bin/logger -p local2.info -t bootlog "${@}" 
     228                        /bin/logger -p "${BLSERVICE}".info -t bootlog "${@}" 
    229229                fi 
    230230        else 
  • trunk/bootscripts/contrib/enhanced/sysconfig/rc

    r6384 r6830  
    2626# End setup for interactive 
    2727 
     28# Set service for bootlogging 
     29BLSERVICE="local2" 
     30 
    2831# End /etc/sysconfig/rc 
  • trunk/bootscripts/lfs/init.d/functions

    r6829 r6830  
    6161BRACKET="\\033[1;34m"        # Brackets are blue 
    6262 
    63 ## Set screen and bootlog message values to zero 
    64 BOOTMESG=""        # text meant for the logfile 
    65 BOOTMESGPRN=""     # text meant for the console 
    66 CUR_LENGTH="0"      # the current line length 
    67 CHARS_LEFT="${WCOL}"      # avilible space on the current line 
    6863STRING_LENGTH="0"   # the length of the current message 
    69 BMSEP=""           # contains neline separated bootmessage 
    70 BMSEPCT=""         # used for character counts of each word in BMSEP 
    71 BMWORD=""          # last printed word before a newline when wrapping text 
    7264 
    7365#******************************************************************************* 
     
    8274# 
    8375# Dependencies: - sed for parsing strings. 
    84 #                     - grep, for counting \n's in a variable
     76#               - grep for counting string length
    8577#                
    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:          
    9379#******************************************************************************* 
    9480boot_mesg() 
    9581{ 
    9682        local ECHOPARM="" 
    97         ##### NOTE!!!! A single message cannot span two complete lines 
    98         ##### (longer than WCOL) or exceed 100 words. 
    9983 
    10084        while true 
     
    11599        done 
    116100 
    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}" 
    193108         
    194         # if CUR_LENGTH was set to zero, then end the line 
    195         if [ "${CUR_LENGTH}" = "0" ]; then 
    196                 echo ""  
    197         fi 
    198109} 
    199110 
    200111boot_mesg_flush() 
    201112{ 
    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 
    214114        STRING_LENGTH="0" 
    215         BMSEP="" 
    216         BMSEPCT=""       
    217         BMWORD="" 
    218115} 
    219116 
    220117boot_log() 
    221118{ 
    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 "" 
    227121} 
    228122 
     
    307201        fi 
    308202 
     203#       boot_mesg_flush 
     204#       echo_warning 
     205 
    309206        case "${1}" in 
    310207 
     
    319216                                running) 
    320217                                        echo -e -n "${CURS_UP}" 
    321                                         echo -e -n "\\033[${CUR_LENGTH}G   " 
     218                                        echo -e -n "\\033[${STRING_LENGTH}G   " 
    322219                                        boot_mesg "Already running." ${WARNING} 
    323220                                        echo_warning 
     
    325222                                not_running) 
    326223                                        echo -e -n "${CURS_UP}" 
    327                                         echo -e -n "\\033[${CUR_LENGTH}G   " 
     224                                        echo -e -n "\\033[${STRING_LENGTH}G   " 
    328225                                        boot_mesg "Not running." ${WARNING} 
    329226                                        echo_warning 
     
    331228                                not_available) 
    332229                                        echo -e -n "${CURS_UP}" 
    333                                         echo -e -n "\\033[${CUR_LENGTH}G   " 
     230                                        echo -e -n "\\033[${STRING_LENGTH}G   " 
    334231                                        boot_mesg "Not available." ${WARNING} 
    335232                                        echo_warning 
     
    674571        fi 
    675572 
     573    # Change.... 
    676574    if [ -n "${pidlist}" ]; then 
    677575        for pid in ${pidlist} 
     
    715613        fi 
    716614 
    717         evaluate_retval  
     615        evaluate_retval # This is "Probably" not LSB compliant, but required to be compatible with older bootscripts 
    718616 
    719617    else