2001-06-16 07:16:14 +00:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
2002-06-13 22:14:37 +00:00
|
|
|
# $NetBSD: dhclient,v 1.8 2002/03/22 04:33:58 thorpej Exp $
|
|
|
|
# $FreeBSD$
|
2001-06-16 07:16:14 +00:00
|
|
|
#
|
|
|
|
|
|
|
|
# PROVIDE: dhclient
|
2005-06-07 04:49:12 +00:00
|
|
|
# KEYWORD: nojail nostart
|
2001-06-16 07:16:14 +00:00
|
|
|
#
|
|
|
|
|
|
|
|
. /etc/rc.subr
|
2003-04-18 17:53:02 +00:00
|
|
|
. /etc/network.subr
|
2001-06-16 07:16:14 +00:00
|
|
|
|
|
|
|
name="dhclient"
|
2004-01-17 10:40:45 +00:00
|
|
|
rcvar=
|
2005-06-07 04:49:12 +00:00
|
|
|
start_cmd="dhclient_start"
|
|
|
|
stop_cmd="dhclient_stop"
|
2003-04-18 17:53:02 +00:00
|
|
|
|
2005-06-07 04:49:12 +00:00
|
|
|
dhclient_start()
|
2003-04-18 17:53:02 +00:00
|
|
|
{
|
2006-07-09 06:54:24 +00:00
|
|
|
# prevent unnecessary restarts
|
2005-06-07 04:49:12 +00:00
|
|
|
# XXX: should use a pidfile
|
|
|
|
if [ -x /usr/bin/pgrep ]; then
|
|
|
|
pids=`/usr/bin/pgrep -f "dhclient: $ifn(\$| .*)"`
|
|
|
|
if [ -n "$pids" ]; then
|
|
|
|
exit 0
|
2003-06-29 05:34:41 +00:00
|
|
|
fi
|
|
|
|
fi
|
2003-04-20 19:14:16 +00:00
|
|
|
|
2003-07-28 08:15:52 +00:00
|
|
|
if checkyesno background_dhclient; then
|
2005-06-07 04:49:12 +00:00
|
|
|
rc_flags="${rc_flags} -b"
|
2003-07-28 08:15:52 +00:00
|
|
|
fi
|
|
|
|
|
2005-06-07 04:49:12 +00:00
|
|
|
${dhclient_program} ${rc_flags} $ifn
|
2003-04-18 17:53:02 +00:00
|
|
|
}
|
|
|
|
|
2005-06-07 04:49:12 +00:00
|
|
|
dhclient_stop()
|
2003-04-18 17:53:02 +00:00
|
|
|
{
|
2005-06-07 04:49:12 +00:00
|
|
|
ifconfig $ifn down # cause dhclient to die
|
2003-04-18 17:53:02 +00:00
|
|
|
}
|
2001-06-16 07:16:14 +00:00
|
|
|
|
2005-06-07 04:49:12 +00:00
|
|
|
ifn="$2"
|
2003-06-29 05:34:41 +00:00
|
|
|
|
2005-06-07 04:49:12 +00:00
|
|
|
load_rc_config $name
|
2003-06-29 05:34:41 +00:00
|
|
|
|
2005-06-07 04:49:12 +00:00
|
|
|
if ! dhcpif $ifn; then
|
|
|
|
return 1
|
2003-06-29 05:34:41 +00:00
|
|
|
fi
|
|
|
|
|
2001-06-16 07:16:14 +00:00
|
|
|
run_rc_command "$1"
|