Author: bdubbs
Date: 2012-04-09 13:14:33 -0600 (Mon, 09 Apr 2012)
New Revision: 9807

Modified:
   trunk/BOOK/bootscripts/lfs/lib/services/init-functions
   trunk/BOOK/bootscripts/lfs/lib/services/ipv4-static
   trunk/BOOK/bootscripts/lfs/sbin/ifdown
   trunk/BOOK/bootscripts/lfs/sbin/ifup
   trunk/BOOK/bootscripts/lfs/sbin/ifup.8
   trunk/BOOK/chapter01/changelog.xml
   trunk/BOOK/chapter06/automake.xml
   trunk/BOOK/chapter06/gcc.xml
   trunk/BOOK/chapter07/network.xml
   trunk/BOOK/general.ent
   trunk/BOOK/packages.ent
Log:
Update networking bootscripts.  See bootscripts change log for details.



Modified: trunk/BOOK/bootscripts/lfs/lib/services/init-functions
===================================================================
--- trunk/BOOK/bootscripts/lfs/lib/services/init-functions      2012-04-05 
04:15:08 UTC (rev 9806)
+++ trunk/BOOK/bootscripts/lfs/lib/services/init-functions      2012-04-09 
19:14:33 UTC (rev 9807)
@@ -778,4 +778,16 @@
    return 0
 }
 
+################################################################################
+# is_true()                                                                    
#
+#                                                                              
#
+# Purpose: Utility to test if a variable is true | yes | 1                     
#
+#                                                                              
#
+################################################################################
+is_true()
+{
+   [ "$1" = "1" ] || [ "$1" = "yes" ] || [ "$1" = "true" ] ||  [ "$1" = "y" ] 
||
+   [ "$1" = "t" ]
+}
+
 # End /lib/lsb/init-functions

Modified: trunk/BOOK/bootscripts/lfs/lib/services/ipv4-static
===================================================================
--- trunk/BOOK/bootscripts/lfs/lib/services/ipv4-static 2012-04-05 04:15:08 UTC 
(rev 9806)
+++ trunk/BOOK/bootscripts/lfs/lib/services/ipv4-static 2012-04-09 19:14:33 UTC 
(rev 9807)
@@ -52,19 +52,8 @@
          log_info_msg "Adding IPv4 address ${IP} to the ${1} interface..."
          ip addr add ${args} dev ${1}
          evaluate_retval
-
-         if [ -n "${GATEWAY}" ]; then
-            if ip route | grep -q default; then
-               log_warning_msg "\nGateway already setup; skipping."
-            else
-               log_info_msg "Setting up default gateway..."
-               ip route add default via ${GATEWAY} dev ${1}
-               evaluate_retval
-             fi
-         fi
       else
-         msg="Cannot add IPv4 address ${IP} to ${1}.  Already present."
-         log_warning_msg "$msg"
+         log_warning_msg "Cannot add IPv4 address ${IP} to ${1}.  Already 
present."
       fi
    ;;
 

Modified: trunk/BOOK/bootscripts/lfs/sbin/ifdown
===================================================================
--- trunk/BOOK/bootscripts/lfs/sbin/ifdown      2012-04-05 04:15:08 UTC (rev 
9806)
+++ trunk/BOOK/bootscripts/lfs/sbin/ifdown      2012-04-09 19:14:33 UTC (rev 
9807)
@@ -1,4 +1,4 @@
-#!/bin/sh 
+#!/bin/bash 
 ########################################################################
 # Begin /sbin/ifdown
 #
@@ -67,33 +67,28 @@
    exit 1
 fi
 
-# Reverse the order
-SERVICES=
-for S in ${SERVICE}; do SERVICES="${SERVICES} ${S}"; done
+# We only need to first service to bring down the interface
+S=`echo ${SERVICE} | cut -f1 -d" "`
 
-# This will run the service scripts
 if ip link show ${IFACE} > /dev/null 2>&1; then
-   for S in ${SERVICES}; do
-
-     if [ -n "${S}" -a -x "/lib/services/${S}" ]; then
-       IFCONFIG=${file} /lib/services/${S} ${IFACE} down
-     else
-       MSG="Unable to process ${file}.  Either "
-       MSG="${MSG}the SERVICE variable was not set "
-       MSG="${MSG}or the specified service cannot be executed."
-       log_failure_msg "$MSG"
-       exit 1
-    fi
-  done
+   if [ -n "${S}" -a -x "/lib/services/${S}" ]; then
+     IFCONFIG=${file} /lib/services/${S} ${IFACE} down
+   else
+     MSG="Unable to process ${file}.  Either "
+     MSG="${MSG}the SERVICE variable was not set "
+     MSG="${MSG}or the specified service cannot be executed."
+     log_failure_msg "$MSG"
+     exit 1
+  fi
 else
    log_warning_msg "Interface ${1} doesn't exist."
 fi
 
+# Leave the interface up if there are additional interfaces in the device
 link_status=`ip link show ${IFACE} 2>/dev/null`
 
 if [ -n "${link_status}" ]; then
    if [ "$(echo "${link_status}" | grep UP)" != "" ]; then
-      # Set the interface down only if all IP addresses have been removed.
       if [ "$(ip addr show ${IFACE} | grep 'inet ')" == ""  ]; then
          log_info_msg "Bringing down the ${IFACE} interface..."
          ip link set ${IFACE} down

Modified: trunk/BOOK/bootscripts/lfs/sbin/ifup
===================================================================
--- trunk/BOOK/bootscripts/lfs/sbin/ifup        2012-04-05 04:15:08 UTC (rev 
9806)
+++ trunk/BOOK/bootscripts/lfs/sbin/ifup        2012-04-09 19:14:33 UTC (rev 
9807)
@@ -8,7 +8,7 @@
 #               Kevin P. Fleming - [email protected]
 # Update      : Bruce Dubbs - [email protected]
 #
-# Version     : LFS 7.0
+# Version     : LFS 7.2
 #
 # Notes       : The IFCONFIG variable is passed to the SERVICE script
 #               in the /lib/services directory, to indicate what file the
@@ -16,8 +16,25 @@
 #
 ########################################################################
 
-RELEASE="7.0"
+up()
+{
+  if ip link show $1 > /dev/null 2>&1; then
+     link_status=`ip link show $1`
 
+     if [ -n "${link_status}" ]; then
+        if ! echo "${link_status}" | grep -q UP; then
+           ip link set $1 up
+        fi
+     fi
+
+  else
+     log_failure_msg "\nInterface ${IFACE} doesn't exist."
+     exit 1
+  fi
+}
+
+RELEASE="7.2"
+
 USAGE="Usage: $0 [ -hV ] [--help] [--version] interface"
 VERSTR="LFS ifup, version ${RELEASE}"
 
@@ -78,7 +95,7 @@
 
 for S in ${SERVICE}; do
   if [ ! -x "/lib/services/${S}" ]; then
-    MSG="\n     Unable to process ${file}.  Either " 
+    MSG="\nUnable to process ${file}.  Either " 
     MSG="${MSG}the SERVICE '${S} was not present "
     MSG="${MSG}or cannot be executed."
     log_failure_msg "$MSG"
@@ -86,38 +103,34 @@
   fi
 done
 
-if [ -z "${CHECK_LINK}"         -o \
-        "${CHECK_LINK}" = "y"   -o \
-        "${CHECK_LINK}" = "yes" -o \
-        "${CHECK_LINK}" = "1" ]; then
+# Create/configure the interface
+for S in ${SERVICE}; do 
+  IFCONFIG=${file} /lib/services/${S} ${IFACE} up
+done
 
-   #  Bring up the interface
-   if ip link show ${IFACE} > /dev/null 2>&1; then
-      link_status=`ip link show ${IFACE}`
+# Bring up the interface and any components
+for I in $IFACE $INTERFACE_COMPONENTS; do up $I; done
 
-      if [ -n "${link_status}" ]; then
-         if ! echo "${link_status}" | grep -q UP; then
-            ip link set ${IFACE} up
-         fi
-      fi
-
-   else
-      log_failure_msg2 "Interface ${IFACE} doesn't exist."
-      exit 1
-   fi
-fi
-
 # Set MTU if requested. Check if MTU has a "good" value.
 if test -n "${MTU}"; then
    if [[ ${MTU} =~ ^[0-9]+$ ]] && [[ $MTU -ge 68 ]] ; then
-      ip link set dev ${IFACE} mtu $MTU
+      for I in $IFACE $INTERFACE_COMPONENTS; do 
+         ip link set dev $I mtu $MTU; 
+      done
    else
       log_info_msg2 "Invalid MTU $MTU"
    fi
 fi 
 
-for S in ${SERVICE}; do 
-  IFCONFIG=${file} /lib/services/${S} ${IFACE} up
-done
+# 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."
+   else
+      log_info_msg "Setting up default gateway..."
+      ip route add default via ${GATEWAY} dev ${IFACE}
+      evaluate_retval
+   fi
+fi
 
 # End /sbin/ifup

Modified: trunk/BOOK/bootscripts/lfs/sbin/ifup.8
===================================================================
--- trunk/BOOK/bootscripts/lfs/sbin/ifup.8      2012-04-05 04:15:08 UTC (rev 
9806)
+++ trunk/BOOK/bootscripts/lfs/sbin/ifup.8      2012-04-09 19:14:33 UTC (rev 
9807)
@@ -28,15 +28,52 @@
        -V, --version
               Show version information.
 
-EXAMPLE
+EXAMPLES
        ifup eth0
               Bring up the interface defined in the file 
               /etc/sysconfig/ifconfig.eth0
 
+                ONBOOT=no
+                IFACE=eth0
+                SERVICE=ipv4-static
+                IP=192.168.1.22
+                GATEWAY=192.168.1.1
+                PREFIX=24
+                BROADCAST=192.168.1.255
+
        ifdown eth0:2
               Bring down the interface defined in the file
               /etc/sysconfig/ifconfig.eth0:2
 
+                ONBOOT=no
+                IFACE=eth0:2
+                SERVICE=dhcpcd
+         
+                DHCP_START="--waitip"
+                DHCP_STOP="-k"
+         
+                # Set PRINTIP="yes" to have the script print the DHCP IP 
address
+                PRINTIP="yes"
+         
+                # Set PRINTALL="yes" to print the DHCP assigned values for
+                # IP, SM, DG, and 1st NS. 
+                PRINTALL="no"
+
+       ifup br0
+              Bring up the interface defined in the file 
+              /etc/sysconfig/ifconfig.br0
+                    
+                ONBOOT=yes
+                IFACE=br0
+                SERVICE="bridge ipv4-static"
+                IP=192.168.1.22
+                GATEWAY=192.168.1.1
+                PREFIX=24
+                BROADCAST=192.168.1.255
+                STP=no                      # Spanning tree protocol, default 
no
+                INTERFACE_COMPONENTS=eth0   # Add to IFACE
+                IP_FORWARD=true
+
 NOTES
        The program does not configure network interfaces direct-
        ly.  It runs scripts defined by the SERVICE variable in 
@@ -51,11 +88,24 @@
        SERVICE - The service script to run to bring up the inter-
                  face.  Standard services are ipv4-static and 
                  ipv4-static-route.  Other services such as dhcp
-                 may be installed.
+                 or bridge may be installed.  This value may
+                 be a list of services when the interface is a
+                 compound device such as a bridge.
 
        ONBOOT  - If set to 'yes', the specified interface is 
                  configured by the netowrk boot script.
 
+       GATEWAY - The default IP address to use for routing if
+                 the destination IP address is not in a static 
+                 route or on a local network, e.g., 192.168.1.1.  
+                 For secondary IP addresses on an interface, this 
+                 parameter should not be specified.
+
+       INTERFACE_COMPONENTS - A list of component interfaces
+                 only needed for a compound device such as a bridge.  
+                 This list is normally a single value, e.g. eth0, 
+                 for use with a virtual host such as kvm.
+
        Other paramters that are service specific include:
 
        ipv4-static
@@ -64,24 +114,20 @@
                      e.g. 192.168.1.2.
 
          PREFIX    - The number of bits that specify the network
-                     number of the interface, e.g., 24.
+                     number of the interface.  The default, if not
+                     specified, is 24.
        
-         GATEWAY   - The default IP address to use for routing 
-                     if the destination IP address is not in a 
-                     static route or on a local network, e.g., 
-                     192.168.1.1.  For secondary IP addresses on
-                     an interface, this parameter should not be 
-                     specified.
-
          BROADCAST - The brodcast address for this interface, 
-                     e.g 192.168.1.255.
+                     e.g 192.168.1.255.  If not specified, 
+                     the broadcast address will be calculated
+                     from the IP and PREFIX.
 
        ipv4-static-route
 
          TYPE    -  The type of route, typically 'default', 
                     'network', 'or host'.
 
-         IP      -  The IP address for a network or host, if thei
+         IP      -  The IP address for a network or host, if the
                     TYPE is not 'default'.
 
          PREFIX  -  The prefix for the associated IP address.
@@ -92,12 +138,32 @@
                     to the destinations covered by the specified
                     route. (optional)
 
+       dhcp/dhclient
+
+         DHCP_START - Optional parameters to pass to the dhcp client
+                      at startup.
+
+         DHCP_STOP  - Optional paremeters to pass to the dhcp client 
+                      at shutdown.
+
+         PRINTIP    - Flag to print the dhcp address to stdout
+
+         PRINTALL   - Flag to print all obtained dhcp data to stdout
+
+       bridge
+
+         IP_FORWARD - An optional flag to enable the system to forward
+                      inbound IP packets received by one interface to 
+                      another outbound interface.  
+
+         STP        - Set bridge spanning tree protocol.  Default is no.
+
 FILES
        /etc/sysconfig/ifconfig.*
               definitions of network interfaces 
 
 AUTHORS
-       The  ifup/ifdown suite was written by Nathan Coulson
+       The ifup/ifdown suite was written by Nathan Coulson
        <[email protected]> and Kevin P. Fleming 
        <[email protected]>
        and updated by Bruce Dubbs <bdubbs@linuxfromscratch>.
@@ -105,4 +171,4 @@
 SEE ALSO
        ip(8).
 
-IFUP/IFDOWN                   18 Sep 2011                 ifup(8)
+IFUP/IFDOWN                   8 April 2012                 ifup(8)

Modified: trunk/BOOK/chapter01/changelog.xml
===================================================================
--- trunk/BOOK/chapter01/changelog.xml  2012-04-05 04:15:08 UTC (rev 9806)
+++ trunk/BOOK/chapter01/changelog.xml  2012-04-09 19:14:33 UTC (rev 9807)
@@ -37,6 +37,18 @@
 
 -->
     <listitem>
+      <para>2012-05-09</para>
+      <itemizedlist>
+         <listitem>
+           <para>[bdubbs] - Update networking bootscripts.  See
+           bootscripts change log for details.
+           Fixes 
+           <ulink url="&lfs-ticket-root;3053">#3053</ulink>.</para>
+         </listitem>
+      </itemizedlist>
+    </listitem>
+
+    <listitem>
       <para>2012-05-05</para>
       <itemizedlist>
          <listitem>

Modified: trunk/BOOK/chapter06/automake.xml
===================================================================
--- trunk/BOOK/chapter06/automake.xml   2012-04-05 04:15:08 UTC (rev 9806)
+++ trunk/BOOK/chapter06/automake.xml   2012-04-09 19:14:33 UTC (rev 9807)
@@ -70,11 +70,11 @@
       <segtitle>Installed directories</segtitle>
 
       <seglistitem>
-        <seg>acinstall, aclocal, aclocal-&automake-version;, automake,
-        automake-&automake-version;, compile, config.guess, config.sub,
+        <seg>acinstall, aclocal, aclocal-&am-minor-version;, automake,
+        automake-&am-minor-version;, compile, config.guess, config.sub,
         depcomp, elisp-comp, install-sh, mdate-sh, missing, mkinstalldirs,
         py-compile, symlink-tree, and ylwrap</seg>
-        <seg>/usr/share/aclocal-1.11, /usr/share/automake-1.11,
+        <seg>/usr/share/aclocal-&am-minor-version;, 
/usr/share/automake-&am-minor-version;,
         /usr/share/doc/automake-&automake-version;</seg>
       </seglistitem>
     </segmentedlist>
@@ -106,11 +106,11 @@
       </varlistentry>
 
       <varlistentry id="aclocalversion">
-        <term><command>aclocal-&automake-version;</command></term>
+        <term><command>aclocal-&am-minor-version;</command></term>
         <listitem>
           <para>A hard link to <command>aclocal</command></para>
           <indexterm zone="ch-system-automake aclocalversion">
-            <primary 
sortas="b-aclocal-&automake-version;">aclocal-&automake-version;</primary>
+            <primary 
sortas="b-aclocal-&am-minor-version;">aclocal-&am-minor-version;</primary>
           </indexterm>
         </listitem>
       </varlistentry>
@@ -133,11 +133,11 @@
       </varlistentry>
 
       <varlistentry id="automake-version">
-        <term><command>automake-&automake-version;</command></term>
+        <term><command>automake-&am-minor-version;</command></term>
         <listitem>
           <para>A hard link to <command>automake</command></para>
           <indexterm zone="ch-system-automake automake-version">
-            <primary 
sortas="b-automake-&automake-version;">automake-&automake-version;</primary>
+            <primary 
sortas="b-automake-&am-minor-version;">automake-&am-minor-version;</primary>
           </indexterm>
         </listitem>
       </varlistentry>

Modified: trunk/BOOK/chapter06/gcc.xml
===================================================================
--- trunk/BOOK/chapter06/gcc.xml        2012-04-05 04:15:08 UTC (rev 9806)
+++ trunk/BOOK/chapter06/gcc.xml        2012-04-09 19:14:33 UTC (rev 9807)
@@ -289,17 +289,11 @@
     href="readjusting.xml"
     xpointer="xpointer(//*[@os='v'])"/>
 
-    <para>Finally, move a misplced file:</para>
+    <para>Finally, move a misplaced file:</para>
 
-<screen><userinput remap="install">case `uname -m` in
-  i?86) GDBDIR=/usr/share/gdb/auto-load/usr/lib/   ;;
-  *)    GDBDIR=/usr/share/gdb/auto-load/usr/lib64/ ;;
-esac
+<screen><userinput remap="install">mkdir -pv /usr/share/gdb/auto-load/usr/lib
+mv -v /usr/lib/*gdb.py /usr/share/gdb/auto-load/usr/lib</userinput></screen>
 
-mkdir -pv $GDBDIR
-mv -v /usr/lib/*gdb.py $GDBDIR
-unset GDBDIR</userinput></screen>
-
   </sect2>
 
   <sect2 id="contents-gcc" role="content">

Modified: trunk/BOOK/chapter07/network.xml
===================================================================
--- trunk/BOOK/chapter07/network.xml    2012-04-05 04:15:08 UTC (rev 9806)
+++ trunk/BOOK/chapter07/network.xml    2012-04-09 19:14:33 UTC (rev 9807)
@@ -165,15 +165,18 @@
     gateway IP address, if one is present. If not, then comment out the
     variable entirely.</para>
 
-    <para>The <envar>PREFIX</envar> variable needs to contain the number of
+    <para>The <envar>PREFIX</envar> variable containis the number of
     bits used in the subnet. Each octet in an IP address is 8 bits. If the
     subnet's netmask is 255.255.255.0, then it is using the first three octets
     (24 bits) to specify the network number. If the netmask is 255.255.255.240,
     it would be using the first 28 bits.  Prefixes longer than 24 bits are
     commonly used by DSL and cable-based Internet Service Providers (ISPs).
     In this example (PREFIX=24), the netmask is 255.255.255.0. Adjust the
-    <envar>PREFIX</envar> variable according to your specific subnet.</para>
+    <envar>PREFIX</envar> variable according to your specific subnet.i
+    If omitted, the PREFIX defaults to 24.</para>
 
+    <para>For more information see the <command>ifup</command> man page.</para>
+
   </sect2>
 
   <sect2 id="resolv.conf">

Modified: trunk/BOOK/general.ent
===================================================================
--- trunk/BOOK/general.ent      2012-04-05 04:15:08 UTC (rev 9806)
+++ trunk/BOOK/general.ent      2012-04-09 19:14:33 UTC (rev 9807)
@@ -1,5 +1,5 @@
-<!ENTITY version "SVN-20120405">
-<!ENTITY releasedate "Apr 05, 2012">
+<!ENTITY version "SVN-20120409">
+<!ENTITY releasedate "Apr 09, 2012">
 <!ENTITY copyrightdate "1999-2012"><!-- jhalfs needs a literal dash, not 
&ndash; -->
 <!ENTITY milestone "7.2">
 <!ENTITY generic-version "development"> <!-- Use "development", "testing", or 
"x.y[-pre{x}]" -->

Modified: trunk/BOOK/packages.ent
===================================================================
--- trunk/BOOK/packages.ent     2012-04-05 04:15:08 UTC (rev 9806)
+++ trunk/BOOK/packages.ent     2012-04-09 19:14:33 UTC (rev 9807)
@@ -17,6 +17,7 @@
 <!ENTITY autoconf-ch6-sbu "4.8 SBU">
 
 <!ENTITY automake-version "1.11.4">
+<!ENTITY am-minor-version "1.11">
 <!ENTITY automake-size "1,066 KB">
 <!ENTITY automake-url "&gnu;automake/automake-&automake-version;.tar.xz">
 <!ENTITY automake-md5 "d1dd41acf56a30d8da7bf20c5ac223db">
@@ -302,7 +303,7 @@
 <!ENTITY less-ch6-du "3.5 MB">
 <!ENTITY less-ch6-sbu "less than 0.1 SBU">
 
-<!ENTITY lfs-bootscripts-version "20120322">                 <!-- Scripts 
depend on this format -->
+<!ENTITY lfs-bootscripts-version "20120409">                 <!-- 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 -->

-- 
http://linuxfromscratch.org/mailman/listinfo/lfs-book
FAQ: http://www.linuxfromscratch.org/lfs/faq.html
Unsubscribe: See the above information page

Reply via email to