aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBill Nottingham <notting@redhat.com>2001-08-15 20:20:46 +0000
committerBill Nottingham <notting@redhat.com>2001-08-15 20:20:46 +0000
commitf6e1525cde05acf072129a357e02bedcd14d79c9 (patch)
tree9e65e83f3e93892c8e8fca55d7a7350cb657f274
parent4d92a97eb8701ff9c02221f6b490002ed928b08f (diff)
downloadinitscripts-f6e1525cde05acf072129a357e02bedcd14d79c9.tar
initscripts-f6e1525cde05acf072129a357e02bedcd14d79c9.tar.gz
initscripts-f6e1525cde05acf072129a357e02bedcd14d79c9.tar.bz2
initscripts-f6e1525cde05acf072129a357e02bedcd14d79c9.tar.xz
initscripts-f6e1525cde05acf072129a357e02bedcd14d79c9.zip
add is_available() function for network devices; use it. gets rid of horribly ugly modprobe messages
-rwxr-xr-xrc.d/init.d/network25
-rwxr-xr-xsysconfig/network-scripts/ifup20
-rw-r--r--sysconfig/network-scripts/network-functions16
3 files changed, 36 insertions, 25 deletions
diff --git a/rc.d/init.d/network b/rc.d/init.d/network
index 7ab4ec75..009f9bc6 100755
--- a/rc.d/init.d/network
+++ b/rc.d/init.d/network
@@ -40,6 +40,8 @@ fi
CWD=`pwd`
cd /etc/sysconfig/network-scripts
+. network-functions
+
# find all the interfaces besides loopback.
# ignore aliases, alternative configurations, and editor backup files
interfaces=`ls ifcfg* | LANG=C egrep -v '(ifcfg-lo|:|rpmsave|rpmorig|rpmnew)' | \
@@ -76,16 +78,14 @@ case "$1" in
sysctl -w kernel.hotplug="/bin/true" > /dev/null 2>&1
for i in $interfaces; do
- 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" ] &&
+ if [ "${i##eth}" != "$i" ] && ! is_available $i ; then
+ continue
+ fi
+ if LANG=C egrep -L "^ONBOOT=\"?[Nn][Oo]\"?" ifcfg-$i > /dev/null ; then
+ continue
+ fi
+ # If we're in confirmation mode, get user confirmation
+ [ -n "$CONFIRM" ] &&
{
confirm $i
case $? in
@@ -99,10 +99,9 @@ case "$1" in
continue
;;
esac
- }
+ }
- action $"Bringing up interface $i: " ./ifup $i boot
- fi
+ action $"Bringing up interface $i: " ./ifup $i boot
done
# add cipe here.
diff --git a/sysconfig/network-scripts/ifup b/sysconfig/network-scripts/ifup
index 0ea87418..aec95481 100755
--- a/sysconfig/network-scripts/ifup
+++ b/sysconfig/network-scripts/ifup
@@ -85,18 +85,14 @@ if [ -x ${OTHERSCRIPT} ]; then
exec ${OTHERSCRIPT} ${CONFIG} $2
fi
-# is this device available? (this catches PCMCIA devices for us)
-LC_ALL= LANG= ip -o link | grep -q ${REALDEVICE}
-if [ "$?" = "1" ]; then
- alias=`modprobe -c | awk "/^alias ${REALDEVICE} / { print \\$3 }"`
- if [ -z "$alias" -o "$alias" = "off" ]; then
- exit 0
- fi
- modprobe $alias || {
- echo $"$alias device does not seem to be present, delaying ${DEVICE} initialization."
- exit 1
- }
-fi
+is_available ${REALDEVICE} || {
+ if [ "$?" = "1" ] ; then
+ echo $"$alias device does not seem to be present, delaying ${DEVICE} initialization."
+ exit 1
+ else
+ exit 0
+ fi
+}
if [ -n "${HWADDR}" ]; then
FOUNDMACADDR=`LC_ALL= LANG= ip -o link show ${REALDEVICE} | \
sed 's/.*link\/ether \([[:alnum:]:]*\).*/\1/'`
diff --git a/sysconfig/network-scripts/network-functions b/sysconfig/network-scripts/network-functions
index 2f181d73..934f55ae 100644
--- a/sysconfig/network-scripts/network-functions
+++ b/sysconfig/network-scripts/network-functions
@@ -80,6 +80,22 @@ do_netreport ()
)
}
+is_available ()
+{
+ LC_ALL= LANG= ip -o link | grep -q $1
+ if [ "$?" = "1" ]; then
+ alias=`modprobe -c | awk "/^alias $1 / { print \\$3 }"`
+ if [ -z "$alias" -o "$alias" = "off" ]; then
+ return 2
+ fi
+ modprobe $alias >/dev/null 2>&1|| {
+ return 1
+ }
+ else
+ return 0
+ fi
+}
+
need_hostname()
{
if [ "`hostname`" = "(none)" -o "`hostname`" = "localhost" -o \