#! /bin/sh
#
#  Sensorgnome dual-purpose eth0 logic:
#
# Otherwise, we set up a fixed address 192.168.9.2 on eth0, and run
# udhcp on eth0 so that users can connect to the SG by plugging in to
# the ethernet port, if their laptop is set to obtain an IP address
# automatically on their wired interface.
#
# Simultaneously, we run dhclient on eth0, in case the user has hooked the
# SG up to a router.  In this case, if an address is received, the SG
# uses it to dial out to the server at sensorgnome.org, and the eth0
# interface cannot be used for an incoming connection to the web interface.
# (It is of course possible to tunnel back a connection to the web interface
# through the outgoing ssh connection).

# Written by Miquel van Smoorenburg <miquels@cistron.nl>.
# Modified for Debian GNU/Linux by Ian Murdock <imurdock@gnu.ai.mit.edu>
# and Axel Beckert <abe@deuxchevaux.org>.
#
### BEGIN INIT INFO
# Provides:          eth0-config
# Required-Start:    $syslog
# Required-Stop:     $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start busybox udhcpd at boot time
### END INIT INFO

## remove any existing leases 
rm -rf /var/lib/dhcp/dhclient.eth0.leases /var/lib/dhcp/dhclient.leases

## kill any existing dhclient
dhclient -r eth0

## try the dhclient once
dhclient -1 eth0
