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