diff options
| author | Sebastian | 2014-01-30 20:32:46 +0100 |
|---|---|---|
| committer | Sebastian | 2014-01-30 20:32:46 +0100 |
| commit | 4e1c52b2e8419ec78ee489c32b004823e34edaee (patch) | |
| tree | ccf0283df8658fb553b877f458f626be847d03f5 | |
| parent | [splash-openslx] A default splash screen. Needs to be added to stage31. See r... (diff) | |
| download | tm-scripts-4e1c52b2e8419ec78ee489c32b004823e34edaee.tar.gz tm-scripts-4e1c52b2e8419ec78ee489c32b004823e34edaee.tar.xz tm-scripts-4e1c52b2e8419ec78ee489c32b004823e34edaee.zip | |
cleanup setup_network script; dalay (final) br0 setup until IFACE
linkstate is up
| -rwxr-xr-x | remote/rootfs/rootfs-stage31/data/inc/setup_network | 35 |
1 files changed, 22 insertions, 13 deletions
diff --git a/remote/rootfs/rootfs-stage31/data/inc/setup_network b/remote/rootfs/rootfs-stage31/data/inc/setup_network index 9e52cfaa..b0e6f756 100755 --- a/remote/rootfs/rootfs-stage31/data/inc/setup_network +++ b/remote/rootfs/rootfs-stage31/data/inc/setup_network @@ -4,6 +4,26 @@ echo "Setting up network..." echo "Main MAC address is '$MAC'" +wait_for_iface() { + DEVICE=$1 + echo -n "Waiting for interface $DEVICE: " + # Some systems don't have operstate. Seems to be hardware dependent + [ ! -e "/sys/class/net/${DEVICE}/operstate" ] && usleep 1000 + if [ -e "/sys/class/net/${DEVICE}/operstate" ]; then + while true; do + # check linkstate + [ "x$(cat "/sys/class/net/${DEVICE}/operstate")" == "xup" ] && 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 "." +} + # setup network # set up loopback networking @@ -35,6 +55,7 @@ for LINE in $IP_OUT; do brctl setfd "$BRIDGE" 0.000000000001 ip link set addr "$IFMAC" "$BRIDGE" || drop_shell "Could not set mac of $BRIDGE" ip link set dev "$IFACE" up + wait_for_iface "$IFACE" brctl addif "$BRIDGE" "$IFACE" || drop_shell "Could not add $IFACE to $BRIDGE" # analyze ip information from the kernel command line and put parts @@ -67,19 +88,7 @@ for LINE in $IP_OUT; do IFACE="" done -echo -n "Waiting for interface $BRIDGE: " -# Some systems don't have operstate. Seems to be hardware dependent -[ ! -e "/sys/class/net/${BRIDGE}/operstate" ] && sleep 2 -while true; do - # still no operstate? assume up and hope for the best... - [ ! -e "/sys/class/net/${BRIDGE}/operstate" ] && break - # check linkstate - [ "x$(cat "/sys/class/net/${BRIDGE}/operstate")" == "xup" ] && break - # else - echo -n "." - usleep 500000 -done -echo "." +wait_for_iface "$BRIDGE" # udhcpc PARAM= |
