#! /bin/sh # # $FreeBSD$ # # PROVIDE: dhcrelay # REQUIRE: DAEMON # # Add the following line to /etc/rc.conf to enable dhcrelay: # # dhcrelay_enable="YES" # # override these variables in /etc/rc.conf dhcrelay_enable=${dhcrelay_enable:-"NO"} dhcrelay_flags=${dhcrelay_flags:-} # command option(s) dhcrelay_servers=${dhcrelay_servers:-} # dhcrelay server(s) dhcrelay_ifaces=${dhcrelay_ifaces:-} # ethernet interface(s) dhcrelay_precmd () { local ifaces dhcrelay_rcconf=%%PREFIX%%/etc/rc.isc-dhcrelay.conf if [ -f ${dhcrelay_rcconf} ]; then warn "${dhcrelay_rcconf} is obsolete, use /etc/rc.conf instead." . ${dhcrelay_rcconf} if [ -n "${dhcrelay_options}" -a -z "${rc_flags}" ]; then warn "dhcrelay_options is obsolete, use dhcrelay_flags instead." rc_flags=${dhcrelay_options} fi fi if [ -z "${dhcrelay_servers}" ]; then err 1 "no dhcrelay server(s) configured." fi ifaces= for iface in ${dhcrelay_ifaces}; do ifaces="${ifaces} -i ${iface}" done rc_flags="${rc_flags} ${ifaces} ${dhcrelay_servers}" } . %%RC_SUBR%% name=dhcrelay rcvar=${name}_enable command=%%PREFIX%%/sbin/${name} pidfile=/var/run/${name}.pid start_precmd=${name}_precmd load_rc_config ${name} run_rc_command "$1"