xref: /minix/etc/rc.d/dhcpcd (revision 9f20bfa6)
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
12extra_commands="reload"
13
14load_rc_config $name
15
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.
19if [ -n "$flags" ]; then
20	myflags=$flags
21else
22	eval myflags=\$${name}_flags
23fi
24ifname="${myflags##* }"
25myflags="${myflags%% $ifname}"
26last_flag="${myflags##* }"
27if /sbin/ifconfig "$ifname" >/dev/null 2>&1 &&
28    ! /sbin/ifconfig "$last_flag" >/dev/null 2>&1
29then
30	pidfile=/var/run/$name-"$ifname".pid
31else
32	pidfile=/var/run/$name.pid
33fi
34unset myflags ifname last_flag
35
36run_rc_command "$1"
37