mirror of
https://git.FreeBSD.org/ports.git
synced 2024-12-22 04:17:44 +00:00
91 lines
2.0 KiB
Bash
91 lines
2.0 KiB
Bash
#!/bin/sh
|
|
#
|
|
|
|
# PROVIDE: quagga
|
|
# REQUIRE: NETWORKING %%RCLDCONFIG%%
|
|
|
|
#
|
|
# Add the following line to /etc/rc.conf to enable quagga:
|
|
#quagga_enable="YES"
|
|
#
|
|
# You may also wish to use the following variables to fine-tune startup:
|
|
# quagga_flags="-d"
|
|
# quagga_daemons="zebra ripd ripngd ospfd ospf6d bgpd isisd"
|
|
# Per daemon tuning may be done with daemon_name_flags
|
|
# zebra_flags="-dP 0"
|
|
# bgpd_flags="-dnrP 0" and so on
|
|
# If you want to give the routing deamons a chance to catchup before
|
|
# continueing, set quagga_delay to a certain amount of seconds.
|
|
# quagga_delay="30"
|
|
#
|
|
#
|
|
# If the quagga daemons require additional shared libraries to start,
|
|
# use the following variable to run ldconfig(8) in advance:
|
|
#quagga_extralibs_path="/usr/local/lib ..."
|
|
#
|
|
|
|
. %%RC_SUBR%%
|
|
|
|
name="quagga"
|
|
rcvar=`set_rcvar`
|
|
|
|
|
|
stop_postcmd=stop_postcmd
|
|
|
|
stop_postcmd()
|
|
{
|
|
rm -f $pidfile
|
|
}
|
|
|
|
# set defaults
|
|
|
|
load_rc_config $name
|
|
|
|
: ${quagga_enable="NO"}
|
|
: ${quagga_flags="-d"}
|
|
: ${quagga_daemons="zebra ripd ripngd ospfd ospf6d bgpd isisd"}
|
|
: ${quagga_extralibs_path=""}
|
|
: ${quagga_delay="0"}
|
|
|
|
quagga_cmd=$1
|
|
|
|
case "$1" in
|
|
force*)
|
|
quagga_cmd=${quagga_cmd#force}
|
|
;;
|
|
fast*)
|
|
quagga_cmd=${quagga_cmd#fast}
|
|
;;
|
|
esac
|
|
|
|
case "${quagga_cmd}" in
|
|
start)
|
|
if [ ! -z ${quagga_extralibs_path} ]; then
|
|
/sbin/ldconfig -m ${quagga_extralibs_path}
|
|
fi
|
|
;;
|
|
stop|restart)
|
|
quagga_daemons=$(reverse_list ${quagga_daemons})
|
|
;;
|
|
esac
|
|
|
|
for daemon in ${quagga_daemons}; do
|
|
command=%%PREFIX%%/sbin/${daemon}
|
|
required_files=%%SYSCONF_DIR%%/${daemon}.conf
|
|
pidfile=%%LOCALSTATE_DIR%%/${daemon}.pid
|
|
if [ ${quagga_cmd} = "start" -a ! -f ${required_files} ]; then
|
|
continue
|
|
fi
|
|
if [ ${quagga_cmd} = "stop" -a -z $(check_process ${command}) ]; then
|
|
continue
|
|
fi
|
|
eval flags=\$\{${daemon}_flags:-\"${quagga_flags}\"\}
|
|
run_rc_command "$1"
|
|
_rc_restart_done=false
|
|
done
|
|
|
|
if [ "${quagga_delay}" != "0" ]; then
|
|
echo "Sleeping ${quagga_delay} seconds to obtain dynamic routing information..."
|
|
sleep ${quagga_delay}
|
|
fi
|