X-Git-Url: http://git.onelab.eu/?p=bootcd.git;a=blobdiff_plain;f=initscripts%2Fpl_netinit;h=6fac9901265ac01158e59c9bde55c1ac0eda3dd9;hp=8dd8714aa9d1008e6e0c06e35bae9be9df7d0f13;hb=d49dc966d8bff5ca455091649d3e711cd1539036;hpb=bfa859690146f4980f23fd87272665ceea9bff92 diff --git a/initscripts/pl_netinit b/initscripts/pl_netinit index 8dd8714..6fac990 100755 --- a/initscripts/pl_netinit +++ b/initscripts/pl_netinit @@ -283,9 +283,28 @@ if [[ -z "$ETH_DEVICE" ]]; then net_init_failed fi +# within a systemd-driven startup, we often see this stage +# triggered before the network is actually up +# although of course we have network-online.target +# as a requirement; go figure what systemd actually does.. + +# in any case, let us try to work around that by allowing some delay +# here + +TIMEOUT=30 +while true; do + /sbin/ifconfig $ETH_DEVICE >& /dev/null && continue + TIMEOUT=$(($TIMEOUT-1)) + [ $TIMEOUT -le 0 ] && net_init_failed + sleep 1 + echo $(date "+%H:%M:%S") " pl_netinit: waiting for device $ETH_DEVICE, ${TIMEOUT}s remaining " +done + # actually check to make sure ifconfig succeeds + /sbin/ifconfig $ETH_DEVICE up 2>&1 > /dev/null + if [[ $? -ne 0 ]]; then echo $(date "+%H:%M:%S") " pl_netinit: device $ETH_DEVICE does not exist, most likely" echo $(date "+%H:%M:%S") " pl_netinit: this CD does not have hardware support for your"