aboutsummaryrefslogtreecommitdiffstats
path: root/net/quagga
diff options
context:
space:
mode:
authorbms <bms@FreeBSD.org>2003-11-22 21:37:35 +0800
committerbms <bms@FreeBSD.org>2003-11-22 21:37:35 +0800
commit721b431137675801f0e0a9c7376e0b09e58bd73f (patch)
tree405244278ed71b283cc1465492b80f34a5a1e36b /net/quagga
parent4b4d598178c87341e4c118bd8c7e0d7b18e734d0 (diff)
downloadfreebsd-ports-graphics-721b431137675801f0e0a9c7376e0b09e58bd73f.tar.gz
freebsd-ports-graphics-721b431137675801f0e0a9c7376e0b09e58bd73f.tar.zst
freebsd-ports-graphics-721b431137675801f0e0a9c7376e0b09e58bd73f.zip
Add new rc script, remove old rc script.
Submitted by: Boris Kovalenko
Diffstat (limited to 'net/quagga')
-rw-r--r--net/quagga/files/quagga.sh61
-rw-r--r--net/quagga/files/zebractl.sh57
2 files changed, 61 insertions, 57 deletions
diff --git a/net/quagga/files/quagga.sh b/net/quagga/files/quagga.sh
new file mode 100644
index 00000000000..8e8f2f189cd
--- /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 bdc597fcc77..00000000000
--- 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 <andreas@FreeBSD.ORG>"
-#
-
-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