2001-06-16 07:16:14 +00:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
2002-06-13 22:14:37 +00:00
|
|
|
# $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
|
|
|
|
2011-10-13 17:20:45 +00:00
|
|
|
ifn="$2"
|
|
|
|
|
2001-06-16 07:16:14 +00:00
|
|
|
name="dhclient"
|
2004-01-17 10:40:45 +00:00
|
|
|
rcvar=
|
2011-10-13 17:20:45 +00:00
|
|
|
pidfile="/var/run/${name}.${ifn}.pid"
|
|
|
|
start_precmd="dhclient_prestart"
|
2003-04-18 17:53:02 +00:00
|
|
|
|
2011-10-13 17:20:45 +00:00
|
|
|
dhclient_prestart()
|
2003-04-18 17:53:02 +00:00
|
|
|
{
|
2011-10-13 17:20:45 +00:00
|
|
|
# Interface-specific flags (see rc.subr for $flags setting)
|
|
|
|
specific=$(get_if_var $ifn dhclient_flags_IF)
|
2006-08-17 17:12:27 +00:00
|
|
|
if [ -z "$flags" -a -n "$specific" ]; then
|
|
|
|
rc_flags=$specific
|
|
|
|
fi
|
|
|
|
|
2011-10-13 17:20:45 +00:00
|
|
|
background_dhclient=$(get_if_var $ifn background_dhclient_IF $background_dhclient)
|
2007-03-25 19:45:20 +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
|
|
|
|
|
2011-10-13 17:20:45 +00:00
|
|
|
rc_flags="${rc_flags} ${ifn}"
|
2003-04-18 17:53:02 +00:00
|
|
|
}
|
2001-06-16 07:16:14 +00:00
|
|
|
|
2005-06-07 04:49:12 +00:00
|
|
|
load_rc_config $name
|
2006-10-02 18:50:58 +00:00
|
|
|
load_rc_config network
|
2003-06-29 05:34:41 +00:00
|
|
|
|
2011-10-13 17:20:45 +00:00
|
|
|
if [ -z $ifn ] ; then
|
|
|
|
# only complain if a command was specified but no interface
|
|
|
|
if [ -n "$1" ] ; then
|
|
|
|
echo 1>&2 "$0: no interface specified"
|
|
|
|
return 1
|
|
|
|
fi
|
2011-10-17 13:05:57 +00:00
|
|
|
elif [ -z "${rc_force}" ] && ! dhcpif $ifn; then
|
2005-06-07 04:49:12 +00:00
|
|
|
return 1
|
2003-06-29 05:34:41 +00:00
|
|
|
fi
|
|
|
|
|
2001-06-16 07:16:14 +00:00
|
|
|
run_rc_command "$1"
|