Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 18 Feb 2008 19:27:09 GMT
From:      Dennis Herrmann <adox@mcx2.org>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   ports/120825: New Port: <net/vnstat> (A console-based network traffic monitor)
Message-ID:  <200802181927.m1IJR9Cr071273@www.freebsd.org>
Resent-Message-ID: <200802181930.m1IJU2lg092995@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         120825
>Category:       ports
>Synopsis:       New Port: <net/vnstat> (A console-based network traffic monitor)
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Mon Feb 18 19:30:01 UTC 2008
>Closed-Date:
>Last-Modified:
>Originator:     Dennis Herrmann
>Release:        FreeBSD 6.3-RELEASE
>Organization:
>Environment:
FreeBSD contempt 6.3-RELEASE-p1 FreeBSD 6.3-RELEASE-p1 #3: Sun Feb 17 06:44:17 CET 2008     root@contempt:/usr/obj/usr/src/sys/CONTEMPT  i386
>Description:
vnStat is a console-based network traffic monitor. It keeps  a  log  of
hourly,  daily  and  monthly  network  traffic  for the selected inter-
face(s). However, it isn't a packet sniffer. The traffic information is
analyzed  from the filesystem. That way vnStat can be used even
without root permissions.

>How-To-Repeat:

>Fix:
# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
#	vnstat
#	vnstat/Makefile
#	vnstat/distinfo
#	vnstat/pkg-message
#	vnstat/pkg-plist
#	vnstat/files
#	vnstat/files/patch-cfg.c
#	vnstat/files/patch-vnstat.c
#	vnstat/files/patch-Makefile
#	vnstat/pkg-descr
#
echo c - vnstat
mkdir -p vnstat > /dev/null 2>&1
echo x - vnstat/Makefile
sed 's/^X//' >vnstat/Makefile << 'END-of-vnstat/Makefile'
X# New ports collection makefile for: vnstat
X# Date created: February 17, 2008
X# Whom: Dennis Herrmann <adox@mcx2.org>
X#
X# $FreeBSD$
X#
X
XPORTNAME= vnstat
XPORTVERSION= 1.6
XCATEGORIES= net
XMASTER_SITES= http://humdi.net/vnstat/:vnstat \
X	      http://mcx2.org/files/:vnstat
XDISTNAME= ${PORTNAME}-${PORTVERSION}_bsd
X
XMAINTAINER=	adox@mcx2.org
XCOMMENT= A console-based network traffic monitor
X
XMAN1= vnstat.1
XMANCOMPRESSED= yes
X
Xpost-install:
X	@${ECHO_MSG}
X	@${CAT} ${PKGMESSAGE}
X	@${ECHO_MSG}
X
X.include <bsd.port.mk>
END-of-vnstat/Makefile
echo x - vnstat/distinfo
sed 's/^X//' >vnstat/distinfo << 'END-of-vnstat/distinfo'
XMD5 (vnstat-1.6_bsd.tar.gz) = e186b05ea3994c4b5c14185f9e730e08
XSHA256 (vnstat-1.6_bsd.tar.gz) = dc04518731f9c07b3e0b43762337bb4357670cf3b0c042c12b4b8d039a141807
XSIZE (vnstat-1.6_bsd.tar.gz) = 37085
END-of-vnstat/distinfo
echo x - vnstat/pkg-message
sed 's/^X//' >vnstat/pkg-message << 'END-of-vnstat/pkg-message'
X###########################################################################
X
XvnStat - Copyright (c) 2002-08 Teemu Toivola <tst@iki.fi>
X
X   This program is free software; you can redistribute it and/or modify
X   it under the terms of the GNU General Public License as published by
X   the Free Software Foundation; version 2 dated June, 1991.
X
X   This program is distributed in the hope that it will be useful,
X   but WITHOUT ANY WARRANTY; without even the implied warranty of
X   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
X   GNU General Public License for more details.
X
X   You should have received a copy of the GNU General Public License
X   along with this program;  if not, write to the Free Software
X   Foundation, Inc., 675 Mass Ave., Cambridge, MA 02139, USA.
X
X###########################################################################
XIf you delete vnStat ,you needs the cron entry from /etc/crontab removed 
Xmanually.
X###########################################################################
END-of-vnstat/pkg-message
echo x - vnstat/pkg-plist
sed 's/^X//' >vnstat/pkg-plist << 'END-of-vnstat/pkg-plist'
Xbin/vnstat
Xetc/vnstat.conf
X@unexec rm -rf /var/db/vnstat
END-of-vnstat/pkg-plist
echo c - vnstat/files
mkdir -p vnstat/files > /dev/null 2>&1
echo x - vnstat/files/patch-cfg.c
sed 's/^X//' >vnstat/files/patch-cfg.c << 'END-of-vnstat/files/patch-cfg.c'
X--- src/cfg.c.orig	2008-02-01 23:11:50.000000000 +0100
X+++ src/cfg.c	2008-02-18 18:23:22.000000000 +0100
X@@ -36,8 +36,8 @@
X 	printf("MaxBandwidth %d\n\n", cfg.maxbw);
X 
X 	printf("# interface specific limits\n");
X-	printf("#  example 8Mbit limit for eth0 (remove # to activate):\n");
X-	printf("#MaxBWeth0 8\n");
X+	printf("#  example 8Mbit limit for fxp0 (remove # to activate):\n");
X+	printf("#MaxBWfxp0 8\n");
X 
X 	while (p != NULL) {
X 		printf("MaxBW%s %d\n", p->interface, p->limit);
X@@ -86,7 +86,7 @@
X 	/* load default config */
X 	defaultcfg();
X 
X-	/* possible config files: 1) --config   2) $HOME/.vnstatrc   3) /etc/vnstat.conf   4) none */
X+	/* possible config files: 1) --config   2) $HOME/.vnstatrc   3) /usr/local/etc/vnstat.conf   4) none */
X 
X 	if (cfgfile[0]!='\0') {
X 	
X@@ -112,7 +112,7 @@
X 		if (tryhome && (fd=fopen(buffer, "r"))!=NULL) {
X 			if (debug)
X 				printf("Config file: $HOME/.vnstatrc\n");
X-		} else if ((fd=fopen("/etc/vnstat.conf", "r"))!=NULL) {
X+		} else if ((fd=fopen("/usr/local/etc/vnstat.conf", "r"))!=NULL) {
X 			if (debug)
X 				printf("Config file: /etc/vnstat.conf\n");
X 		} else {
END-of-vnstat/files/patch-cfg.c
echo x - vnstat/files/patch-vnstat.c
sed 's/^X//' >vnstat/files/patch-vnstat.c << 'END-of-vnstat/files/patch-vnstat.c'
X--- src/vnstat.c.orig	2008-02-01 23:11:50.000000000 +0100
X+++ src/vnstat.c	2008-02-18 18:18:30.000000000 +0100
X@@ -524,8 +524,8 @@
X 		if (files==0) {
X 			printf("No database found, nothing to do. Use --help for help.\n\n");
X 			printf("A new database can be created with the following command:\n");
X-			printf("    %s -u -i eth0\n\n", argv[0]);
X-			printf("Replace 'eth0' with the interface that should be monitored. A list\n");
X+			printf("    %s -u -i fxp0\n\n", argv[0]);
X+			printf("Replace 'fxp0' with the interface that should be monitored. A list\n");
X 			printf("of available interfaces can be seen with the 'ifconfig' command.\n");
X 		} else {
X 			printf("Nothing to do. Use --help for help.\n");
END-of-vnstat/files/patch-vnstat.c
echo x - vnstat/files/patch-Makefile
sed 's/^X//' >vnstat/files/patch-Makefile << 'END-of-vnstat/files/patch-Makefile'
X--- Makefile-e	2008-02-18 18:00:05.000000000 +0100
X+++ Makefile	2008-02-18 18:10:17.000000000 +0100
X@@ -1,84 +1,19 @@
X-# bin, man and cron dirs
X-BIN = $(DESTDIR)/usr/bin
X-MAN = $(DESTDIR)/usr/share/man
X-CRON = $(DESTDIR)/etc/cron.d
X+# FreeBSD port by Dennis Herrmann
X 
X-vnstat:
X+all:
X 	+make -C src vnstat
X 
X clean:
X 	make -C src clean
X 
X install:
X-	@echo "Installing vnStat..."
X-
X-# move some really old version database(s) if found
X-	@if [ -d $(DESTDIR)/var/spool/vnstat ]; \
X-	then echo "Moving old database(s) to new location..."; \
X-	mv -f $(DESTDIR)/var/spool/vnstat $(DESTDIR)/var/lib/; \
X-	fi
X-
X-# remove some really old version binary if found
X-	@if [ -x $(DESTDIR)/usr/local/bin/vnstat ]; \
X-	then echo "Removing old binary..."; \
X-	rm -f $(DESTDIR)/usr/local/bin/vnstat; \
X-	fi
X-
X-# install ppp scripts if directory is found
X-	@if [ -d $(DESTDIR)/etc/ppp/ip-up.d ]; \
X-	then echo "Installing ppp/ip-up script"; \
X-	cp -f pppd/vnstat_ip-up $(DESTDIR)/etc/ppp/ip-up.d/vnstat; \
X-	chmod 755 $(DESTDIR)/etc/ppp/ip-up.d/vnstat; \
X-	fi
X-	@if [ -d $(DESTDIR)/etc/ppp/ip-down.d ]; \
X-	then echo "Installing ppp/ip-down script"; \
X-	cp -f pppd/vnstat_ip-down $(DESTDIR)/etc/ppp/ip-down.d/vnstat; \
X-	chmod 755 $(DESTDIR)/etc/ppp/ip-down.d/vnstat; \
X-	fi
X-
X-# install default config if such doesn't exist
X-	@if [ ! -f $(DESTDIR)/etc/vnstat.conf ]; \
X-	then install -m 644 cfg/vnstat.conf $(DESTDIR)/etc; \
X-	fi
X-
X-	install -d $(BIN) $(MAN)/man1 $(CRON) $(DESTDIR)/var/lib/vnstat
X-	install -s -m 755 src/vnstat $(BIN)
X-
X-# update man page, gzip it if previous version was done so	
X-	@if [ -f $(MAN)/man1/vnstat.1.gz ]; \
X-	then install -m 644 man/vnstat.1 $(MAN)/man1; \
X-	gzip -f9 $(MAN)/man1/vnstat.1; \
X-	else install -m 644 man/vnstat.1 $(MAN)/man1; \
X-	fi
X-
X-	install -m 644 cron/vnstat $(CRON)
X-
X-uninstall:
X-	@echo "Uninstalling vnStat..."
X-	@echo
X-	@echo "Note: this will also remove the database directory"
X-	@echo "including any database located there"
X-	@echo
X-	@echo "Press CTRL-C to abort within 10 sec."
X-	@sleep 10
X-	rm -fr $(DESTDIR)/var/lib/vnstat
X-	rm -f $(BIN)/vnstat
X-	rm -f $(MAN)/man1/vnstat.1*
X-	rm -f $(CRON)/vnstat
X-	rm -f $(DESTDIR)/etc/vnstat.conf
X-	rm -f $(DESTDIR)/etc/ppp/ip-up.d/vnstat
X-	rm -f $(DESTDIR)/etc/ppp/ip-down.d/vnstat
X-
X-bsdinstall:
X-	@echo "Installing vnStat (BSD)..."
X-
X 	install -dm 755 /var/db/vnstat
X 	install -m 755 src/vnstat /usr/local/bin
X 
X # install default config if such doesn't exist
X-	@if [ ! -f /etc/vnstat.conf ]; \
X-	then install -m 644 cfg/vnstat.conf /etc; \
X-	sed -i "" -e 's/lib/db/g' /etc/vnstat.conf; \
X+	@if [ ! -f /usr/local/etc/vnstat.conf ]; \
X+	then install -m 644 cfg/vnstat.conf /usr/local/etc; \
X+	sed -i "" -e 's/lib/db/g' /usr/local/etc/vnstat.conf; \
X 	fi
X 
X # install cron if it isn' there already
X@@ -91,16 +26,8 @@
X 	install -m 644 man/vnstat.1 /usr/local/man/man1
X 	gzip -f9 /usr/local/man/man1/vnstat.1
X 
X-bsduninstall:
X-	@echo "Uninstalling vnStat (BSD)..."
X-	@echo
X-	@echo "Note: this will also remove the database directory"
X-	@echo "including any database located there"
X-	@echo
X-	@echo "Press CTRL-C to abort within 10 sec."
X-	@sleep 10
X+deinstall:
X 	rm -fr /var/db/vnstat
X 	rm -f /usr/local/bin/vnstat
X 	rm -f /usr/local/man/man1/vnstat.1*
X-	rm -f /etc/vnstat.conf
X-	@echo "The cron entry from /etc/crontab needs to be removed manually."
X+	rm -f /usr/local/etc/vnstat.conf
END-of-vnstat/files/patch-Makefile
echo x - vnstat/pkg-descr
sed 's/^X//' >vnstat/pkg-descr << 'END-of-vnstat/pkg-descr'
XvnStat is a console-based network traffic monitor. It keeps  a  log  of
Xhourly,  daily  and  monthly  network  traffic  for the selected inter-
Xface(s). However, it isn't a packet sniffer. The traffic information is
Xanalyzed  from the proc(5) filesystem. That way vnStat can be used even
Xwithout root permissions.
X
XWWW: http://humdi.net/vnstat/
END-of-vnstat/pkg-descr
exit

>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200802181927.m1IJR9Cr071273>