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
This commit is contained in:
Bruce Dubbs 2012-04-09 19:14:33 +00:00
parent b12948d046
commit 970a126c28
11 changed files with 176 additions and 91 deletions

View File

@ -778,4 +778,16 @@ wait_for_user()
return 0 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 # End /lib/lsb/init-functions

View File

@ -52,19 +52,8 @@ case "${2}" in
log_info_msg "Adding IPv4 address ${IP} to the ${1} interface..." log_info_msg "Adding IPv4 address ${IP} to the ${1} interface..."
ip addr add ${args} dev ${1} ip addr add ${args} dev ${1}
evaluate_retval evaluate_retval
if [ -n "${GATEWAY}" ]; then
if ip route | grep -q default; then
log_warning_msg "\nGateway already setup; skipping."
else else
log_info_msg "Setting up default gateway..." log_warning_msg "Cannot add IPv4 address ${IP} to ${1}. Already present."
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"
fi fi
;; ;;

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
######################################################################## ########################################################################
# Begin /sbin/ifdown # Begin /sbin/ifdown
# #
@ -67,14 +67,10 @@ if [ "$IFACE" = "" ]; then
exit 1 exit 1
fi fi
# Reverse the order # We only need to first service to bring down the interface
SERVICES= S=`echo ${SERVICE} | cut -f1 -d" "`
for S in ${SERVICE}; do SERVICES="${SERVICES} ${S}"; done
# This will run the service scripts
if ip link show ${IFACE} > /dev/null 2>&1; then if ip link show ${IFACE} > /dev/null 2>&1; then
for S in ${SERVICES}; do
if [ -n "${S}" -a -x "/lib/services/${S}" ]; then if [ -n "${S}" -a -x "/lib/services/${S}" ]; then
IFCONFIG=${file} /lib/services/${S} ${IFACE} down IFCONFIG=${file} /lib/services/${S} ${IFACE} down
else else
@ -84,16 +80,15 @@ if ip link show ${IFACE} > /dev/null 2>&1; then
log_failure_msg "$MSG" log_failure_msg "$MSG"
exit 1 exit 1
fi fi
done
else else
log_warning_msg "Interface ${1} doesn't exist." log_warning_msg "Interface ${1} doesn't exist."
fi fi
# Leave the interface up if there are additional interfaces in the device
link_status=`ip link show ${IFACE} 2>/dev/null` link_status=`ip link show ${IFACE} 2>/dev/null`
if [ -n "${link_status}" ]; then if [ -n "${link_status}" ]; then
if [ "$(echo "${link_status}" | grep UP)" != "" ]; 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 if [ "$(ip addr show ${IFACE} | grep 'inet ')" == "" ]; then
log_info_msg "Bringing down the ${IFACE} interface..." log_info_msg "Bringing down the ${IFACE} interface..."
ip link set ${IFACE} down ip link set ${IFACE} down

View File

@ -8,7 +8,7 @@
# Kevin P. Fleming - kpfleming@linuxfromscratch.org # Kevin P. Fleming - kpfleming@linuxfromscratch.org
# Update : Bruce Dubbs - bdubbs@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 # Notes : The IFCONFIG variable is passed to the SERVICE script
# in the /lib/services directory, to indicate what file the # 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" USAGE="Usage: $0 [ -hV ] [--help] [--version] interface"
VERSTR="LFS ifup, version ${RELEASE}" VERSTR="LFS ifup, version ${RELEASE}"
@ -86,38 +103,34 @@ for S in ${SERVICE}; do
fi fi
done done
if [ -z "${CHECK_LINK}" -o \ # Create/configure the interface
"${CHECK_LINK}" = "y" -o \ for S in ${SERVICE}; do
"${CHECK_LINK}" = "yes" -o \ IFCONFIG=${file} /lib/services/${S} ${IFACE} up
"${CHECK_LINK}" = "1" ]; then done
# Bring up the interface # Bring up the interface and any components
if ip link show ${IFACE} > /dev/null 2>&1; then for I in $IFACE $INTERFACE_COMPONENTS; do up $I; done
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
else
log_failure_msg2 "Interface ${IFACE} doesn't exist."
exit 1
fi
fi
# Set MTU if requested. Check if MTU has a "good" value. # Set MTU if requested. Check if MTU has a "good" value.
if test -n "${MTU}"; then if test -n "${MTU}"; then
if [[ ${MTU} =~ ^[0-9]+$ ]] && [[ $MTU -ge 68 ]] ; 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 else
log_info_msg2 "Invalid MTU $MTU" log_info_msg2 "Invalid MTU $MTU"
fi fi
fi fi
for S in ${SERVICE}; do # Set the route default gateway if requested
IFCONFIG=${file} /lib/services/${S} ${IFACE} up if [ -n "${GATEWAY}" ]; then
done 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 # End /sbin/ifup

View File

@ -28,15 +28,52 @@ OPTIONS
-V, --version -V, --version
Show version information. Show version information.
EXAMPLE EXAMPLES
ifup eth0 ifup eth0
Bring up the interface defined in the file Bring up the interface defined in the file
/etc/sysconfig/ifconfig.eth0 /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 ifdown eth0:2
Bring down the interface defined in the file Bring down the interface defined in the file
/etc/sysconfig/ifconfig.eth0:2 /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 NOTES
The program does not configure network interfaces direct- The program does not configure network interfaces direct-
ly. It runs scripts defined by the SERVICE variable in 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- SERVICE - The service script to run to bring up the inter-
face. Standard services are ipv4-static and face. Standard services are ipv4-static and
ipv4-static-route. Other services such as dhcp 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 ONBOOT - If set to 'yes', the specified interface is
configured by the netowrk boot script. 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: Other paramters that are service specific include:
ipv4-static ipv4-static
@ -64,24 +114,20 @@ NOTES
e.g. 192.168.1.2. e.g. 192.168.1.2.
PREFIX - The number of bits that specify the network 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, 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 ipv4-static-route
TYPE - The type of route, typically 'default', TYPE - The type of route, typically 'default',
'network', 'or host'. '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'. TYPE is not 'default'.
PREFIX - The prefix for the associated IP address. PREFIX - The prefix for the associated IP address.
@ -92,6 +138,26 @@ NOTES
to the destinations covered by the specified to the destinations covered by the specified
route. (optional) 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 FILES
/etc/sysconfig/ifconfig.* /etc/sysconfig/ifconfig.*
definitions of network interfaces definitions of network interfaces
@ -105,4 +171,4 @@ AUTHORS
SEE ALSO SEE ALSO
ip(8). ip(8).
IFUP/IFDOWN 18 Sep 2011 ifup(8) IFUP/IFDOWN 8 April 2012 ifup(8)

View File

@ -36,6 +36,18 @@
</listitem> </listitem>
--> -->
<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> <listitem>
<para>2012-05-05</para> <para>2012-05-05</para>
<itemizedlist> <itemizedlist>

View File

@ -70,11 +70,11 @@
<segtitle>Installed directories</segtitle> <segtitle>Installed directories</segtitle>
<seglistitem> <seglistitem>
<seg>acinstall, aclocal, aclocal-&automake-version;, automake, <seg>acinstall, aclocal, aclocal-&am-minor-version;, automake,
automake-&automake-version;, compile, config.guess, config.sub, automake-&am-minor-version;, compile, config.guess, config.sub,
depcomp, elisp-comp, install-sh, mdate-sh, missing, mkinstalldirs, depcomp, elisp-comp, install-sh, mdate-sh, missing, mkinstalldirs,
py-compile, symlink-tree, and ylwrap</seg> 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> /usr/share/doc/automake-&automake-version;</seg>
</seglistitem> </seglistitem>
</segmentedlist> </segmentedlist>
@ -106,11 +106,11 @@
</varlistentry> </varlistentry>
<varlistentry id="aclocalversion"> <varlistentry id="aclocalversion">
<term><command>aclocal-&automake-version;</command></term> <term><command>aclocal-&am-minor-version;</command></term>
<listitem> <listitem>
<para>A hard link to <command>aclocal</command></para> <para>A hard link to <command>aclocal</command></para>
<indexterm zone="ch-system-automake aclocalversion"> <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> </indexterm>
</listitem> </listitem>
</varlistentry> </varlistentry>
@ -133,11 +133,11 @@
</varlistentry> </varlistentry>
<varlistentry id="automake-version"> <varlistentry id="automake-version">
<term><command>automake-&automake-version;</command></term> <term><command>automake-&am-minor-version;</command></term>
<listitem> <listitem>
<para>A hard link to <command>automake</command></para> <para>A hard link to <command>automake</command></para>
<indexterm zone="ch-system-automake automake-version"> <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> </indexterm>
</listitem> </listitem>
</varlistentry> </varlistentry>

View File

@ -289,16 +289,10 @@ SEARCH_DIR("/usr/lib");</computeroutput></screen>
href="readjusting.xml" href="readjusting.xml"
xpointer="xpointer(//*[@os='v'])"/> 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 <screen><userinput remap="install">mkdir -pv /usr/share/gdb/auto-load/usr/lib
i?86) GDBDIR=/usr/share/gdb/auto-load/usr/lib/ ;; mv -v /usr/lib/*gdb.py /usr/share/gdb/auto-load/usr/lib</userinput></screen>
*) GDBDIR=/usr/share/gdb/auto-load/usr/lib64/ ;;
esac
mkdir -pv $GDBDIR
mv -v /usr/lib/*gdb.py $GDBDIR
unset GDBDIR</userinput></screen>
</sect2> </sect2>

View File

@ -165,14 +165,17 @@ EOF</userinput></screen>
gateway IP address, if one is present. If not, then comment out the gateway IP address, if one is present. If not, then comment out the
variable entirely.</para> 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 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 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, (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 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). 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 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>

View File

@ -1,5 +1,5 @@
<!ENTITY version "SVN-20120405"> <!ENTITY version "SVN-20120409">
<!ENTITY releasedate "Apr 05, 2012"> <!ENTITY releasedate "Apr 09, 2012">
<!ENTITY copyrightdate "1999-2012"><!-- jhalfs needs a literal dash, not &ndash; --> <!ENTITY copyrightdate "1999-2012"><!-- jhalfs needs a literal dash, not &ndash; -->
<!ENTITY milestone "7.2"> <!ENTITY milestone "7.2">
<!ENTITY generic-version "development"> <!-- Use "development", "testing", or "x.y[-pre{x}]" --> <!ENTITY generic-version "development"> <!-- Use "development", "testing", or "x.y[-pre{x}]" -->

View File

@ -17,6 +17,7 @@
<!ENTITY autoconf-ch6-sbu "4.8 SBU"> <!ENTITY autoconf-ch6-sbu "4.8 SBU">
<!ENTITY automake-version "1.11.4"> <!ENTITY automake-version "1.11.4">
<!ENTITY am-minor-version "1.11">
<!ENTITY automake-size "1,066 KB"> <!ENTITY automake-size "1,066 KB">
<!ENTITY automake-url "&gnu;automake/automake-&automake-version;.tar.xz"> <!ENTITY automake-url "&gnu;automake/automake-&automake-version;.tar.xz">
<!ENTITY automake-md5 "d1dd41acf56a30d8da7bf20c5ac223db"> <!ENTITY automake-md5 "d1dd41acf56a30d8da7bf20c5ac223db">
@ -302,7 +303,7 @@
<!ENTITY less-ch6-du "3.5 MB"> <!ENTITY less-ch6-du "3.5 MB">
<!ENTITY less-ch6-sbu "less than 0.1 SBU"> <!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-size "BOOTSCRIPTS-SIZE KB"> <!-- Updated in Makefile -->
<!ENTITY lfs-bootscripts-url "&downloads-root;lfs-bootscripts-&lfs-bootscripts-version;.tar.bz2"> <!ENTITY lfs-bootscripts-url "&downloads-root;lfs-bootscripts-&lfs-bootscripts-version;.tar.bz2">
<!ENTITY lfs-bootscripts-md5 "BOOTSCRIPTS-MD5SUM"> <!-- Updated in Makefile --> <!ENTITY lfs-bootscripts-md5 "BOOTSCRIPTS-MD5SUM"> <!-- Updated in Makefile -->