#set -x
CONFIG=/flash/.network
if [ ! -e $CONFIG ]; then
        echo "To change the default route & set hostname, create and populate $CONFIG"
        echo "HOSTNAME=<name>"
        echo "GATEWAY=<IP Address of default route>"
        exit 1
fi
# source the config file
. $CONFIG
echo "Configuring network"
# sanity check for HOSTNAME set to something -- no more error checks!
if [ -n "$HOSTNAME" ]; then
	/bin/busybox hostname $HOSTNAME
fi
# sanity check for GATEWAY set to something -- no more error checks!
if [ -n "$GATEWAY" ]; then
	# don't show errors (like no default route)
	route del default 2>/dev/null 1>/dev/null
	route add default gw $GATEWAY
fi
# ensure this script returns true
/bin/true

