Add start/stop scripts for the rc.d framework used by
pkgsrc (NetBSD and others).  Contributed by Miles Nordin.
diff --git a/pkgsrc/zebra.sh b/pkgsrc/zebra.sh
new file mode 100644
index 0000000..e4750f7
--- /dev/null
+++ b/pkgsrc/zebra.sh
@@ -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="@PKG_SYSCONFDIR@/${name}.conf"
+command="@PREFIX@/sbin/${name}"
+command_args="-d"
+
+start_precmd="zebra_precmd"
+stop_postcmd="zebra_postcmd"
+socket_dir=/var/run/zebra
+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"