1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-16 10:20:30 +00:00
freebsd/etc/rc.d/dhclient
Brooks Davis 12d828393a Pull in /etc/rc.conf.d/network so that ifconfig_<if> variables can be
set there.  This is required for consistency with /etc/rc.d/netif.

PR:		conf/103893
Submitted by:	Nick Hibma <nick at anywi.com>
MFC after:	3 days
2006-10-02 18:50:58 +00:00

63 lines
1.1 KiB
Bash
Executable File

#!/bin/sh
#
# $NetBSD: dhclient,v 1.8 2002/03/22 04:33:58 thorpej Exp $
# $FreeBSD$
#
# PROVIDE: dhclient
# KEYWORD: nojail nostart
#
. /etc/rc.subr
. /etc/network.subr
name="dhclient"
rcvar=
start_cmd="dhclient_start"
stop_cmd="dhclient_stop"
dhclient_start()
{
# prevent unnecessary restarts
# XXX: should use a pidfile
if [ -x /usr/bin/pgrep ]; then
pids=`/usr/bin/pgrep -f "dhclient: $ifn(\$| .*)"`
if [ -n "$pids" ]; then
exit 0
fi
fi
# Override for $ifn specific flags (see rc.subr for $flags setting)
eval specific=\$dhclient_flags_$ifn
if [ -z "$flags" -a -n "$specific" ]; then
rc_flags=$specific
fi
eval specific=\$background_dhclient_$ifn
if [ -n "$specific" ]; then
if checkyesno background_dhclient_$ifn; then
rc_flags="${rc_flags} -b"
fi
elif checkyesno background_dhclient; then
rc_flags="${rc_flags} -b"
fi
${dhclient_program} ${rc_flags} $ifn
}
dhclient_stop()
{
ifconfig $ifn down # cause dhclient to die
}
ifn="$2"
load_rc_config $name
load_rc_config network
if ! dhcpif $ifn; then
return 1
fi
run_rc_command "$1"