summaryrefslogtreecommitdiff
path: root/pkgsrc/zebra.sh.in
diff options
context:
space:
mode:
authorgdt <gdt>2004-08-31 18:16:36 +0000
committergdt <gdt>2004-08-31 18:16:36 +0000
commitcbd040847df406a618fd58b1a92f33dc424d2ffd (patch)
treedba9649be97470ba79d47dbb7a0ef76f361e7817 /pkgsrc/zebra.sh.in
parent630e48072a4a4685a7c04a7b73ae9170d2f0844a (diff)
2004-08-31 Greg Troxel <gdt@poblano.ir.bbn.com>
* Rename scripts to *.sh.in, and use autoconf-style substitution for prefix and localstatedir.
Diffstat (limited to 'pkgsrc/zebra.sh.in')
-rw-r--r--pkgsrc/zebra.sh.in55
1 files changed, 55 insertions, 0 deletions
diff --git a/pkgsrc/zebra.sh.in b/pkgsrc/zebra.sh.in
new file mode 100644
index 00000000..c2f12a78
--- /dev/null
+++ b/pkgsrc/zebra.sh.in
@@ -0,0 +1,55 @@
+#!/bin/sh
+#
+# zebra is the head of the quagga routing beast
+#
+# PROVIDE: zebra
+# REQUIRE: NETWORKING
+##
+
+PATH=/sbin:/bin:/usr/sbin:/usr/bin:@prefix@/sbin:@prefix@/bin
+export PATH
+
+if [ -f /etc/rc.subr ]
+then
+ . /etc/rc.subr
+fi
+
+name="zebra"
+rcvar=$name
+required_files="@sysconfdir@/${name}.conf"
+command="@prefix@/sbin/${name}"
+command_args="-d"
+
+start_precmd="zebra_precmd"
+stop_postcmd="zebra_postcmd"
+socket_dir=@localstatedir@
+pidfile="${socket_dir}/${name}.pid"
+
+zebra_precmd()
+{
+ mkdir -p "${socket_dir}"
+ chown quagga.quagga "${socket_dir}"
+ chmod 750 "${socket_dir}"
+ rc_flags="$(
+ set -- $rc_flags
+ while [ $# -ne 0 ]; do
+ if [ X"$1" = X-P -o X"$1" = X-A ]; then
+ break
+ fi
+ shift
+ done
+ if [ $# -eq 0 ]; then
+ echo "-P 0"
+ fi
+ ) $rc_flags"
+}
+
+zebra_postcmd()
+{
+ if [ -d "${socketdir}" ]; then
+ rmdir ${socketdir}
+ fi
+}
+
+load_rc_config $name
+run_rc_command "$1"