#!/bin/sh
#(c) Copyright Barry Kauler 2012, license GPL3 (/usr/share/doc/legal)
#call from: /usr/sbin/delayedrun, quicksetup, ...
#120331 ping -4 for ipv4, refer: http://murga-linux.com/puppy/viewtopic.php?p=616090#616090
#140207 note, /usr/sbin/delayedrun has a possibly better network test.

export LANG=C

IFCONFIG="`ifconfig | grep '^[pwe]' | grep -v 'wmaster'`"
[ ! "$IFCONFIG" ] && exit 1 #no network connection.

ping -4 -c 1 8.8.8.8 #64.233.169.103 #google 111110 address no longer responding.
[ $? -ne 0 ] && exit 2 #ip address not accessable.

ping -4 -c 1 www.google.com
[ $? -ne 0 ] && exit 3 #domain name address not accessable.

exit 0 #success
###END###
