aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLukas Nykryn <lnykryn@redhat.com>2014-04-02 17:29:09 +0200
committerLukas Nykryn <lnykryn@redhat.com>2014-04-02 17:29:09 +0200
commit832e3236a72f88ad85b78ea35ec3beb80313dd5d (patch)
tree3a107eeb76c1b52bf5cc5b272c91b8689dc9a000
parent51b4dabb1b3e17cce863ad8ded0c605cf32516ca (diff)
downloadinitscripts-832e3236a72f88ad85b78ea35ec3beb80313dd5d.tar
initscripts-832e3236a72f88ad85b78ea35ec3beb80313dd5d.tar.gz
initscripts-832e3236a72f88ad85b78ea35ec3beb80313dd5d.tar.bz2
initscripts-832e3236a72f88ad85b78ea35ec3beb80313dd5d.tar.xz
initscripts-832e3236a72f88ad85b78ea35ec3beb80313dd5d.zip
add configurable DEVTIMEOUT
-rwxr-xr-xsysconfig/network-scripts/ifup2
-rwxr-xr-xsysconfig/network-scripts/ifup-eth2
-rw-r--r--sysconfig/network-scripts/network-functions17
3 files changed, 19 insertions, 2 deletions
diff --git a/sysconfig/network-scripts/ifup b/sysconfig/network-scripts/ifup
index 278fde39..4cf292ec 100755
--- a/sysconfig/network-scripts/ifup
+++ b/sysconfig/network-scripts/ifup
@@ -99,7 +99,7 @@ if [ "${VLAN}" = "yes" ] && [ "$ISALIAS" = "no" ]; then
fi
fi
- is_available ${PHYSDEV} || {
+ is_available_wait ${PHYSDEV} ${DEVTIMEOUT} || {
if [ "$?" = "1" ] ; then
net_log $"$alias device ${DEVICE} does not seem to be present, delaying initialization."
exit 1
diff --git a/sysconfig/network-scripts/ifup-eth b/sysconfig/network-scripts/ifup-eth
index c94c535e..bc0eb962 100755
--- a/sysconfig/network-scripts/ifup-eth
+++ b/sysconfig/network-scripts/ifup-eth
@@ -73,7 +73,7 @@ if [ "${TYPE}" = "Tap" ]; then
fi
# now check the real state
-is_available ${REALDEVICE} || {
+is_available_wait ${REALDEVICE} ${DEVTIMEOUT} || {
if [ -n "$alias" ]; then
net_log $"$alias device ${DEVICE} does not seem to be present, delaying initialization."
else
diff --git a/sysconfig/network-scripts/network-functions b/sysconfig/network-scripts/network-functions
index d7299572..ff683b90 100644
--- a/sysconfig/network-scripts/network-functions
+++ b/sysconfig/network-scripts/network-functions
@@ -329,6 +329,23 @@ END {
[ -d "/sys/class/net/$1" ] && return 0 || return 1
}
+is_available_wait ()
+{
+ [ -z "$1" ] && return 1
+
+ local retry=${2##*[!0-9]*}
+
+ is_available $1 && return 0
+
+ while [ 0"$retry" -gt 0 ]; do
+ sleep 1
+ [ -d "/sys/class/net/$1" ] && return 0
+ retry=$(($retry -1))
+ done
+
+ return 1
+}
+
need_hostname ()
{
CHECK_HOSTNAME=$(hostname)