Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/etc/rc.d Use the new -P option to work out which pidfile dhc...



details:   https://anonhg.NetBSD.org/src/rev/3593b0a28cd7
branches:  trunk
changeset: 342766:3593b0a28cd7
user:      roy <roy%NetBSD.org@localhost>
date:      Thu Jan 07 22:03:00 2016 +0000

description:
Use the new -P option to work out which pidfile dhcpcd will use.

diffstat:

 etc/rc.d/dhcpcd |  24 ++++++------------------
 1 files changed, 6 insertions(+), 18 deletions(-)

diffs (44 lines):

diff -r 903415d90419 -r 3593b0a28cd7 etc/rc.d/dhcpcd
--- a/etc/rc.d/dhcpcd   Thu Jan 07 21:58:28 2016 +0000
+++ b/etc/rc.d/dhcpcd   Thu Jan 07 22:03:00 2016 +0000
@@ -1,5 +1,7 @@
 #!/bin/sh
 
+# $NetBSD: dhcpcd,v 1.5 2016/01/07 22:03:00 roy Exp $
+
 # PROVIDE: dhcpcd
 # REQUIRE: network mountcritlocal
 # BEFORE:  NETWORKING
@@ -13,28 +15,14 @@
 
 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.
+# Work out what pidfile dhcpcd will use based on flags
 if [ -n "$flags" ]; then
        myflags=$flags
 else
        eval myflags=\$${name}_flags
 fi
-ifname="${myflags##* }"
-myflags="${myflags%% $ifname}"
-last_flag="${myflags##* }"
-# Address the problem of having just dhcpcd_flags=wm0
-if [ "$myflags" = "$last_flag" ]; then
-       last_flag="invalidinterfacename"
-fi
-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
+pidfile=$(eval $command -P $myflags 2>/dev/null)
+: ${pidfile:=/var/run/$name.pid}
+unset myflags
 
 run_rc_command "$1"



Home | Main Index | Thread Index | Old Index