diff options
author | Bill Nottingham <notting@redhat.com> | 2001-04-02 19:51:20 +0000 |
---|---|---|
committer | Bill Nottingham <notting@redhat.com> | 2001-04-02 19:51:20 +0000 |
commit | 4d2327b39666473012cc8ec74a63b3da6850cadc (patch) | |
tree | f129578e7a4b74948522498f80d44a066bce7356 /rc.d/init.d | |
parent | 1ddedb48605b5cbbdaaf186db991a5ca37b908a0 (diff) | |
download | initscripts-4d2327b39666473012cc8ec74a63b3da6850cadc.tar initscripts-4d2327b39666473012cc8ec74a63b3da6850cadc.tar.gz initscripts-4d2327b39666473012cc8ec74a63b3da6850cadc.tar.bz2 initscripts-4d2327b39666473012cc8ec74a63b3da6850cadc.tar.xz initscripts-4d2327b39666473012cc8ec74a63b3da6850cadc.zip |
run *all* greps in C locale
don't error if kernel.hotplug isn't there (#33256)
disable hotplug during network initscript
fix network up/down logic
ignore backup files in /etc/sysconfig/network-scripts
only load the module if there is one to load.
only load modules for ethernet devices
ask for startup of each network devie in CONFIRM mode. Patch from <rasmusin@wpi.edu>
fix more ifconfig greps (patch from Conectiva)
Diffstat (limited to 'rc.d/init.d')
-rwxr-xr-x | rc.d/init.d/network | 43 |
1 files changed, 35 insertions, 8 deletions
diff --git a/rc.d/init.d/network b/rc.d/init.d/network index 76b3c76c..25e2abcf 100755 --- a/rc.d/init.d/network +++ b/rc.d/init.d/network @@ -34,9 +34,10 @@ cd /etc/sysconfig/network-scripts # find all the interfaces besides loopback. # ignore aliases, alternative configurations, and editor backup files -interfaces=`ls ifcfg* | egrep -v '(ifcfg-lo|:)' | \ - egrep -v 'ifcfg-ippp[0-9]+$' | \ - egrep 'ifcfg-[a-z0-9]+$' | \ +interfaces=`ls ifcfg* | LANG=C egrep -v '(ifcfg-lo|:|rpmsave|rpmorig|rpmnew)' | \ + LANG=C egrep -v '(~|\.bak)$' | \ + LANG=C egrep -v 'ifcfg-ippp[0-9]+$' | \ + LANG=C egrep 'ifcfg-[a-z0-9]+$' | \ sed 's/^ifcfg-//g'` # See how we were called. @@ -57,15 +58,41 @@ case "$1" in ;; esac + oldhotplug=`sysctl kernel.hotplug 2>/dev/null| awk '{ print $3 }' 2>/dev/null` + sysctl -w kernel.hotplug="/bin/true" > /dev/null 2>&1 + for i in $interfaces; do - if egrep -L "^ONBOOT=\"?[Nn][Oo]\"?" ifcfg-$i >/dev/null 2>&1; then - # Probe module to preserve interface ordering - /sbin/ifconfig $i >/dev/null 2>&1 + if LANG=C egrep -L "^ONBOOT=\"?[Nn][Oo]\"?" ifcfg-$i >/dev/null 2>&1 ; then + if [ "${i##eth}" != "$i" ]; then + # Probe module to preserve interface ordering + if [ -n "`modprobe -vn $i | grep -v Note:`" ]; then + /sbin/ifconfig $i >/dev/null 2>&1 + fi + fi else + # If we're in confirmation mode, get user confirmation + [ -n "$CONFIRM" ] && + { + confirm $i + case $? in + 0) + : + ;; + 2) + CONFIRM= + ;; + *) + continue + ;; + esac + } + action "Bringing up interface $i: " ./ifup $i boot fi done + sysctl -w kernel.hotplug=$oldhotplug > /dev/null 2>&1 + # Add non interface-specific static-routes. if [ -f /etc/sysconfig/static-routes ]; then grep "^any" /etc/sysconfig/static-routes | while read ignore type dest netmask mask bogus args; do @@ -93,7 +120,7 @@ case "$1" in fi for i in $interfaces ; do - if ifconfig $i 2>/dev/null | LANG=C grep -q " UP " >/dev/null 2>&1 ; then + if LC_ALL= LANG= ifconfig $i 2>/dev/null | grep -q " UP " >/dev/null 2>&1 ; then action "Shutting down interface $i: " ./ifdown $i boot fi done @@ -154,7 +181,7 @@ case "$1" in action "Bringing up device $device: " ./ifup $device done for device in $DEV_RECONF_ALIASES ; do - action "Briging up alias $device: " /etc/sysconfig/network-scripts/ifup-aliases $device + action "Bringing up alias $device: " /etc/sysconfig/network-scripts/ifup-aliases $device done for device in $DEV_RECONF_ROUTES ; do action "Bringing up route $device: " /etc/sysconfig/network-scripts/ifup-routes $device |