dhcpcd revision 1.2
1#!/bin/sh
2
3# PROVIDE: dhcpcd
4# REQUIRE: network mountcritlocal
5# BEFORE:  NETWORKING
6
7$_rc_subr_loaded . /etc/rc.subr
8
9name=dhcpcd
10rcvar=$name
11command=/sbin/$name
12
13load_rc_config $name
14
15# If the last argument to dhcpcd is a valid interface and the prior argument
16# is not then dhcpcd will start on one interface only and create a pidfile
17# based on the interface name. See PR bin/43490.
18if [ -n "$flags" ]; then
19	myflags=$flags
20else
21	eval myflags=\$${name}_flags
22fi
23ifname="${myflags##* }"
24myflags="${myflags%% $ifname}"
25last_flag="${myflags##* }"
26if /sbin/ifconfig "$ifname" >/dev/null 2>&1 && 
27    ! /sbin/ifconfig "$last_flag" >/dev/null 2>&1
28then
29	pidfile=/var/run/$name-"$ifname".pid
30else
31	pidfile=/var/run/$name.pid
32fi
33unset myflags ifname last_flag
34
35run_rc_command "$1"
36