summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--security/snort/Makefile2
-rw-r--r--security/snort/files/snort.sh.sample21
-rw-r--r--security/snort/pkg-plist1
3 files changed, 24 insertions, 0 deletions
diff --git a/security/snort/Makefile b/security/snort/Makefile
index 607aec4a51f4..1cddf5da1d7e 100644
--- a/security/snort/Makefile
+++ b/security/snort/Makefile
@@ -80,6 +80,8 @@ post-install:
${CP} ${DATADIR}/reference.config-sample \
${DATADIR}/reference.config; \
fi; \
+ ${INSTALL_DATA} ${FILESDIR}/snort.sh.sample \
+ ${PREFIX}/etc/rc.d/snort.sh.sample; \
${INSTALL_DATA} ${WRKSRC}/etc/snort.conf \
${PREFIX}/etc/snort.conf-sample; \
if [ ! -f ${PREFIX}/etc/snort.conf ]; then \
diff --git a/security/snort/files/snort.sh.sample b/security/snort/files/snort.sh.sample
new file mode 100644
index 000000000000..b1bb94874977
--- /dev/null
+++ b/security/snort/files/snort.sh.sample
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+if ! PREFIX=$(expr $0 : "\(/.*\)/etc/rc\.d/$(basename $0)\$"); then
+ echo "$0: Cannot determine the PREFIX" >&2
+ exit 1
+fi
+
+case "$1" in
+start)
+ ${PREFIX}/bin/snort -Dqc ${PREFIX}/etc/snort.conf > /dev/null && echo -n " snort"
+ ;;
+stop)
+ kill `cat /var/run/snort_*.pid`
+ ;;
+restart)
+ killall -1 `cat /var/run/snort_*.pid`
+ ;;
+*)
+ echo "Usage: snort.sh [start|stop|restart]"
+ ;;
+esac
diff --git a/security/snort/pkg-plist b/security/snort/pkg-plist
index fc0fd72a17e6..ad6472b370c2 100644
--- a/security/snort/pkg-plist
+++ b/security/snort/pkg-plist
@@ -1,6 +1,7 @@
bin/snort
@unexec if [ -f %D/etc/snort.conf ] && cmp -s %D/etc/snort.conf %D/etc/snort.conf-sample; then rm -f %D/etc/snort.conf; fi
etc/snort.conf-sample
+etc/rc.d/snort.sh.sample
@exec [ -f %B/snort.conf ] || cp %B/%f %B/snort.conf
%%PORTDOCS%%share/doc/snort/AUTHORS
%%PORTDOCS%%share/doc/snort/NEWS