dhcpcd revision 1.4
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##* }" 27# Address the problem of having just dhcpcd_flags=wm0 28if [ "$myflags" = "$last_flag" ]; then 29 last_flag="invalidinterfacename" 30fi 31if /sbin/ifconfig "$ifname" >/dev/null 2>&1 && 32 ! /sbin/ifconfig "$last_flag" >/dev/null 2>&1 33then 34 pidfile=/var/run/$name-"$ifname".pid 35else 36 pidfile=/var/run/$name.pid 37fi 38unset myflags ifname last_flag 39 40run_rc_command "$1" 41