summaryrefslogtreecommitdiffstats
path: root/testModule/deprecated/network.functions
diff options
context:
space:
mode:
authorJonathan Bauer2015-04-14 17:58:50 +0200
committerJonathan Bauer2015-04-14 17:58:50 +0200
commite4c036d247389cfaeb3da8675ce53f53bef90afe (patch)
treeae1c87aeb940147cb258c4b540ad920880781ac0 /testModule/deprecated/network.functions
parentstatic qemu-nbd (diff)
parentSome tries to fix kernel panic. (diff)
downloadsystemd-init-e4c036d247389cfaeb3da8675ce53f53bef90afe.tar.gz
systemd-init-e4c036d247389cfaeb3da8675ce53f53bef90afe.tar.xz
systemd-init-e4c036d247389cfaeb3da8675ce53f53bef90afe.zip
Merge branch 'master' of git.openslx.org:openslx-ng/systemd-init
Diffstat (limited to 'testModule/deprecated/network.functions')
-rw-r--r--testModule/deprecated/network.functions23
1 files changed, 23 insertions, 0 deletions
diff --git a/testModule/deprecated/network.functions b/testModule/deprecated/network.functions
new file mode 100644
index 00000000..89ca5a20
--- /dev/null
+++ b/testModule/deprecated/network.functions
@@ -0,0 +1,23 @@
+wait_for_iface() {
+ local DEVICE=$1
+ local TIMEOUT=10
+ echo -n "Waiting for interface $DEVICE: "
+ # Some systems don't have operstate. Seems to be hardware dependent
+ [ ! -e "/sys/class/net/${DEVICE}/operstate" ] && usleep 10000
+ if [ -e "/sys/class/net/${DEVICE}/operstate" ]; then
+ while true; do
+ # check linkstate
+ [ "x$(cat "/sys/class/net/${DEVICE}/operstate")" == "xup" ] && break
+ TIMEOUT=$(( $TIMEOUT - 1 )) # don't wait forever, the pcnet iface of vmware will never be "up" although it's working
+ [ "$TIMEOUT" -le 0 ] && break
+ # else
+ echo -n "."
+ usleep 500000
+ done
+ else
+ # we really don't have a operstate .. then just wait a sec and hope for the best.
+ sleep 1
+ fi
+ echo ".$(cat "/sys/class/net/${DEVICE}/operstate" 2>/dev/null)"
+}
+true