Author: jim
Date: 2005-03-30 23:15:59 -0700 (Wed, 30 Mar 2005)
New Revision: 4825

Modified:
   trunk/bootscripts/CHANGELOG
   trunk/bootscripts/lfs/init.d/network
   trunk/bootscripts/lfs/sysconfig/network-devices/ifdown
   trunk/bootscripts/lfs/sysconfig/network-devices/ifup
Log:
More Network Updates

Modified: trunk/bootscripts/CHANGELOG
===================================================================
--- trunk/bootscripts/CHANGELOG 2005-03-31 05:53:22 UTC (rev 4824)
+++ trunk/bootscripts/CHANGELOG 2005-03-31 06:15:59 UTC (rev 4825)
@@ -3,8 +3,9 @@
        * Changed from syslog-ng to sysklogd (Archaic)
        * Temporairly changed loadproc to return 0 if the program is
          already running (Nathan Coulson)
-  * Fixed (by reverting) ifup/ifdown/network (Nathan Coulson),
+       * Fixed (by reverting) ifup/ifdown/network (Nathan Coulson),
          Reported by Jim Gifford
+       * Fixed network up/down along with adding support of ONHOTPLUG
        * Tagged as lfs-bootscripts-3.2.0 (Nathan Coulson)
 
 n/a - March 19, 2005

Modified: trunk/bootscripts/lfs/init.d/network
===================================================================
--- trunk/bootscripts/lfs/init.d/network        2005-03-31 05:53:22 UTC (rev 
4824)
+++ trunk/bootscripts/lfs/init.d/network        2005-03-31 06:15:59 UTC (rev 
4825)
@@ -26,7 +26,8 @@
                        interface=${file##*/ifconfig.}
 
                        # skip if $file is * (because nothing was found)
-                       if [ "${interface}" = "*" ]; then
+                       if [ "${interface}" = "*" ]
+                       then
                                continue
                        fi
 
@@ -48,7 +49,8 @@
                        interface=${file##*/ifconfig.}
 
                        # skip if $file is * (because nothing was found)
-                       if [ "${interface}" = "*" ]; then
+                       if [ "${interface}" = "*" ]
+                       then
                                continue
                        fi
 

Modified: trunk/bootscripts/lfs/sysconfig/network-devices/ifdown
===================================================================
--- trunk/bootscripts/lfs/sysconfig/network-devices/ifdown      2005-03-31 
05:53:22 UTC (rev 4824)
+++ trunk/bootscripts/lfs/sysconfig/network-devices/ifdown      2005-03-31 
06:15:59 UTC (rev 4825)
@@ -5,42 +5,35 @@
 # Description : Interface Down
 #
 # Authors     : Nathan Coulson - [EMAIL PROTECTED]
-#               Kevin P. Fleming - [EMAIL PROTECTED]
+#              Kevin P. Fleming - [EMAIL PROTECTED]
 #
-# Version     : 00.00
+# Version     : 00.01
 #
 # Notes       : the IFCONFIG variable is passed to the scripts found
-#               in the services directory, to indicate what file the
-#               service should source to get environmental variables.
+#              in the services directory, to indicate what file the
+#              service should source to get environmental variables.
 #
 ########################################################################
 
 . /etc/sysconfig/rc 
 . ${rc_functions} 
 
-# Collect a list of configuration files for our interface
 if [ -n "${2}" ]; then
-       for file in [EMAIL PROTECTED] # All parameters except $1
-       do
+       for file in [EMAIL PROTECTED]; do
                FILES="${FILES} ${network_devices}/ifconfig.${1}/${file}"
        done
-elif [ -d "${network_devices}/ifconfig.${1}" ]; then
+elif [ -d "${network_devices}/ifconfig.${1}" -a "$FILESSET" != "1" ]; then
        FILES=`echo ${network_devices}/ifconfig.${1}/*`
-else
+       FILESSET=1
+elif [ "$FILESSET" != "1" ]; then
        FILES="${network_devices}/ifconfig.${1}"
 fi
 
-# Reverse the order configuration files are processed in
-for file in ${FILES}
-do
-       FILES2="${file} ${FILES2}"
-done
-FILES=${FILES2}
-
-
-# Process each configuration file
-for file in ${FILES}
-do
+for file in ${FILES}; do
+       # skip backup files
+       if [ "${file}" != "${file%""~""}" ]; then
+               continue
+       fi
        if [ ! -f "${file}" ]; then
                boot_mesg "${file} is not a network configuration file or 
directory." ${WARNING}
                echo_warning
@@ -60,18 +53,18 @@
                if [ "${IN_HOTPLUG}" = "1" -a "${ONHOTPLUG}" != "yes" ]; then
                        continue
                fi
-
-               # This will run the service script, if SERVICE is set
+       
                if [ -n "${SERVICE}" -a -x 
"${network_devices}/services/${SERVICE}" ]; then
-                       if ip link show ${1} > /dev/null 2>&1; then
-                               IFCONFIG=${file} 
${network_devices}/services/${SERVICE} ${1} down
+                       if ip link show ${1} > /dev/null 2>&1
+                       then
+                               IFCONFIG=${file} 
${network_devices}/services/${SERVICE} ${1} down ${ESSID}
                        else
                                boot_mesg "Interface ${1} doesn't exist." 
${WARNING}
                                echo_warning
                        fi
                else
-                       boot_mesg "Unable to process ${file}.  Either" 
${FAILURE}
-                       boot_mesg " the SERVICE variable was not set,"
+                       boot_mesg -n "Unable to process ${file}.  Either" 
${FAILURE}
+                       boot_mesg -n " the SERVICE variable was not set,"
                        boot_mesg " or the specified service cannot be 
executed."
                        echo_failure
                        continue
@@ -79,7 +72,6 @@
        )
 done
 
-
 if [ -z "${2}" ]; then
        link_status=`ip link show $1 2> /dev/null`
        if [ -n "${link_status}" ]; then

Modified: trunk/bootscripts/lfs/sysconfig/network-devices/ifup
===================================================================
--- trunk/bootscripts/lfs/sysconfig/network-devices/ifup        2005-03-31 
05:53:22 UTC (rev 4824)
+++ trunk/bootscripts/lfs/sysconfig/network-devices/ifup        2005-03-31 
06:15:59 UTC (rev 4825)
@@ -18,31 +18,38 @@
 . /etc/sysconfig/rc 
 . ${rc_functions} 
 
-# Collect a list of configuration files for our interface
+bring_link_up()
+{
+       link_status=`ip link show ${1} 2> /dev/null`
+       if [ -n "${link_status}" ]; then
+               if ! echo "${link_status}" | grep -q UP; then
+                       boot_mesg "Bringing up the ${1} interface..."
+                       ip link set ${1} up
+                       evaluate_retval
+               fi
+       fi
+}
+
 if [ -n "${2}" ]; then
-       for file in [EMAIL PROTECTED] # All parameters except $1
-       do
+       for file in [EMAIL PROTECTED]; do
                FILES="${FILES} ${network_devices}/ifconfig.${1}/${file}"
        done
-elif [ -d "${network_devices}/ifconfig.${1}" ]; then
+elif [ -d "${network_devices}/ifconfig.${1}" -a "$FILESSET" != "1" ]; then
        FILES=`echo ${network_devices}/ifconfig.${1}/*`
-else
+       FILESSET=1
+elif [ "$FILESSET" != "1" ]; then
        FILES="${network_devices}/ifconfig.${1}"
 fi
-
-
-boot_mesg "Bringing up the ${1} interface..."
-boot_mesg_flush
-
-# Process each configuration file
-for file in ${FILES}
-do
+for file in ${FILES}; do
+       # skip backup files
+       if [ "${file}" != "${file%""~""}" ]; then
+               continue
+       fi
        if [ ! -f "${file}" ]; then
-               boot_mesg "${file} is not a network configuration file." 
${WARNING}
+               boot_mesg "${file} is not a network configuration file or 
directory." ${WARNING}
                echo_warning
                continue
        fi
-
        (
                . ${file}
 
@@ -53,34 +60,18 @@
                fi
                # Will not process this service if started by hotplug, and 
                # ONHOTPLUG is not set to yes
-               if [ "${IN_HOTPLUG}" = "1" -a "${ONHOTPLUG}" != "yes" ]; then
+               if [ "${IN_HOTPLUG}" = "1" -a "${ONHOTPLUG}" != "yes" -a 
"${HOSTNAME}" != "(none)" ]; then
                         continue
                fi
 
-               if [ -n "${CHECK_LINK}" -o "${CHECK_LINK}" = "y" -o 
"${CHECK_LINK}" = "yes" -o "${CHECK_LINK}" = "1" ]; then
-
-                       # Activate the interface, if not activated
+               if [ -n "${SERVICE}" -a -x 
"${network_devices}/services/${SERVICE}" ]; then
                        if ip link show ${1} > /dev/null 2>&1; then
-                               link_status=`ip link show ${1} 2> /dev/null`
-                               if [ -n "${link_status}" ]; then
-                                       if ! echo "${link_status}" | grep -q 
UP; then
-                                               ip link set ${1} up
-                                               if [ "$?" != "0" ]; then
-                                                       boot_mesg "Unable to 
activate ${1}." ${FAILURE}
-                                                       echo_failure
-                                               fi
-                                       fi
-                               fi
+                               bring_link_up ${1}
+                               IFCONFIG=${file} 
${network_devices}/services/${SERVICE} ${1} up ${ESSID}
                        else
                                boot_mesg "Interface ${1} doesn't exist." 
${WARNING}
                                echo_warning
-                               exit 0
                        fi
-
-               fi
-               # This will run the service script, if SERVICE is set
-               if [ -n "${SERVICE}" -a -x 
"${network_devices}/services/${SERVICE}" ]; then
-                       IFCONFIG=${file} ${network_devices}/services/${SERVICE} 
${1} up
                else
                        boot_mesg "Unable to process ${file}.  Either" 
${FAILURE}
                        boot_mesg " the SERVICE variable was not set,"

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