#!/sbin/sh

# Script to be used with the DHCP client program for
#
# start - getting an IP address and other configuration info
# stop  - to kill a running client
# verify - to verify existing lease (will also extend it)
# surrender - to surrender the current lease

# $Revision: 1.2 $

IS_ON=/sbin/chkconfig
PROCLAIM=/usr/etc/proclaim
KILLALL=/sbin/killall

if $IS_ON autoconfig_ipaddress; then
    :
else
    exit 0
fi

if $IS_ON verbose ; then
    ECHO=echo
    VERBOSE=-v
else		# For a quiet startup and shutdown
    ECHO=:
    VERBOSE=
fi
	

case "$1" in
'start')
	$ECHO -n "IP Address Configuration: "
	$KILLALL proclaim
	$PROCLAIM -i
	$ECHO "done."
	;;

'stop')
	$KILLALL proclaim
	;;

'surrender')
	if $KILLALL -USR1 proclaim; then
		:
	else
		$ECHO "Try: $PROCLAIM -d -s server_addr"
	fi
	;;

'verify')
	if $KILLALL -USR2 proclaim; then
		:
	else
		$PROCLAIM -i
	fi
	;;
'status')
	$PROCLAIM -p
	;;

*)
    $ECHO "usage: $0 {start|stop|surrender|verify|status}"
    exit 1
    ;;
esac

