Home | History | Annotate | Line # | Download | only in rc.d
dhcpcd revision 1.3
      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 extra_commands="reload"
     13 
     14 load_rc_config $name
     15 
     16 # If the last argument to dhcpcd is a valid interface and the prior argument
     17 # is not then dhcpcd will start on one interface only and create a pidfile
     18 # based on the interface name. See PR bin/43490.
     19 if [ -n "$flags" ]; then
     20 	myflags=$flags
     21 else
     22 	eval myflags=\$${name}_flags
     23 fi
     24 ifname="${myflags##* }"
     25 myflags="${myflags%% $ifname}"
     26 last_flag="${myflags##* }"
     27 if /sbin/ifconfig "$ifname" >/dev/null 2>&1 && 
     28     ! /sbin/ifconfig "$last_flag" >/dev/null 2>&1
     29 then
     30 	pidfile=/var/run/$name-"$ifname".pid
     31 else
     32 	pidfile=/var/run/$name.pid
     33 fi
     34 unset myflags ifname last_flag
     35 
     36 run_rc_command "$1"
     37