aboutsummaryrefslogtreecommitdiffstats
path: root/sysconfig/network-scripts/network-functions
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 /sysconfig/network-scripts/network-functions
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
Diffstat (limited to 'sysconfig/network-scripts/network-functions')
-rw-r--r--sysconfig/network-scripts/network-functions16
1 files changed, 16 insertions, 0 deletions
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 \