aboutsummaryrefslogtreecommitdiffstats
path: root/net/dhcpcd/files/dhcpcd.in
blob: e9695b34f5e4f340ca5d7e5f1447337b75452e96 (plain) (blame)
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
#!/bin/sh

# PROVIDE: dhclient
# KEYWORD: nojail nostart
#

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

name="dhcpcd"
ifn="$2"
command="%%PREFIX%%/sbin/dhcpcd"
command_args="$ifn"
if [ -n "$ifn" ]; then
    specific="$(get_if_var $ifn dhcpcd_flags_IF)"
    if [ -z "$flags" -a -n "$specific" ]; then
        rc_flags="$specific"
    fi
    pidfile="/var/run/dhcpcd-$ifn.pid"
else
    pidfile="$($command -P $rc_flags)"
fi
start_precmd="dhcpcd_precmd"

dhcpcd_precmd()
{
    # dhcpcd may need local binaries
    export PATH=${PATH}:/usr/local/sbin
}

load_rc_config $name
load_rc_config network

if [ -n "$ifn" ]; then
    if ! dhcpif $ifn; then
        err 1 "$ifn is not enabled for DHCP"
    fi
fi

run_rc_command "$1"