Submitted By: Nathan Coulson Date: 2003-11-24 Initial Package Version: 1.12 Origin: http://conet.dyndns.org/~conathan/lfs-bootscripts Description: This is an enhancement to the network setup. It allows you to install additional modules for different network setups, instead of relying on making new scripts for each network card. Instructions: The origional bootscripts are built for static IP Addresses. To add further functionality, it was required to make ifup-eth0 and ifdown-eth0. To give an example of the new functionalty, if you wanted to include support for dhcpcd, you would create /etc/sysconfig/network-devices/script/dhcp-{up,down}. The $1 parameter is the device, such as eth0. in the ifconfig.eth0, you would use SERVICE=dhcp. By default, SERVICE is set to static if not set. diff -Naur bootscripts/sysconfig/network-devices/ifdown bootscripts-new/sysconfig/network-devices/ifdown --- bootscripts/sysconfig/network-devices/ifdown 2002-03-16 18:26:44.000000000 +0000 +++ bootscripts-new/sysconfig/network-devices/ifdown 2003-09-07 01:43:21.000000000 +0000 @@ -4,12 +4,22 @@ source $rc_functions source $network_devices/ifconfig.$1 +#complete compatibility with 1.12 +if [ -z $SERVICE ] +then + SERVICE=static +fi + + if [ -f $network_devices/ifdown-$1 ] then $network_devices/ifdown-$1 else - echo "Bringing down the $1 interface..." - ifconfig $1 down - evaluate_retval + if [ ! -f $network_devices/script/${SERVICE}-down ] + then + echo -n "Unable to find ${SERVICE}-down for $1, cannot continue." + exit 1 + fi + $network_devices/script/${SERVICE}-down $1 fi diff -Naur bootscripts/sysconfig/network-devices/ifup bootscripts-new/sysconfig/network-devices/ifup --- bootscripts/sysconfig/network-devices/ifup 2002-03-16 18:26:44.000000000 +0000 +++ bootscripts-new/sysconfig/network-devices/ifup 2003-09-07 01:42:49.000000000 +0000 @@ -4,31 +4,21 @@ source $rc_functions source $network_devices/ifconfig.$1 +#complete compatibility with 1.12 +if [ -z $SERVICE ] +then + SERVICE=static +fi + if [ -f $network_devices/ifup-$1 ] then $network_devices/ifup-$1 else - if [ -z $IP ] + if [ ! -f $network_devices/script/${SERVICE}-up ] then - echo "IP variable missing for ifconfig.$1, cannot continue" + echo -n "Unable to find ${SERVICE}-up for $1, cannot continue." exit 1 fi - - if [ -z $NETMASK ] - then - echo -n "NETMASK variable missing for ifconfig.$1, " - echo "using 255.255.255.0" - NETMASK=255.255.255.0 - fi - - if [ -z $BROADCAST ] - then - echo -n "BROADCAST variable missing for ifconfig.$1, " - echo "using default address" - fi - - echo "Bringing up the $1 interface..." - ifconfig $1 $IP netmask $NETMASK broadcast $BROADCAST - evaluate_retval + $network_devices/script/${SERVICE}-up $1 fi diff -Naur bootscripts/sysconfig/network-devices/script/static-down bootscripts-new/sysconfig/network-devices/script/static-down --- bootscripts/sysconfig/network-devices/script/static-down 1970-01-01 00:00:00.000000000 +0000 +++ bootscripts-new/sysconfig/network-devices/script/static-down 2003-09-07 01:34:51.000000000 +0000 @@ -0,0 +1,15 @@ +#!/bin/sh + +source /etc/sysconfig/rc +source $rc_functions +source $network_devices/ifconfig.$1 + +if [ -f $network_devices/ifdown-$1 ] +then + $network_devices/ifdown-$1 +else + echo "Bringing down the $1 interface..." + ifconfig $1 down + evaluate_retval +fi + diff -Naur bootscripts/sysconfig/network-devices/script/static-up bootscripts-new/sysconfig/network-devices/script/static-up --- bootscripts/sysconfig/network-devices/script/static-up 1970-01-01 00:00:00.000000000 +0000 +++ bootscripts-new/sysconfig/network-devices/script/static-up 2003-09-07 01:42:38.000000000 +0000 @@ -0,0 +1,28 @@ +#!/bin/sh + +source /etc/sysconfig/rc +source $rc_functions +source $network_devices/ifconfig.$1 + +if [ -z $IP ] +then + echo "IP variable missing for ifconfig.$1, cannot continue" + exit 1 +fi + +if [ -z $NETMASK ] +then + echo -n "NETMASK variable missing for ifconfig.$1, " + echo "using 255.255.255.0" + NETMASK=255.255.255.0 +fi + +if [ -z $BROADCAST ] +then + echo -n "BROADCAST variable missing for ifconfig.$1, " + echo "using default address" +fi + +echo "Bringing up the $1 interface..." +ifconfig $1 $IP netmask $NETMASK broadcast $BROADCAST +evaluate_retval