aboutsummaryrefslogtreecommitdiffstats
path: root/net-mgmt
diff options
context:
space:
mode:
authordougb <dougb@FreeBSD.org>2010-03-27 08:42:06 +0800
committerdougb <dougb@FreeBSD.org>2010-03-27 08:42:06 +0800
commit346673c4cd2fe94c8d04c5d96857b63b429b5393 (patch)
tree1077bd8b7fba77288d0a5938b943d6b2373ddda3 /net-mgmt
parentb856146c9d4ae5e4c2fa70b9031c9e13f7b5f194 (diff)
downloadfreebsd-ports-gnome-346673c4cd2fe94c8d04c5d96857b63b429b5393.tar.gz
freebsd-ports-gnome-346673c4cd2fe94c8d04c5d96857b63b429b5393.tar.zst
freebsd-ports-gnome-346673c4cd2fe94c8d04c5d96857b63b429b5393.zip
Properly utilize USE_RC_SUBR
Tune up the rc.d script
Diffstat (limited to 'net-mgmt')
-rw-r--r--net-mgmt/trafd/Makefile8
-rw-r--r--net-mgmt/trafd/files/trafd.in (renamed from net-mgmt/trafd/files/trafd.sh.sample)27
2 files changed, 18 insertions, 17 deletions
diff --git a/net-mgmt/trafd/Makefile b/net-mgmt/trafd/Makefile
index a6c98ec8ca20..912742bbda85 100644
--- a/net-mgmt/trafd/Makefile
+++ b/net-mgmt/trafd/Makefile
@@ -7,14 +7,16 @@
PORTNAME= trafd
PORTVERSION= 3.0.2.1
+PORTREVISION= 1
CATEGORIES= net-mgmt
MASTER_SITES= ftp://ftp.riss-telecom.ru/pub/dev/trafd/
MAINTAINER= ports@FreeBSD.org
COMMENT= The BPF Traffic Collector
+USE_RC_SUBR= trafd
+
CONFLICTS= bpft-4.*
-RCSUBRBASE= /etc
do-install:
${INSTALL_PROGRAM} ${WRKSRC}/trafd/trafd ${PREFIX}/bin
@@ -26,10 +28,6 @@ do-install:
${INSTALL_PROGRAM} ${WRKSRC}/trafstatd/trafstatd ${PREFIX}/bin
${INSTALL_PROGRAM} ${WRKSRC}/traflog/traflog ${PREFIX}/bin
${INSTALL_DATA} ${WRKSRC}/traflog/traflog.format ${PREFIX}/etc
- ${CP} ${FILESDIR}/trafd.sh.sample ${WRKDIR}
- ${REINPLACE_CMD} -e "s|%%RC_SUBR%%|${RCSUBRBASE}/rc.subr|g;" \
- ${WRKDIR}/trafd.sh.sample
- ${INSTALL_SCRIPT} ${WRKDIR}/trafd.sh.sample ${PREFIX}/etc/rc.d
@${MKDIR} ${PREFIX}/var/trafd
@${MKDIR} ${PREFIX}/var/log
.if !defined(NOPORTDOCS)
diff --git a/net-mgmt/trafd/files/trafd.sh.sample b/net-mgmt/trafd/files/trafd.in
index 571064f43eed..1bb19ab67371 100644
--- a/net-mgmt/trafd/files/trafd.sh.sample
+++ b/net-mgmt/trafd/files/trafd.in
@@ -1,35 +1,33 @@
#!/bin/sh
-#
+# $FreeBSD$
+#
# PROVIDE: trafd
# REQUIRE: netif routing
# KEYWORD: shutdown
-
#
# Add the following lines to /etc/rc.conf to enable trafd:
#
-#trafd_enable="YES"
-#trafd_ifaces="fxp0 fxp1 fxp2"
-#trafd_flags=""
-#trafd_log="/var/log/traffic.log"
+# trafd_enable="YES"
+# trafd_ifaces="fxp0 fxp1 fxp2"
+# trafd_flags=""
+# trafd_log="/var/log/traffic.log"
#
. /etc/rc.subr
name="trafd"
rcvar=`set_rcvar`
-command="/usr/local/bin/trafd"
+
+command="%%PREFIX%%/bin/trafd"
+
start_cmd="trafd_start"
stop_cmd="trafd_stop"
-trafd_enable=${trafd_enable:-"NO"}
-trafd_log=${trafd_log:-"/var/log/traffic.log"}
-load_rc_config $name
-
trafd_start()
{
echo 'Starting trafd.'
- if checkyesno ${rcvar} && [ "x${trafd_ifaces}" != "x" ]; then
+ if checkyesno ${rcvar} && [ -n "${trafd_ifaces}" ]; then
for iface in ${trafd_ifaces}; do
${command} -i ${iface} ${trafd_flags}
done
@@ -51,4 +49,9 @@ trafd_stop()
done
}
+load_rc_config $name
+
+: ${trafd_enable="NO"}
+: ${trafd_log="/var/log/traffic.log"}
+
run_rc_command "$1"