diff options
| author | torben | 2015-04-02 16:00:56 +0200 |
|---|---|---|
| committer | torben | 2015-04-02 16:00:56 +0200 |
| commit | 0dfa3a78311376dd83811b016590343dad16ce65 (patch) | |
| tree | a726c3c6ead95bf9c47a5a61a20b6a1e3238c169 /testModule/network.functions | |
| parent | Configure network. (diff) | |
| download | systemd-init-0dfa3a78311376dd83811b016590343dad16ce65.tar.gz systemd-init-0dfa3a78311376dd83811b016590343dad16ce65.tar.xz systemd-init-0dfa3a78311376dd83811b016590343dad16ce65.zip | |
Remove old approach to get internet. Adding command line parsing for
kernel parameter ip.
Diffstat (limited to 'testModule/network.functions')
| -rw-r--r-- | testModule/network.functions | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/testModule/network.functions b/testModule/network.functions new file mode 100644 index 00000000..dc5dd52e --- /dev/null +++ b/testModule/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 |
