diff options
| author | Jonathan Bauer | 2015-05-28 13:56:27 +0200 |
|---|---|---|
| committer | Jonathan Bauer | 2015-05-28 13:56:27 +0200 |
| commit | 14dde32029e320b8d36ca4cd1ec2d9b114183a2e (patch) | |
| tree | 25075f1ee6ca1678b870c992ae24b846d14b853b /builder/dnbd3-qcow2-rootfs/debugging_tools/network.functions | |
| parent | DO NOT USE YET. YOU'VE BEEN WARNED!!111 (diff) | |
| download | systemd-init-14dde32029e320b8d36ca4cd1ec2d9b114183a2e.tar.gz systemd-init-14dde32029e320b8d36ca4cd1ec2d9b114183a2e.tar.xz systemd-init-14dde32029e320b8d36ca4cd1ec2d9b114183a2e.zip | |
restructured
'builder' builds the initramfs with our dracut module
'packager' builds/packs the stage4 rootfs
Diffstat (limited to 'builder/dnbd3-qcow2-rootfs/debugging_tools/network.functions')
| -rw-r--r-- | builder/dnbd3-qcow2-rootfs/debugging_tools/network.functions | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/builder/dnbd3-qcow2-rootfs/debugging_tools/network.functions b/builder/dnbd3-qcow2-rootfs/debugging_tools/network.functions new file mode 100644 index 00000000..89ca5a20 --- /dev/null +++ b/builder/dnbd3-qcow2-rootfs/debugging_tools/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 |
