Blame SOURCES/0246-network-net-lib.sh-iface_has_link-wait-5s-for-the-ca.patch

18971c
From e863891c154419932617e101ef5549dda41f6e62 Mon Sep 17 00:00:00 2001
18971c
From: Harald Hoyer <harald@redhat.com>
18971c
Date: Thu, 7 May 2015 14:47:58 +0200
18971c
Subject: [PATCH] network/net-lib.sh:iface_has_link() wait 5s for the carrier
18971c
 to appear
18971c
18971c
https://bugzilla.redhat.com/show_bug.cgi?id=1088808
18971c
---
18971c
 modules.d/40network/net-lib.sh | 9 +++++++--
18971c
 1 file changed, 7 insertions(+), 2 deletions(-)
18971c
18971c
diff --git a/modules.d/40network/net-lib.sh b/modules.d/40network/net-lib.sh
18971c
index 220480b2..1f77a154 100755
18971c
--- a/modules.d/40network/net-lib.sh
18971c
+++ b/modules.d/40network/net-lib.sh
18971c
@@ -556,13 +556,18 @@ hostname() {
18971c
 }
18971c
 
18971c
 iface_has_link() {
18971c
+    local cnt=0
18971c
     local interface="$1" flags=""
18971c
     [ -n "$interface" ] || return 2
18971c
     interface="/sys/class/net/$interface"
18971c
     [ -d "$interface" ] || return 2
18971c
     linkup "$1"
18971c
-    [ "$(cat $interface/carrier)" = 1 ] || return 1
18971c
-    # XXX Do we need to reset the flags here? anaconda never bothered..
18971c
+    while [ $cnt -lt 50 ]; do
18971c
+        [ "$(cat $interface/carrier)" = 1 ] && return 0
18971c
+        sleep 0.1
18971c
+        cnt=$(($cnt+1))
18971c
+    done
18971c
+    return 1
18971c
 }
18971c
 
18971c
 find_iface_with_link() {