]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
network/net-lib.sh:iface_has_link() wait 5s for the carrier to appear
authorHarald Hoyer <harald@redhat.com>
Thu, 7 May 2015 12:47:58 +0000 (14:47 +0200)
committerHarald Hoyer <harald@redhat.com>
Thu, 7 May 2015 12:49:06 +0000 (14:49 +0200)
https://bugzilla.redhat.com/show_bug.cgi?id=1088808

modules.d/40network/net-lib.sh

index 60e62200adeffcf8809db00a733a56d027647253..35c18d103e4b7a0db7c5d574ea34b94adbdb0b18 100755 (executable)
@@ -554,13 +554,18 @@ type hostname >/dev/null 2>&1 || \
 }
 
 iface_has_link() {
+    local cnt=0
     local interface="$1" flags=""
     [ -n "$interface" ] || return 2
     interface="/sys/class/net/$interface"
     [ -d "$interface" ] || return 2
     linkup "$1"
-    [ "$(cat $interface/carrier)" = 1 ] || return 1
-    # XXX Do we need to reset the flags here? anaconda never bothered..
+    while [ $cnt -lt 50 ]; do
+        [ "$(cat $interface/carrier)" = 1 ] && return 0
+        sleep 0.1
+        cnt=$(($cnt+1))
+    done
+    return 1
 }
 
 find_iface_with_link() {