aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBruce Dubbs <bdubbs@linuxfromscratch.org>2012-04-09 19:14:33 +0000
committerBruce Dubbs <bdubbs@linuxfromscratch.org>2012-04-09 19:14:33 +0000
commit970a126c28d18ccec2d6b08dc51ab367de4a4455 (patch)
treefdaeb512dbfec5d2a3ecb1b3c91115fff5ab5639
parentb12948d0460a07bbfc8bf5a0ccba5785f97856be (diff)
Update networking bootscripts. See bootscripts change log for details.
git-svn-id: http://svn.linuxfromscratch.org/LFS/trunk/BOOK@9807 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689
-rw-r--r--bootscripts/lfs/lib/services/init-functions12
-rwxr-xr-xbootscripts/lfs/lib/services/ipv4-static13
-rwxr-xr-xbootscripts/lfs/sbin/ifdown31
-rwxr-xr-xbootscripts/lfs/sbin/ifup65
-rw-r--r--bootscripts/lfs/sbin/ifup.894
-rw-r--r--chapter01/changelog.xml12
-rw-r--r--chapter06/automake.xml14
-rw-r--r--chapter06/gcc.xml12
-rw-r--r--chapter07/network.xml7
-rw-r--r--general.ent4
-rw-r--r--packages.ent3
11 files changed, 176 insertions, 91 deletions
diff --git a/bootscripts/lfs/lib/services/init-functions b/bootscripts/lfs/lib/services/init-functions
index 415c65ba8..5f525fce6 100644
--- a/bootscripts/lfs/lib/services/init-functions
+++ b/bootscripts/lfs/lib/services/init-functions
@@ -778,4 +778,16 @@ wait_for_user()
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
diff --git a/bootscripts/lfs/lib/services/ipv4-static b/bootscripts/lfs/lib/services/ipv4-static
index cb9649d4b..5e248c464 100755
--- a/bootscripts/lfs/lib/services/ipv4-static
+++ b/bootscripts/lfs/lib/services/ipv4-static
@@ -52,19 +52,8 @@ case "${2}" in
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
;;
diff --git a/bootscripts/lfs/sbin/ifdown b/bootscripts/lfs/sbin/ifdown
index 15519c37a..e875be905 100755
--- a/bootscripts/lfs/sbin/ifdown
+++ b/bootscripts/lfs/sbin/ifdown
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
########################################################################
# Begin /sbin/ifdown
#
@@ -67,33 +67,28 @@ if [ "$IFACE" = "" ]; then
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
diff --git a/bootscripts/lfs/sbin/ifup b/bootscripts/lfs/sbin/ifup
index 2facbe8be..bb25176ad 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.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,7 +16,24 @@
#
########################################################################
-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 @@ fi
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 @@ for S in ${SERVICE}; do
fi
done
-if [ -z "${CHECK_LINK}" -o \
- "${CHECK_LINK}" = "y" -o \
- "${CHECK_LINK}" = "yes" -o \
- "${CHECK_LINK}" = "1" ]; then
-
- # Bring up the interface
- if ip link show ${IFACE} > /dev/null 2>&1; then
- link_status=`ip link show ${IFACE}`
-
- if [ -n "${link_status}" ]; then
- if ! echo "${link_status}" | grep -q UP; then
- ip link set ${IFACE} up
- fi
- fi
+# Create/configure the interface
+for S in ${SERVICE}; do
+ IFCONFIG=${file} /lib/services/${S} ${IFACE} up
+done
- else
- log_failure_msg2 "Interface ${IFACE} doesn't exist."
- exit 1
- fi
-fi
+# Bring up the interface and any components
+for I in $IFACE $INTERFACE_COMPONENTS; do up $I; done
# 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
diff --git a/bootscripts/lfs/sbin/ifup.8 b/bootscripts/lfs/sbin/ifup.8
index 3520d4240..8ed0d9586 100644
--- a/bootscripts/lfs/sbin/ifup.8
+++ b/bootscripts/lfs/sbin/ifup.8
@@ -28,15 +28,52 @@ OPTIONS
-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 @@ NOTES
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 @@ NOTES
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 @@ NOTES
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
<nathan@linuxfromscratch.org> and Kevin P. Fleming
<kpfleming@linuxfromscratch.org>
and updated by Bruce Dubbs <bdubbs@linuxfromscratch>.
@@ -105,4 +171,4 @@ AUTHORS
SEE ALSO
ip(8).
-IFUP/IFDOWN 18 Sep 2011 ifup(8)
+IFUP/IFDOWN 8 April 2012 ifup(8)
diff --git a/chapter01/changelog.xml b/chapter01/changelog.xml
index 134b69517..0c2cb9362 100644
--- a/chapter01/changelog.xml
+++ b/chapter01/changelog.xml
@@ -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>
diff --git a/chapter06/automake.xml b/chapter06/automake.xml
index 49641233e..109da7059 100644
--- a/chapter06/automake.xml
+++ b/chapter06/automake.xml
@@ -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>
diff --git a/chapter06/gcc.xml b/chapter06/gcc.xml
index 5f8c2e16b..c18eb1404 100644
--- a/chapter06/gcc.xml
+++ b/chapter06/gcc.xml
@@ -289,16 +289,10 @@ SEARCH_DIR("/usr/lib");</computeroutput></screen>
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
-
-mkdir -pv $GDBDIR
-mv -v /usr/lib/*gdb.py $GDBDIR
-unset GDBDIR</userinput></screen>
+<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>
</sect2>
diff --git a/chapter07/network.xml b/chapter07/network.xml
index 6946e693d..e8ee50248 100644
--- a/chapter07/network.xml
+++ b/chapter07/network.xml
@@ -165,14 +165,17 @@ EOF</userinput></screen>
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>
diff --git a/general.ent b/general.ent
index 845cd9419..f666b5e5a 100644
--- a/general.ent
+++ b/general.ent
@@ -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}]" -->
diff --git a/packages.ent b/packages.ent
index ec05468a9..cd27ace75 100644
--- a/packages.ent
+++ b/packages.ent
@@ -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 -->