]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
network/net-lib.sh: fix wait_for_if_up()
authorHarald Hoyer <harald@redhat.com>
Tue, 1 Sep 2015 15:22:56 +0000 (17:22 +0200)
committerHarald Hoyer <harald@redhat.com>
Tue, 1 Sep 2015 15:23:33 +0000 (17:23 +0200)
wait for <*UP*> and not "state UP"

state can be UNKNOWN

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

index c8203567eaca2cfd6ebe9aa023cd2e5f31a4bf4a..6034a09118143a5a2d9525b1f664bfe6ef5cc09f 100755 (executable)
@@ -523,7 +523,21 @@ wait_for_if_up() {
 
     while [ $cnt -lt $timeout ]; do
         li=$(ip -o link show up dev $1)
-        [ -n "$li" ] && [ -z "${li##*state UP*}" ] && return 0
+        if [ -n "$li" ]; then
+            case "$li" in
+                *\<UP*)
+                    return 0;;
+                *\<*,UP\>*)
+                    return 0;;
+                *\<*,UP,*\>*)
+                    return 0;;
+            esac
+        fi
+        if strstr "$li" "LOWER_UP" \
+                && strstr "$li" "state UNKNOWN" \
+                && ! strstr "$li" "DORMANT"; then
+            return 0
+        fi
         sleep 0.1
         cnt=$(($cnt+1))
     done