diff --git a/net/quagga/files/quagga.sh b/net/quagga/files/quagga.sh new file mode 100644 index 000000000000..8e8f2f189cd0 --- /dev/null +++ b/net/quagga/files/quagga.sh @@ -0,0 +1,61 @@ +#!/bin/sh +# + +# PROVIDE: quagga +# REQUIRE: netif routing +# KEYWORD: FreeBSD shutdown + +# +# Add the following lines to /etc/rc.conf to enable quagga: +# +#quagga_enable="YES" +# + +. %%RC_SUBR%% + +name="quagga" +rcvar=`set_rcvar` + + +stop_postcmd=stop_postcmd + +stop_postcmd() +{ + rm -f $pidfile +} + +# set defaults + +quagga_enable=${quagga_enable:-"NO"} +quagga_flags=${quagga_flags:-"-d"} +load_rc_config $name + +QUAGGA_DAEMONS="zebra ripd ripng ospfd ospf6d bgpd" + +quagga_cmd=$1 + +case "$1" in + force*) + quagga_cmd=${quagga_cmd#force} + ;; + fast*) + quagga_cmd=${quagga_cmd#fast} + ;; +esac + +if [ ${quagga_cmd} = "stop" ]; then + QUAGGA_DAEMONS=$(reverse_list ${QUAGGA_DAEMONS}) +fi + +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 + run_rc_command "$1" +done diff --git a/net/quagga/files/zebractl.sh b/net/quagga/files/zebractl.sh deleted file mode 100644 index bdc597fcc77d..000000000000 --- a/net/quagga/files/zebractl.sh +++ /dev/null @@ -1,57 +0,0 @@ -#! /bin/sh -# -# $FreeBSD: /tmp/pcvs/ports/net/quagga/files/Attic/zebractl.sh,v 1.2 2003-11-05 15:19:55 bms Exp $ -# -# zebra start/stop script by "Andreas Klemm " -# - -usage() -{ - echo "$0: usage: $0 [ start | stop | restart ]" - exit 1 -} - -if [ $# -lt 1 ]; then - echo "$0: error: one argument needed"; usage -elif [ $# -gt 1 ]; then - echo "$0: error: only one argument needed"; usage -fi - -case $1 in - start) - if [ ! -f !!SYSCONF_DIR!!/zebra.conf ]; then - echo "error: zebra.conf config file is mandatory" - exit 1 - fi - [ -f !!SYSCONF_DIR!!/zebra.conf ] \ - && !!PREFIX!!/sbin/zebra -d && echo -n ' zebra' - [ -f !!SYSCONF_DIR!!/ripd.conf ] \ - && !!PREFIX!!/sbin/ripd -d && echo -n ' ripd' - [ -f !!SYSCONF_DIR!!/ripngd.conf ] \ - && !!PREFIX!!/sbin/ripngd -d && echo -n ' ripngd' - [ -f !!SYSCONF_DIR!!/ospfd.conf ] \ - && !!PREFIX!!/sbin/ospfd -d && echo -n ' ospfd' - [ -f !!SYSCONF_DIR!!/ospf6d.conf ] \ - && !!PREFIX!!/sbin/ospf6d -d && echo -n ' ospf6d' - [ -f !!SYSCONF_DIR!!/bgpd.conf ] \ - && !!PREFIX!!/sbin/bgpd -d && echo -n ' bgpd' - ;; - - stop) - [ -f !!SYSCONF_DIR!!/ripd.conf ] && killall ripd - [ -f !!SYSCONF_DIR!!/ripngd.conf ] && killall ripngd - [ -f !!SYSCONF_DIR!!/ospfd.conf ] && killall ospfd - [ -f !!SYSCONF_DIR!!/ospf6d.conf ] && killall ospf6d - [ -f !!SYSCONF_DIR!!/bgpd.conf ] && killall bgpd - [ -f !!SYSCONF_DIR!!/zebra.conf ] && killall zebra - ;; - restart) - $0 stop - $0 start - ;; - - *) echo "$0: error: unknown option $1" - usage - ;; -esac -exit 0