summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorBeech Rintoul <beech@FreeBSD.org>2008-02-19 20:18:53 +0000
committerBeech Rintoul <beech@FreeBSD.org>2008-02-19 20:18:53 +0000
commit9b3605454cbbaf651091287ece3e22d2d25b7eb5 (patch)
tree8659185b444ad2266d6c287931d7ba2df6e97a2a /net
parent- Fix build (diff)
vnStat is a console-based network traffic monitor. It keeps a log of
hourly, daily and monthly network traffic for the selected interface(s). However, it isn't a packet sniffer. The traffic information is analyzed from the proc(5) filesystem. That way vnStat can be used even without root permissions. PR: ports/120825 Submitted by: Dennis Herrmann <adox at mcx2.org> (maintainer)
Notes
Notes: svn path=/head/; revision=207595
Diffstat (limited to 'net')
-rw-r--r--net/Makefile1
-rw-r--r--net/vnstat/Makefile38
-rw-r--r--net/vnstat/distinfo3
-rw-r--r--net/vnstat/files/patch-Makefile123
-rw-r--r--net/vnstat/files/patch-cfg.c31
-rw-r--r--net/vnstat/files/patch-vnstat.c13
-rw-r--r--net/vnstat/files/pkg-message.in9
-rw-r--r--net/vnstat/pkg-descr7
-rw-r--r--net/vnstat/pkg-plist3
9 files changed, 228 insertions, 0 deletions
diff --git a/net/Makefile b/net/Makefile
index bc3de4ed600c..bca5a1fac7b0 100644
--- a/net/Makefile
+++ b/net/Makefile
@@ -946,6 +946,7 @@
SUBDIR += vnc
SUBDIR += vnc2swf
SUBDIR += vncreflector
+ SUBDIR += vnstat
SUBDIR += vomit
SUBDIR += vserver
SUBDIR += vtun
diff --git a/net/vnstat/Makefile b/net/vnstat/Makefile
new file mode 100644
index 000000000000..e8d6cc0ce0c6
--- /dev/null
+++ b/net/vnstat/Makefile
@@ -0,0 +1,38 @@
+# New ports collection makefile for: vnstat
+# Date created: February 17, 2008
+# Whom: Dennis Herrmann <adox@mcx2.org>
+#
+# $FreeBSD$
+#
+
+PORTNAME= vnstat
+PORTVERSION= 1.6
+CATEGORIES= net
+MASTER_SITES= http://humdi.net/vnstat/ \
+ http://mcx2.org/files/
+DISTNAME= ${PORTNAME}-${PORTVERSION}_bsd
+
+MAINTAINER= adox@mcx2.org
+COMMENT= A console-based network traffic monitor
+
+MAN1= vnstat.1
+MANCOMPRESSED= yes
+PORTDOCS= README INSTALL vnstat-cron
+WRKSRC= ${WRKDIR}/${PORTNAME}-${PORTVERSION}
+SUB_FILES= pkg-message
+
+post-extract:
+ @cd ${WRKSRC} && ${CP} cron/vnstat vnstat-cron
+
+post-install:
+.if !defined(NOPORTDOCS)
+ @${ECHO_MSG} "installing additional documentation to ${DOCSDIR}"
+ @${MKDIR} ${DOCSDIR}
+ @cd ${WRKSRC} && ${INSTALL_DATA} ${PORTDOCS} ${DOCSDIR}
+.endif
+
+ @${ECHO_MSG} ""
+ @${CAT} ${PKGMESSAGE}
+ @${ECHO_MSG} ""
+
+.include <bsd.port.mk>
diff --git a/net/vnstat/distinfo b/net/vnstat/distinfo
new file mode 100644
index 000000000000..d012b68de8df
--- /dev/null
+++ b/net/vnstat/distinfo
@@ -0,0 +1,3 @@
+MD5 (vnstat-1.6_bsd.tar.gz) = e186b05ea3994c4b5c14185f9e730e08
+SHA256 (vnstat-1.6_bsd.tar.gz) = dc04518731f9c07b3e0b43762337bb4357670cf3b0c042c12b4b8d039a141807
+SIZE (vnstat-1.6_bsd.tar.gz) = 37085
diff --git a/net/vnstat/files/patch-Makefile b/net/vnstat/files/patch-Makefile
new file mode 100644
index 000000000000..cf7114689737
--- /dev/null
+++ b/net/vnstat/files/patch-Makefile
@@ -0,0 +1,123 @@
+--- Makefile.orig 2008-02-03 19:23:03.000000000 +0100
++++ Makefile 2008-02-19 18:02:58.000000000 +0100
+@@ -1,106 +1,29 @@
+-# bin, man and cron dirs
+-BIN = $(DESTDIR)/usr/bin
+-MAN = $(DESTDIR)/usr/share/man
+-CRON = $(DESTDIR)/etc/cron.d
++# FreeBSD port by Dennis Herrmann
++PREFIX?= /usr/local
+
+-vnstat:
++all:
+ +make -C src vnstat
+
+ clean:
+ make -C src clean
+
+ install:
+- @echo "Installing vnStat..."
+-
+-# move some really old version database(s) if found
+- @if [ -d $(DESTDIR)/var/spool/vnstat ]; \
+- then echo "Moving old database(s) to new location..."; \
+- mv -f $(DESTDIR)/var/spool/vnstat $(DESTDIR)/var/lib/; \
+- fi
+-
+-# remove some really old version binary if found
+- @if [ -x $(DESTDIR)/usr/local/bin/vnstat ]; \
+- then echo "Removing old binary..."; \
+- rm -f $(DESTDIR)/usr/local/bin/vnstat; \
+- fi
+-
+-# install ppp scripts if directory is found
+- @if [ -d $(DESTDIR)/etc/ppp/ip-up.d ]; \
+- then echo "Installing ppp/ip-up script"; \
+- cp -f pppd/vnstat_ip-up $(DESTDIR)/etc/ppp/ip-up.d/vnstat; \
+- chmod 755 $(DESTDIR)/etc/ppp/ip-up.d/vnstat; \
+- fi
+- @if [ -d $(DESTDIR)/etc/ppp/ip-down.d ]; \
+- then echo "Installing ppp/ip-down script"; \
+- cp -f pppd/vnstat_ip-down $(DESTDIR)/etc/ppp/ip-down.d/vnstat; \
+- chmod 755 $(DESTDIR)/etc/ppp/ip-down.d/vnstat; \
+- fi
+-
+-# install default config if such doesn't exist
+- @if [ ! -f $(DESTDIR)/etc/vnstat.conf ]; \
+- then install -m 644 cfg/vnstat.conf $(DESTDIR)/etc; \
+- fi
+-
+- install -d $(BIN) $(MAN)/man1 $(CRON) $(DESTDIR)/var/lib/vnstat
+- install -s -m 755 src/vnstat $(BIN)
+-
+-# update man page, gzip it if previous version was done so
+- @if [ -f $(MAN)/man1/vnstat.1.gz ]; \
+- then install -m 644 man/vnstat.1 $(MAN)/man1; \
+- gzip -f9 $(MAN)/man1/vnstat.1; \
+- else install -m 644 man/vnstat.1 $(MAN)/man1; \
+- fi
+-
+- install -m 644 cron/vnstat $(CRON)
+-
+-uninstall:
+- @echo "Uninstalling vnStat..."
+- @echo
+- @echo "Note: this will also remove the database directory"
+- @echo "including any database located there"
+- @echo
+- @echo "Press CTRL-C to abort within 10 sec."
+- @sleep 10
+- rm -fr $(DESTDIR)/var/lib/vnstat
+- rm -f $(BIN)/vnstat
+- rm -f $(MAN)/man1/vnstat.1*
+- rm -f $(CRON)/vnstat
+- rm -f $(DESTDIR)/etc/vnstat.conf
+- rm -f $(DESTDIR)/etc/ppp/ip-up.d/vnstat
+- rm -f $(DESTDIR)/etc/ppp/ip-down.d/vnstat
+-
+-bsdinstall:
+- @echo "Installing vnStat (BSD)..."
+-
++ @mkdir -p ${DESTDIR}${PREFIX}/bin
+ install -dm 755 /var/db/vnstat
+- install -m 755 src/vnstat /usr/local/bin
++ install -m 755 src/vnstat ${PREFIX}/bin
+
+ # install default config if such doesn't exist
+- @if [ ! -f /etc/vnstat.conf ]; \
+- then install -m 644 cfg/vnstat.conf /etc; \
+- sed -i "" -e 's/lib/db/g' /etc/vnstat.conf; \
+- fi
+-
+-# install cron if it isn' there already
+- @if [ `grep -c vnstat /etc/crontab` -eq 0 ]; \
+- then cat cron/vnstat >>/etc/crontab; \
+- sed -i "" -e 's/lib\/vnstat/db\/vnstat/g' -e 's/\/usr\/bin\/vnstat/\/usr\/local\/bin\/vnstat/g' /etc/crontab; \
++ @if [ ! -f ${PREFIX}/etc/vnstat.conf ]; \
++ then install -m 644 cfg/vnstat.conf ${PREFIX}/etc; \
++ sed -i "" -e 's/lib/db/g' ${PREFIX}/etc/vnstat.conf; \
+ fi
+
+ # update man page
+- install -m 644 man/vnstat.1 /usr/local/man/man1
+- gzip -f9 /usr/local/man/man1/vnstat.1
++ install -m 644 man/vnstat.1 ${PREFIX}/man/man1
++ gzip -f9 ${PREFIX}/man/man1/vnstat.1
+
+-bsduninstall:
+- @echo "Uninstalling vnStat (BSD)..."
+- @echo
+- @echo "Note: this will also remove the database directory"
+- @echo "including any database located there"
+- @echo
+- @echo "Press CTRL-C to abort within 10 sec."
+- @sleep 10
++deinstall:
+ rm -fr /var/db/vnstat
+- rm -f /usr/local/bin/vnstat
+- rm -f /usr/local/man/man1/vnstat.1*
+- rm -f /etc/vnstat.conf
+- @echo "The cron entry from /etc/crontab needs to be removed manually."
++ rm -f ${PREFIX}/bin/vnstat
++ rm -f ${PREFIX}/man/man1/vnstat.1*
++ rm -f ${PREFIX}/etc/vnstat.conf
diff --git a/net/vnstat/files/patch-cfg.c b/net/vnstat/files/patch-cfg.c
new file mode 100644
index 000000000000..d3c7e868cef2
--- /dev/null
+++ b/net/vnstat/files/patch-cfg.c
@@ -0,0 +1,31 @@
+--- src/cfg.c.orig 2008-02-01 23:11:50.000000000 +0100
++++ src/cfg.c 2008-02-18 18:23:22.000000000 +0100
+@@ -36,8 +36,8 @@
+ printf("MaxBandwidth %d\n\n", cfg.maxbw);
+
+ printf("# interface specific limits\n");
+- printf("# example 8Mbit limit for eth0 (remove # to activate):\n");
+- printf("#MaxBWeth0 8\n");
++ printf("# example 8Mbit limit for fxp0 (remove # to activate):\n");
++ printf("#MaxBWfxp0 8\n");
+
+ while (p != NULL) {
+ printf("MaxBW%s %d\n", p->interface, p->limit);
+@@ -86,7 +86,7 @@
+ /* load default config */
+ defaultcfg();
+
+- /* possible config files: 1) --config 2) $HOME/.vnstatrc 3) /etc/vnstat.conf 4) none */
++ /* possible config files: 1) --config 2) $HOME/.vnstatrc 3) /usr/local/etc/vnstat.conf 4) none */
+
+ if (cfgfile[0]!='\0') {
+
+@@ -112,7 +112,7 @@
+ if (tryhome && (fd=fopen(buffer, "r"))!=NULL) {
+ if (debug)
+ printf("Config file: $HOME/.vnstatrc\n");
+- } else if ((fd=fopen("/etc/vnstat.conf", "r"))!=NULL) {
++ } else if ((fd=fopen("/usr/local/etc/vnstat.conf", "r"))!=NULL) {
+ if (debug)
+ printf("Config file: /etc/vnstat.conf\n");
+ } else {
diff --git a/net/vnstat/files/patch-vnstat.c b/net/vnstat/files/patch-vnstat.c
new file mode 100644
index 000000000000..a70c8dcc3abe
--- /dev/null
+++ b/net/vnstat/files/patch-vnstat.c
@@ -0,0 +1,13 @@
+--- src/vnstat.c.orig 2008-02-01 23:11:50.000000000 +0100
++++ src/vnstat.c 2008-02-18 18:18:30.000000000 +0100
+@@ -524,8 +524,8 @@
+ if (files==0) {
+ printf("No database found, nothing to do. Use --help for help.\n\n");
+ printf("A new database can be created with the following command:\n");
+- printf(" %s -u -i eth0\n\n", argv[0]);
+- printf("Replace 'eth0' with the interface that should be monitored. A list\n");
++ printf(" %s -u -i fxp0\n\n", argv[0]);
++ printf("Replace 'fxp0' with the interface that should be monitored. A list\n");
+ printf("of available interfaces can be seen with the 'ifconfig' command.\n");
+ } else {
+ printf("Nothing to do. Use --help for help.\n");
diff --git a/net/vnstat/files/pkg-message.in b/net/vnstat/files/pkg-message.in
new file mode 100644
index 000000000000..29c7a6a2509c
--- /dev/null
+++ b/net/vnstat/files/pkg-message.in
@@ -0,0 +1,9 @@
+###########################################################################
+vnstat has been installed.
+
+This port neeeds a cron entry. Please copy the contents of:
+%%DOCSDIR%%/vnstat-cron to your crontab.
+
+For more information about vnStat use "man vnstat" or visit:
+http://humdi.net/vnstat/
+###########################################################################
diff --git a/net/vnstat/pkg-descr b/net/vnstat/pkg-descr
new file mode 100644
index 000000000000..fd37400bcbb4
--- /dev/null
+++ b/net/vnstat/pkg-descr
@@ -0,0 +1,7 @@
+vnStat is a console-based network traffic monitor. It keeps a log of
+hourly, daily and monthly network traffic for the selected interface(s).
+However, it isn't a packet sniffer. The traffic information is analyzed
+from the proc(5) filesystem. That way vnStat can be used even
+without root permissions.
+
+WWW: http://humdi.net/vnstat/
diff --git a/net/vnstat/pkg-plist b/net/vnstat/pkg-plist
new file mode 100644
index 000000000000..6471777374a6
--- /dev/null
+++ b/net/vnstat/pkg-plist
@@ -0,0 +1,3 @@
+bin/vnstat
+etc/vnstat.conf
+@unexec rm -rf /var/db/vnstat 2>&1 >/dev/null || true