Author: nathan
Date: 2005-03-31 00:07:19 -0700 (Thu, 31 Mar 2005)
New Revision: 4828

Modified:
   trunk/bootscripts/lfs/sysconfig/network-devices/ifdown
   trunk/bootscripts/lfs/sysconfig/network-devices/ifup
Log:
upgraded ifup/ifdown

Modified: trunk/bootscripts/lfs/sysconfig/network-devices/ifdown
===================================================================
--- trunk/bootscripts/lfs/sysconfig/network-devices/ifdown      2005-03-31 
06:34:01 UTC (rev 4827)
+++ trunk/bootscripts/lfs/sysconfig/network-devices/ifdown      2005-03-31 
07:07:19 UTC (rev 4828)
@@ -5,35 +5,43 @@
 # Description : Interface Down
 #
 # Authors     : Nathan Coulson - [EMAIL PROTECTED]
-#              Kevin P. Fleming - [EMAIL PROTECTED]
+#               Kevin P. Fleming - [EMAIL PROTECTED]
 #
 # 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]; do
+       for file in [EMAIL PROTECTED]; do # All parameters except $1
                FILES="${FILES} ${network_devices}/ifconfig.${1}/${file}"
        done
-elif [ -d "${network_devices}/ifconfig.${1}" -a "$FILESSET" != "1" ]; then
+elif [ -d "${network_devices}/ifconfig.${1}" ]; then
        FILES=`echo ${network_devices}/ifconfig.${1}/*`
-       FILESSET=1
-elif [ "$FILESSET" != "1" ]; then
+else
        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
        # 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
@@ -54,6 +62,7 @@
                        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

Modified: trunk/bootscripts/lfs/sysconfig/network-devices/ifup
===================================================================
--- trunk/bootscripts/lfs/sysconfig/network-devices/ifup        2005-03-31 
06:34:01 UTC (rev 4827)
+++ trunk/bootscripts/lfs/sysconfig/network-devices/ifup        2005-03-31 
07:07:19 UTC (rev 4828)
@@ -18,38 +18,35 @@
 . /etc/sysconfig/rc 
 . ${rc_functions} 
 
-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
-}
 
+# Collect a list of configuration files for our interface
 if [ -n "${2}" ]; then
-       for file in [EMAIL PROTECTED]; do
+       for file in [EMAIL PROTECTED] # All parameters except $1
+  do
                FILES="${FILES} ${network_devices}/ifconfig.${1}/${file}"
        done
-elif [ -d "${network_devices}/ifconfig.${1}" -a "$FILESSET" != "1" ]; then
+elif [ -d "${network_devices}/ifconfig.${1}" ]; then
        FILES=`echo ${network_devices}/ifconfig.${1}/*`
-       FILESSET=1
-elif [ "$FILESSET" != "1" ]; then
+else 
        FILES="${network_devices}/ifconfig.${1}"
 fi
+
+boot_mesg "Bringing up the ${1} interface..."
+boot_mesg_flush
+
+# Process each configruation file
 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
                continue
        fi
+
        (
                . ${file}
 
@@ -64,14 +61,23 @@
                         continue
                fi
 
+
                if [ -n "${SERVICE}" -a -x 
"${network_devices}/services/${SERVICE}" ]; then
-                       if ip link show ${1} > /dev/null 2>&1; then
-                               bring_link_up ${1}
-                               IFCONFIG=${file} 
${network_devices}/services/${SERVICE} ${1} up
-                       else
-                               boot_mesg "Interface ${1} doesn't exist." 
${WARNING}
-                               echo_warning
+                       if [ -n "${CHECK_LINK}" -o "${CHECK_LINK}" = "y" -o 
"${CHECK_LINK}" = "yes" -o "${CHECK_LINK}" = "1" ]; 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
+                                               fi
+                                       fi
+                               else
+                                       boot_mesg "Interface ${1} doesn't 
exist." ${WARNING}
+                                       echo_warning
+                                       continue
+                               fi
                        fi
+                       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