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