summaryrefslogtreecommitdiffstats
path: root/etc/rc.d/dhclient
blob: 8faf0ecd35e4300e65e2295cae7ccdee83126977 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/sh
#
# $FreeBSD$
#

# PROVIDE: dhclient
# KEYWORD: nojail nostart

. /etc/rc.subr
. /etc/network.subr

ifn="$2"

name="dhclient"
rcvar=
pidfile="/var/run/${name}.${ifn}.pid"
start_precmd="dhclient_prestart"

dhclient_prestart()
{
	# Interface-specific flags (see rc.subr for $flags setting)
	specific=$(get_if_var $ifn dhclient_flags_IF)
	if [ -z "$flags" -a -n "$specific" ]; then
		rc_flags=$specific
	fi

	background_dhclient=$(get_if_var $ifn background_dhclient_IF $background_dhclient)
	if checkyesno background_dhclient; then
		rc_flags="${rc_flags} -b"
	fi

	rc_flags="${rc_flags} ${ifn}"
}

load_rc_config $name
load_rc_config network

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
elif [ -n "${rc_force}" ] && ! dhcpif $ifn; then
	return 1
fi

run_rc_command "$1"
OpenPOWER on IntegriCloud