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