diff options
author | Bruce Dubbs <bdubbs@linuxfromscratch.org> | 2015-02-22 21:50:39 +0000 |
---|---|---|
committer | Bruce Dubbs <bdubbs@linuxfromscratch.org> | 2015-02-22 21:50:39 +0000 |
commit | b7804aeaec5719d68ff5672b64f2e3e11eca1c8a (patch) | |
tree | 9af2d9ea6c80474152d3954e9c9d036593ebf998 /bootscripts | |
parent | eb8b1c55439f17853b63e7c7bb2594a474f66e6f (diff) |
Cosmetic changes to output messages by network boot scripts.
git-svn-id: http://svn.linuxfromscratch.org/LFS/trunk/BOOK@10858 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689
Diffstat (limited to 'bootscripts')
-rw-r--r-- | bootscripts/ChangeLog | 3 | ||||
-rw-r--r-- | bootscripts/lfs/lib/services/init-functions | 58 | ||||
-rwxr-xr-x | bootscripts/lfs/lib/services/ipv4-static | 2 | ||||
-rwxr-xr-x | bootscripts/lfs/sbin/ifup | 11 | ||||
-rw-r--r-- | bootscripts/lfs/sysconfig/rc.site | 5 |
5 files changed, 51 insertions, 28 deletions
diff --git a/bootscripts/ChangeLog b/bootscripts/ChangeLog index df4087927..9600652ad 100644 --- a/bootscripts/ChangeLog +++ b/bootscripts/ChangeLog @@ -1,3 +1,6 @@ +2015-02-22 Bruce Dubbs <bdubbs@linuxfromscratch.org> + * Cosmetic changes to network scripts' output + 2015-02-08 Bruce Dubbs <bdubbs@linuxfromscratch.org> * Modify ipv4-static to support ethernet labels * Output a newline if an interface is skipped during boot diff --git a/bootscripts/lfs/lib/services/init-functions b/bootscripts/lfs/lib/services/init-functions index a09f6188b..87f0bc6bb 100644 --- a/bootscripts/lfs/lib/services/init-functions +++ b/bootscripts/lfs/lib/services/init-functions @@ -23,28 +23,6 @@ umask 022 export PATH="/bin:/usr/bin:/sbin:/usr/sbin" -## Screen Dimensions -# Find current screen size -if [ -z "${COLUMNS}" ]; then - COLUMNS=$(stty size) - COLUMNS=${COLUMNS##* } -fi - -# When using remote connections, such as a serial port, stty size returns 0 -if [ "${COLUMNS}" = "0" ]; then - COLUMNS=80 -fi - -## Measurements for positioning result messages -COL=$((${COLUMNS} - 8)) -WCOL=$((${COL} - 2)) - -## Set Cursor Position Commands, used via echo -SET_COL="\\033[${COL}G" # at the $COL char -SET_WCOL="\\033[${WCOL}G" # at the $WCOL char -CURS_UP="\\033[1A\\033[0G" # Up one line, at the 0'th char -CURS_ZERO="\\033[0G" - ## Set color commands, used via echo # Please consult `man console_codes for more information # under the "ECMA-48 Set Graphics Rendition" section @@ -66,10 +44,12 @@ BMPREFIX=" " SUCCESS_PREFIX="${SUCCESS} * ${NORMAL}" FAILURE_PREFIX="${FAILURE}*****${NORMAL}" WARNING_PREFIX="${WARNING} *** ${NORMAL}" +SKIP_PREFIX="${INFO} S ${NORMAL}" SUCCESS_SUFFIX="${BRACKET}[${SUCCESS} OK ${BRACKET}]${NORMAL}" FAILURE_SUFFIX="${BRACKET}[${FAILURE} FAIL ${BRACKET}]${NORMAL}" WARNING_SUFFIX="${BRACKET}[${WARNING} WARN ${BRACKET}]${NORMAL}" +SKIP_SUFFIX="${BRACKET}[${INFO} SKIP ${BRACKET}]${NORMAL}" BOOTLOG=/run/bootlog KILLDELAY=3 @@ -77,6 +57,28 @@ KILLDELAY=3 # Set any user specified environment variables e.g. HEADLESS [ -r /etc/sysconfig/rc.site ] && . /etc/sysconfig/rc.site +## Screen Dimensions +# Find current screen size +if [ -z "${COLUMNS}" ]; then + COLUMNS=$(stty size) + COLUMNS=${COLUMNS##* } +fi + +# When using remote connections, such as a serial port, stty size returns 0 +if [ "${COLUMNS}" = "0" ]; then + COLUMNS=80 +fi + +## Measurements for positioning result messages +COL=$((${COLUMNS} - 8)) +WCOL=$((${COL} - 2)) + +## Set Cursor Position Commands, used via echo +SET_COL="\\033[${COL}G" # at the $COL char +SET_WCOL="\\033[${WCOL}G" # at the $WCOL char +CURS_UP="\\033[1A\\033[0G" # Up one line, at the 0'th char +CURS_ZERO="\\033[0G" + ################################################################################ # start_daemon() # # Usage: start_daemon [-f] [-n nicelevel] [-p pidfile] pathname [args...] # @@ -645,6 +647,18 @@ log_warning_msg() return 0 } +log_skip_msg() +{ + /bin/echo -n -e "${BMPREFIX}${@}" + /bin/echo -e "${CURS_ZERO}${SKIP_PREFIX}${SET_COL}${SKIP_SUFFIX}" + + # Strip non-printable characters from log file + logmessage=`echo "${@}" | sed 's/\\\033[^a-zA-Z]*.//g'` + /bin/echo "SKIP" >> ${BOOTLOG} + + return 0 +} + ################################################################################ # log_info_msg() # # Usage: log_info_msg message # diff --git a/bootscripts/lfs/lib/services/ipv4-static b/bootscripts/lfs/lib/services/ipv4-static index 33fe4c21b..4ac7f3e45 100755 --- a/bootscripts/lfs/lib/services/ipv4-static +++ b/bootscripts/lfs/lib/services/ipv4-static @@ -48,7 +48,7 @@ case "${2}" in up) if [ "$(ip addr show ${1} 2>/dev/null | grep ${IP}/)" = "" ]; then - # Cosmetic output not needed for multiple services + # Cosmetic output if ! $(echo ${SERVICE} | grep -q " "); then log_info_msg2 "\n" # Terminate the previous message fi diff --git a/bootscripts/lfs/sbin/ifup b/bootscripts/lfs/sbin/ifup index 317223b0b..a7e1138e8 100755 --- a/bootscripts/lfs/sbin/ifup +++ b/bootscripts/lfs/sbin/ifup @@ -8,7 +8,7 @@ # Kevin P. Fleming - kpfleming@linuxfromscratch.org # Update : Bruce Dubbs - bdubbs@linuxfromscratch.org # -# Version : LFS 7.2 +# Version : LFS 7.7 # # Notes : The IFCONFIG variable is passed to the SERVICE script # in the /lib/services directory, to indicate what file the @@ -33,7 +33,7 @@ up() fi } -RELEASE="7.2" +RELEASE="7.7" USAGE="Usage: $0 [ -hV ] [--help] [--version] interface" VERSTR="LFS ifup, version ${RELEASE}" @@ -89,8 +89,7 @@ fi # Do not process this service if started by boot, and ONBOOT # is not set to yes if [ "${IN_BOOT}" = "1" -a "${ONBOOT}" != "yes" ]; then - log_info_msg2 "skipped" - echo + log_skip_msg exit 0 fi @@ -104,6 +103,8 @@ for S in ${SERVICE}; do fi done +if [ "${SERVICE}" = "wpa" ]; then log_success_msg; fi + # Create/configure the interface for S in ${SERVICE}; do IFCONFIG=${file} /lib/services/${S} ${IFACE} up @@ -126,7 +127,7 @@ fi # Set the route default gateway if requested if [ -n "${GATEWAY}" ]; then if ip route | grep -q default; then - log_warning_msg "\nGateway already setup; skipping." + log_skip_msg "\n Gateway already setup; skipping." else log_info_msg "Setting up default gateway..." ip route add default via ${GATEWAY} dev ${IFACE} diff --git a/bootscripts/lfs/sysconfig/rc.site b/bootscripts/lfs/sysconfig/rc.site index b0a124d71..9b501e542 100644 --- a/bootscripts/lfs/sysconfig/rc.site +++ b/bootscripts/lfs/sysconfig/rc.site @@ -32,6 +32,11 @@ #FAILURE_PREFIX="${FAILURE}*****${NORMAL}" #WARNING_PREFIX="${WARNING} *** ${NORMAL}" +# Manually seet the right edge of message output (characters) +# Useful when resetting console font during boot to override +# automatic screen width detection +#COLUMNS=120 + # Interactive startup #IPROMPT="yes" # Whether to display the interactive boot prompt #itime="3" # The amount of time (in seconds) to display the prompt |