Home | History | Annotate | Line # | Download | only in rc.d
dhcpcd revision 1.2
      1 #!/bin/sh
      2 
      3 # PROVIDE: dhcpcd
      4 # REQUIRE: network mountcritlocal
      5 # BEFORE:  NETWORKING
      6 
      7 $_rc_subr_loaded . /etc/rc.subr
      8 
      9 name=dhcpcd
     10 rcvar=$name
     11 command=/sbin/$name
     12 
     13 load_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.
     18 if [ -n "$flags" ]; then
     19 	myflags=$flags
     20 else
     21 	eval myflags=\$${name}_flags
     22 fi
     23 ifname="${myflags##* }"
     24 myflags="${myflags%% $ifname}"
     25 last_flag="${myflags##* }"
     26 if /sbin/ifconfig "$ifname" >/dev/null 2>&1 && 
     27     ! /sbin/ifconfig "$last_flag" >/dev/null 2>&1
     28 then
     29 	pidfile=/var/run/$name-"$ifname".pid
     30 else
     31 	pidfile=/var/run/$name.pid
     32 fi
     33 unset myflags ifname last_flag
     34 
     35 run_rc_command "$1"
     36