aboutsummaryrefslogtreecommitdiff
path: root/security/swatch
diff options
context:
space:
mode:
Diffstat (limited to 'security/swatch')
-rw-r--r--security/swatch/Makefile11
-rw-r--r--security/swatch/files/swatch.in (renamed from security/swatch/files/swatch.sh)38
-rw-r--r--security/swatch/pkg-plist1
3 files changed, 40 insertions, 10 deletions
diff --git a/security/swatch/Makefile b/security/swatch/Makefile
index bf14709cc3c8..14b49ed432d2 100644
--- a/security/swatch/Makefile
+++ b/security/swatch/Makefile
@@ -7,7 +7,7 @@
PORTNAME= swatch
PORTVERSION= 3.2.1
-PORTREVISION= 1
+PORTREVISION= 2
CATEGORIES= security sysutils
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE}
MASTER_SITE_SUBDIR= swatch
@@ -23,19 +23,12 @@ RUN_DEPENDS= ${BUILD_DEPENDS}
PERL_CONFIGURE= yes
CONFIGURE_ARGS= INSTALLMAN1DIR=${PREFIX}/man/man1
-USE_RC_SUBR= yes
+USE_RC_SUBR= ${PORTNAME}
MAN1= swatch.1
MAN3= Swatch::Actions.3 Swatch::Throttle.3 Swatch::Threshold.3
-RC_SCRIPTS_SUB= PREFIX=${PREFIX} RC_SUBR=${RC_SUBR}
-
post-patch:
- ${SED} ${RC_SCRIPTS_SUB:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} \
- ${FILESDIR}/swatch.sh > ${WRKSRC}/swatch.sh
${FIND} ${WRKSRC} -name "*.orig" -delete
-post-install:
- ${INSTALL_SCRIPT} ${WRKSRC}/swatch.sh ${PREFIX}/etc/rc.d
-
.include <bsd.port.mk>
diff --git a/security/swatch/files/swatch.sh b/security/swatch/files/swatch.in
index b05aceb09a97..140a8ed58564 100644
--- a/security/swatch/files/swatch.sh
+++ b/security/swatch/files/swatch.in
@@ -36,3 +36,41 @@ if [ -n "${swatch_rules}" ]; then
run_rc_command "$1"
done
fi
+#!/bin/sh
+#
+# $FreeBSD$
+#
+# PROVIDE: swatch
+# REQUIRE: DAEMON
+#
+# To enable multiple instance of swatch, add lines like below to
+# /etc/rc.conf.
+#
+# swatch_enable="YES"
+# swatch_rules="1 2 3"
+# swatch_1_flags="--config-file=/rc --tail-file=/log --daemon --pid-file=/pid"
+# swatch_1_user="nobody"
+# swatch_1_chdir="/var/tmp"
+# swatch_1_pidfile="/pid"
+# swatch_2_flags="blah, blah"
+# swatch_3_flags="blah, blah"
+
+. %%RC_SUBR%%
+
+name=swatch
+rcvar=`set_rcvar`
+
+command=%%PREFIX%%/bin/swatch
+procname=%%PREFIX%%/bin/perl
+
+load_rc_config ${name}
+
+if [ -n "${swatch_rules}" ]; then
+ for i in ${swatch_rules}; do
+ eval swatch_flags=\$swatch_${i}_flags
+ eval swatch_user=\$swatch_${i}_user
+ eval swatch_chdir=\$swatch_${i}_chdir
+ eval pidfile=\$swatch_${i}_pidfile
+ run_rc_command "$1"
+ done
+fi
diff --git a/security/swatch/pkg-plist b/security/swatch/pkg-plist
index 7189475b7927..563b77c72f74 100644
--- a/security/swatch/pkg-plist
+++ b/security/swatch/pkg-plist
@@ -1,5 +1,4 @@
bin/swatch
-etc/rc.d/swatch.sh
%%SITE_PERL%%/Swatch/Actions.pm
%%SITE_PERL%%/Swatch/Threshold.pm
%%SITE_PERL%%/Swatch/Throttle.pm