summaryrefslogtreecommitdiff
path: root/net/ntop
diff options
context:
space:
mode:
authorSam Lawrance <lawrance@FreeBSD.org>2005-12-12 07:03:16 +0000
committerSam Lawrance <lawrance@FreeBSD.org>2005-12-12 07:03:16 +0000
commit19ef03a1145a8de186cb116e4582a8ef762924b1 (patch)
treeab1f639e78e365ef47b10443b3572f8620b293aa /net/ntop
parentUpdate to 2.2.1. (diff)
- Install rc.d script with USE_RC_SUBR (PORTREVISION bumped).
- Prompt for ntop admin password and set IS_INTERACTIVE only if necessary. - Quote BROKEN message. - Adds pkg-deinstall with cleanup instructions. - Submitter takes maintainership. PR: ports/90264 Submitted by: Wesley Shields <wxs@csh.rit.edu>
Notes
Notes: svn path=/head/; revision=150955
Diffstat (limited to 'net/ntop')
-rw-r--r--net/ntop/Makefile19
-rw-r--r--net/ntop/files/ntop.sh71
-rw-r--r--net/ntop/files/ntop.sh.in29
-rw-r--r--net/ntop/pkg-deinstall23
-rw-r--r--net/ntop/pkg-message14
-rw-r--r--net/ntop/pkg-plist1
6 files changed, 67 insertions, 90 deletions
diff --git a/net/ntop/Makefile b/net/ntop/Makefile
index 2d67c39c8de3..27f5a7932d91 100644
--- a/net/ntop/Makefile
+++ b/net/ntop/Makefile
@@ -7,13 +7,14 @@
PORTNAME= ntop
PORTVERSION= 3.2
+PORTREVISION= 1
CATEGORIES= net
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE}
MASTER_SITE_SUBDIR= ${PORTNAME}
DISTNAME= ${PORTNAME}-${PORTVERSION:S/.p/pre/}
EXTRACT_SUFX= .tgz
-MAINTAINER= ports@FreeBSD.org
+MAINTAINER= wxs@csh.rit.edu
COMMENT= Network monitoring tool with command line and web interfaces
LIB_DEPENDS= gd.4:${PORTSDIR}/graphics/gd \
@@ -22,6 +23,11 @@ LIB_DEPENDS= gd.4:${PORTSDIR}/graphics/gd \
DBDIR?= /var/db
+# Only need to be interactive if it's the first install.
+.if !exists(${DBDIR}/ntop/ntop_pw.db)
+IS_INTERACTIVE= yes
+.endif
+
USE_GETOPT_LONG=yes
USE_GMAKE= yes
USE_REINPLACE= yes
@@ -42,6 +48,8 @@ CONFIGURE_ARGS+=--disable-ipv6
MAN8= ntop.8
+USE_RC_SUBR= ntop.sh
+
##
## Available knobs:
## WITH_LOCALE: Enable locale (i18n) support.
@@ -76,7 +84,7 @@ CONFIGURE_ARGS+= --enable-i18n \
.endif
.if defined(WITH_XMLDUMP)
-BROKEN= Does not build with XML dump support
+BROKEN= "Does not build with XML dump support"
LIB_DEPENDS+= gdome.8:${PORTSDIR}/textproc/gdome2
CONFIGURE_ENV+= CPPFLAGS="${CPPFLAGS} -I${LOCALBASE}/include/libxml2 \
-I${LOCALBASE}/include/libxml2/libxml \
@@ -91,9 +99,8 @@ post-install:
@${MKDIR} ${DBDIR}/ntop
@${CHOWN} -R nobody:nobody ${DBDIR}/ntop
@${RMDIR} ${PREFIX}/lib/plugins
- @${SED} -e "s#%%PREFIX%%#${PREFIX}#g;s#%%DBDIR%%#${DBDIR}#g" \
- ${FILESDIR}/ntop.sh > ${WRKDIR}/ntop.sh
- @${INSTALL_DATA} ${WRKDIR}/ntop.sh ${PREFIX}/etc/rc.d
- @${SED} "s,%%LOCALBASE%%,${LOCALBASE},g" < ${PKGMESSAGE}
+ @if [ ! -f ${DBDIR}/ntop/ntop_pw.db ]; then \
+ ${PREFIX}/bin/ntop -u nobody -A; \
+ fi
.include <bsd.port.post.mk>
diff --git a/net/ntop/files/ntop.sh b/net/ntop/files/ntop.sh
deleted file mode 100644
index 5e27b03dc87d..000000000000
--- a/net/ntop/files/ntop.sh
+++ /dev/null
@@ -1,71 +0,0 @@
-#!/bin/sh
-
-#----------------------------------------------------------------------
-# The following variables may be changed
-#
-
-# Network interface(s) to be monitored;
-# may be blank, or comma-separated list
-interfaces=''
-
-# User to run ntop as; leave blank for root
-userid='nobody'
-
-# [IP:]port for serving HTTP; set to '0' to disable
-http_port='3000'
-
-# [IP:]port for serving HTTPS; set to '0' to disable
-# The certificate is %%PREFIX%%/etc/ntop/ntop-cert.pem
-https_port='3001'
-
-# Directory for ntop.access.log
-logdir='/var/log'
-
-# Specify any additional arguments here - see ntop(8)
-additional_args=''
-
-#
-# End of user-configurable variables
-#----------------------------------------------------------------------
-
-args='-d -L --set-pcap-nonblocking'
-
-[ ! -z $interfaces ] && args="$args -i $interfaces"
-[ ! -z $http_port ] && args="$args -w $http_port"
-[ ! -z $https_port ] && args="$args -W $https_port"
-[ ! -z $logdir ] && args="$args -a ${logdir}/ntop.access.log"
-[ ! -z $userid ] && args="$args -u $userid"
-[ ! -z "$additional_args" ] && args="$args $additional_args"
-
-case "$1" in
-start)
- # is it the first time we run ntop
- [ ! -e %%DBDIR%%/ntop/ntop_pw.db ] && {
- # just in case...
- [ ! -d %%DBDIR%%/ntop ] && {
- echo "Reinstalling database directory"
- mkdir -p %%DBDIR%%/ntop
- chown -R $userid:$userid %%DBDIR%%/ntop
- }
- %%PREFIX%%/bin/ntop -u $userid -A || exit 1
- echo "Now we can start ntop!"
- }
- if [ -d $logdir ]; then
- touch ${logdir}/ntop.access.log
- chown $userid ${logdir}/ntop.access.log
- fi
- if [ -x %%PREFIX%%/bin/ntop ]; then
- %%PREFIX%%/bin/ntop $args > /dev/null 2>&1 &
- echo -n ' ntop'
- fi
- ;;
-stop)
- killall ntop > /dev/null 2>&1 && echo -n ' ntop'
- ;;
-*)
- echo "Usage: `basename $0` {start|stop}" >&2
- exit 64
- ;;
-esac
-
-exit 0
diff --git a/net/ntop/files/ntop.sh.in b/net/ntop/files/ntop.sh.in
new file mode 100644
index 000000000000..f2b1fee571ed
--- /dev/null
+++ b/net/ntop/files/ntop.sh.in
@@ -0,0 +1,29 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+
+# PROVIDE: ntop
+# REQUIRE: DAEMON
+# KEYWORD: shutdown
+
+#
+# Add the following lines to /etc/rc.conf to enable ntop:
+#
+#ntop_enable="YES"
+#
+# See ntop(8) for flags
+#
+
+. %%RC_SUBR%%
+
+name=ntop
+rcvar=`set_rcvar`
+
+command=%%PREFIX%%/bin/ntop
+
+ntop_enable=${ntop_enable:-"NO"}
+ntop_flags=${ntop_flags:-"-d --use-syslog=daemon"}
+
+load_rc_config $name
+run_rc_command "$1"
diff --git a/net/ntop/pkg-deinstall b/net/ntop/pkg-deinstall
new file mode 100644
index 000000000000..75f7c1047af0
--- /dev/null
+++ b/net/ntop/pkg-deinstall
@@ -0,0 +1,23 @@
+#!/bin/sh
+#
+# $FreeBSD: /tmp/pcvs/ports/net/ntop/Attic/pkg-deinstall,v 1.1 2005-12-12 07:03:16 lawrance Exp $
+#
+
+case $2 in
+DEINSTALL)
+ ;;
+POST-DEINSTALL)
+ echo "===> post-deinstallation information for $1"
+ echo ""
+ echo " Please note that ntop was not completely removed"
+ echo " from this system:"
+ echo ""
+ echo " /var/db/ntop can be removed if this port will not be"
+ echo " reinstalled."
+ echo ""
+ ;;
+*)
+ exit 64
+ ;;
+esac
+exit 0
diff --git a/net/ntop/pkg-message b/net/ntop/pkg-message
index 560a3913ba83..27ba9b82b322 100644
--- a/net/ntop/pkg-message
+++ b/net/ntop/pkg-message
@@ -1,20 +1,10 @@
----------------------------------------------------------------------------
-ntop has been installed, but is not quite ready to be used yet!
+WARNING:
-You need to set an administrator password for ntop before it may be used.
-Just run startup script to be prompted for the password.
-
-Note that the installed startup script will NOT be execute at system
-startup by default. If you wish ntop to start when your system boots,
-you should make this script executable:
-
- # chmod 555 %%LOCALBASE%%/etc/rc.d/ntop.sh
-
- NB!! NB!! NB!!
In the past, ntop has been the subject of repeated security vulner-
abilities, particularly relating to its web interface. It is strongly
suggested that you protect your ntop web interface via packet filters
or TCP wrappers.
-IPv6 isn't currently supported by the port.
+IPv6 isn't currently supported by the port.
----------------------------------------------------------------------------
diff --git a/net/ntop/pkg-plist b/net/ntop/pkg-plist
index e9a72340ef4a..c94491d12045 100644
--- a/net/ntop/pkg-plist
+++ b/net/ntop/pkg-plist
@@ -6,7 +6,6 @@ etc/ntop/oui.txt.gz
etc/ntop/p2c.opt.table.gz
etc/ntop/specialMAC.txt.gz
@dirrm etc/ntop
-etc/rc.d/ntop.sh
lib/libicmpPlugin-%%SHLIB%%.so
lib/libicmpPlugin.a
lib/libicmpPlugin.so