[BACK]Return to dhcpcd CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / etc / rc.d

File: [cvs.NetBSD.org] / src / etc / rc.d / dhcpcd (download)

Revision 1.2, Tue Jun 25 13:02:53 2013 UTC (5 years, 8 months ago) by roy
Branch: MAIN
CVS Tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15, riastradh-drm2-base3, riastradh-drm2-base2, riastradh-drm2-base1, riastradh-drm2-base, riastradh-drm2
Branch point for: tls-earlyentropy
Changes since 1.1: +21 -1 lines

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

#!/bin/sh

# PROVIDE: dhcpcd
# REQUIRE: network mountcritlocal
# BEFORE:  NETWORKING

$_rc_subr_loaded . /etc/rc.subr

name=dhcpcd
rcvar=$name
command=/sbin/$name

load_rc_config $name

# If the last argument to dhcpcd is a valid interface and the prior argument
# is not then dhcpcd will start on one interface only and create a pidfile
# based on the interface name. See PR bin/43490.
if [ -n "$flags" ]; then
	myflags=$flags
else
	eval myflags=\$${name}_flags
fi
ifname="${myflags##* }"
myflags="${myflags%% $ifname}"
last_flag="${myflags##* }"
if /sbin/ifconfig "$ifname" >/dev/null 2>&1 && 
    ! /sbin/ifconfig "$last_flag" >/dev/null 2>&1
then
	pidfile=/var/run/$name-"$ifname".pid
else
	pidfile=/var/run/$name.pid
fi
unset myflags ifname last_flag

run_rc_command "$1"