#!/bin/sh
# dhcpv3 client script for whereami
# Chris Halls <chris.halls@gmx.de>
#
# Information about the lease is saved in
# /var/lib/whereami/dhclient3.<interface>, so
# subsequent invocations of whereami can use 
# this information and whereami is started to
# determine whether the computer should be
# reconfigured

# Just exit if whereami is no longer installed
test ! -e /usr/sbin/whereami && exit 1

statefile=${STATEDIR:-"/var/lib/whereami"}/dhclient.$interface

# save state to file
(
    echo "# Generated by $0 - do not edit!"
    for I in reason new_ip_address alias_ip_address interface medium new_subnet_mask
      do
        eval echo "$I=\$$I"
    done
) > $statefile

# echo Reason:$reason
# cat $statefile

case "$reason" in
  REBOOT|BOUND) 
	/usr/sbin/whereami --run_from dhclient --syslog --hint dhclient
	;;
esac

