#!/bin/sh # $FreeBSD$ # # PROVIDE: dhcrelay # REQUIRE: DAEMON # KEYWORD: shutdown # # 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"} dhcrelay6_enable=${dhcrelay6_enable:-"NO"} # dhcrelay_flags="" # command option(s) # dhcrelay_servers="" # dhcrelay server(s) # dhcrelay_ifaces="" # ethernet interface(s) case $0 in /etc/rc*) # during boot (shutdown) $0 is /etc/rc (/etc/rc.shutdown), # so get the name of the script from $_file name=$_file ;; *) name=$0 ;; esac name=${name##*/isc-} case ${name} in *6) ipversion=-6 ;; *) ipversion=-4 ;; esac dhcrelay_precmd () { local ifaces _servers _ifaces eval "_servers=\${${name}_servers}" eval "_ifaces=\${${name}_ifaces}" if [ -z "${_servers}" ]; then err 1 "no ${name} server(s) configured." fi ifaces= for iface in ${_ifaces}; do ifaces="${ifaces} -i ${iface}" done rc_flags="${rc_flags} ${ipversion} ${ifaces} ${_servers}" } . /etc/rc.subr rcvar=${name}_enable command=%%PREFIX%%/sbin/${name} pidfile=/var/run/${name}.pid start_precmd=${name}_precmd load_rc_config ${name} run_rc_command "$1"