Tue Jun 25 13:02:53 2013 UTC ()
Add a hack to fix the dhcpcd rc.d script to work with a single
interface specified in dhcpcd_flags in rc.conf(5).
Fixes PR bin/43490


(roy)
diff -r1.1 -r1.2 src/etc/rc.d/dhcpcd

cvs diff -r1.1 -r1.2 src/etc/rc.d/dhcpcd (expand / switch to unified diff)

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