dhclient revision 226464
1#!/bin/sh 2# 3# $FreeBSD: head/etc/rc.d/dhclient 226464 2011-10-17 13:05:57Z des $ 4# 5 6# PROVIDE: dhclient 7# KEYWORD: nojail nostart 8 9. /etc/rc.subr 10. /etc/network.subr 11 12ifn="$2" 13 14name="dhclient" 15rcvar= 16pidfile="/var/run/${name}.${ifn}.pid" 17start_precmd="dhclient_prestart" 18 19dhclient_prestart() 20{ 21 # Interface-specific flags (see rc.subr for $flags setting) 22 specific=$(get_if_var $ifn dhclient_flags_IF) 23 if [ -z "$flags" -a -n "$specific" ]; then 24 rc_flags=$specific 25 fi 26 27 background_dhclient=$(get_if_var $ifn background_dhclient_IF $background_dhclient) 28 if checkyesno background_dhclient; then 29 rc_flags="${rc_flags} -b" 30 fi 31 32 rc_flags="${rc_flags} ${ifn}" 33} 34 35load_rc_config $name 36load_rc_config network 37 38if [ -z $ifn ] ; then 39 # only complain if a command was specified but no interface 40 if [ -n "$1" ] ; then 41 echo 1>&2 "$0: no interface specified" 42 return 1 43 fi 44elif [ -z "${rc_force}" ] && ! dhcpif $ifn; then 45 return 1 46fi 47 48run_rc_command "$1" 49