freebsd-skq/etc/rc.d/dhclient
Mike Makonnen d679c13014 The dhcp_program and dhcp_flags variables have to be renamed to
take advantage of the rc.subr(8) glue. They are renamed dhclient_program
and dhclient_flags.
	o Rename them in rc.conf(5)
	o Rename them in /etc/defaults/rc.conf
	o Add the deprecated variables to /etc/rc.subr
	o Isolate the use  of the 'command' variable to the
	  NetBSD specific parts in /etc/rc.d/dhclient.
	o Now that dhcp_flags has also been renamed it will
	  be applied properly by rc.subr(8) glue code.

Reported by:	John Nielsen <john@jnielsen.net>
2003-06-07 10:31:17 +00:00

59 lines
965 B
Bash
Executable File

#!/bin/sh
#
# $NetBSD: dhclient,v 1.8 2002/03/22 04:33:58 thorpej Exp $
# $FreeBSD$
#
# PROVIDE: dhclient
# REQUIRE: network netif mountcritlocal
# BEFORE: NETWORKING
# KEYWORD: FreeBSD NetBSD
#
# Note that there no syslog logging of dhclient messages at boot because
# dhclient needs to start before services that syslog depends upon do.
#
. /etc/rc.subr
. /etc/network.subr
name="dhclient"
pidfile="/var/run/${name}.pid"
case "${OSTYPE}" in
FreeBSD)
rcvar=
start_precmd="dhclient_prestart"
start_postcmd="dhclient_poststart"
;;
NetBSD)
rcvar=$name
command="/sbin/${name}"
;;
esac
dhclient_prestart()
{
dhcp_list="`list_net_interfaces dhcp`"
if [ -z "$dhcp_list" ]; then
return 1
fi
for ifn in ${dhcp_list}; do
ifscript_up ${ifn}
done
rc_flags="${rc_flags} ${dhcp_list}"
return 0
}
dhclient_poststart()
{
for ifn in ${dhcp_list}; do
ifalias_up ${ifn}
ipx_up ${ifn}
ifconfig ${ifn}
done
}
load_rc_config $name
run_rc_command "$1"