浏览代码

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
Bruce Dubbs 10 年之前
父节点
当前提交
b7804aeaec

+ 3 - 0
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

+ 36 - 22
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                                                  #

+ 1 - 1
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

+ 6 - 5
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}

+ 5 - 0
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

+ 10 - 0
chapter01/changelog.xml

@@ -35,6 +35,16 @@
       </itemizedlist>
     </listitem>
 -->
+    <listitem>
+      <para>2015-02-22</para>
+      <itemizedlist>
+        <listitem>
+          <para>[bdubbs] - Cosmetic changes to output messages
+          by network boot scripts.</para>
+        </listitem>
+      </itemizedlist>
+    </listitem>
+
     <listitem>
       <para>2015-02-19</para>
       <itemizedlist>

+ 2 - 2
general.ent

@@ -1,7 +1,7 @@
-<!ENTITY version         "SVN-20150219">
+<!ENTITY version         "SVN-20150222">
 <!ENTITY short-version   "svn">  <!-- Used in dbus chapter, change to x.y for release 
                                       but not -rc releases -->
-<!ENTITY releasedate     "February 19, 2015">
+<!ENTITY releasedate     "February 22, 2015">
 <!ENTITY copyrightdate   "1999-2015"><!-- jhalfs needs a literal dash, not &ndash; -->
 <!ENTITY milestone       "7.7">
 <!ENTITY generic-version "development"> <!-- Use "development", "testing", or "x.y[-pre{x}]" -->

+ 1 - 1
packages.ent

@@ -352,7 +352,7 @@
 <!ENTITY less-ch6-du "3.6 MB">
 <!ENTITY less-ch6-sbu "0.1 SBU">
 
-<!ENTITY lfs-bootscripts-version "20150208">              <!-- Scripts depend on this format -->
+<!ENTITY lfs-bootscripts-version "20150222">              <!-- Scripts depend on this format -->
 <!ENTITY lfs-bootscripts-size "BOOTSCRIPTS-SIZE KB">         <!-- Updated in Makefile -->
 <!ENTITY lfs-bootscripts-url "&downloads-root;lfs-bootscripts-&lfs-bootscripts-version;.tar.bz2">
 <!ENTITY lfs-bootscripts-md5 "BOOTSCRIPTS-MD5SUM">           <!-- Updated in Makefile -->