net-online: wait for ping_test_host

The script should wait till the ping host is available or timeout reached
Closes : #179
Closes : #191
This commit is contained in:
bell07 2017-12-12 21:51:55 +01:00 committed by William Hubbs
parent 8bf501aaf2
commit 14938c29ce

View File

@ -63,8 +63,12 @@ start ()
if [ $rc -eq 0 ] && yesno ${include_ping_test:-no}; then
ping_test_host="${ping_test_host:-google.com}"
if [ -n "$ping_test_host" ]; then
while $infinite || [ $timeout -gt 0 ]; do
ping -c 1 $ping_test_host > /dev/null 2>&1
rc=$?
[ $rc -eq 0 ] && break
: $((timeout -= 1))
done
fi
fi
eend $rc "The network is offline"