dhcpcd: Remove chroot setup and restore things as they were before
[dragonfly.git] / etc / rc.d / dhcpcd
CommitLineData
4eba35c8
AL
1#!/bin/sh
2
3# PROVIDE: dhcpcd
648d1277 4# REQUIRE: mountcritlocal cleanvar
e4185cf0 5# BEFORE: mountcritremote
4f054023 6# KEYWORD: nojail
4eba35c8
AL
7
8. /etc/rc.subr
9. /etc/network.subr
10
11name="dhcpcd"
12rcvar=
13command="/sbin/$name"
14extra_commands="reload"
15
16load_rc_config $name
17load_rc_config network
18
19ifn="$2"
20if [ -z "$ifn" ]; then
21 rcvar=`set_rcvar` # running in master mode
22else
23 _if_args="$(get_if_var $ifn dhcpcd_flags_IF)"
24 if dhcpif $ifn ipv4 && dhcpif $ifn ipv6; then
25 command_args="$ifn"
26 elif dhcpif $ifn ipv4; then
27 command_args="-4 $ifn"
28 elif dhcpif $ifn ipv6; then
29 command_args="-6 $ifn"
30 else
31 err 1 "$ifn is not enabled for DHCP (IPv4/IPv6)"
32 fi
33fi
34
35# Work out what pidfile dhcpcd will use based on flags
36if [ -n "$flags" ]; then
37 _flags=$flags
38elif [ -n "$_if_args" ]; then
39 _flags=$_if_args
40else
41 eval _flags=\$${name}_flags
42fi
43pidfile=$($command -P $_flags $command_args 2>/dev/null)
44: ${pidfile:=/var/run/$name.pid}
45unset _flags _if_args
46
2b2ab49c 47run_rc_command "$@"