#! /bin/sh
#
# Start or stop dhclient daemon
#

# If /sbin/dhclient does not exist, or if it exists but
#	/sbin/cardmgr exists we do not try to start the
#	dhclient daemon. If /sbin/cardmgr exists then that
#	means that PCMCIA is installed and that dhclient will be started 
#	by the cardmgr daemon.
test -x /sbin/dhclient -a ! -f /sbin/cardmgr || exit 0

DHCLIENTPID=/var/run/dhclient.pid

case "$1" in
	start)
		start-stop-daemon --start --quiet --pidfile $DHCLIENTPID \
			--exec /sbin/dhclient
		;;
	stop)
		start-stop-daemon --stop --quiet --pidfile $DHCLIENTPID
		;;
	restart)
		start-stop-daemon --stop --quiet --pidfile $DHCLIENTPID
		sleep 2
		start-stop-daemon --start --quiet --pidfile $DHCLIENTPID \
			--exec /sbin/dhclient
		;;
	*)
		echo "Usage: /etc/init.d/dhcp-client {start|stop|restart}"
		exit 1 
esac

exit 0
