summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Hanselmann <hansmi@gentoo.org>2006-04-09 20:00:23 +0000
committerMichael Hanselmann <hansmi@gentoo.org>2006-04-09 20:00:23 +0000
commitbcd2de864eae1d2e49c907edb840ea73beb22480 (patch)
tree98c8d844b7f8f6ffbd87bd24098895836ddd103d /net-analyzer
parentTypo in the Changelog (diff)
downloadgentoo-2-bcd2de864eae1d2e49c907edb840ea73beb22480.tar.gz
gentoo-2-bcd2de864eae1d2e49c907edb840ea73beb22480.tar.bz2
gentoo-2-bcd2de864eae1d2e49c907edb840ea73beb22480.zip
Added patch for --dbdir
(Portage version: 2.1_pre7-r5)
Diffstat (limited to 'net-analyzer')
-rw-r--r--net-analyzer/vnstat/ChangeLog8
-rw-r--r--net-analyzer/vnstat/files/digest-vnstat-1.4-r21
-rw-r--r--net-analyzer/vnstat/files/vnstat-1.4-dbdir.patch162
-rw-r--r--net-analyzer/vnstat/vnstat-1.4-r2.ebuild72
4 files changed, 242 insertions, 1 deletions
diff --git a/net-analyzer/vnstat/ChangeLog b/net-analyzer/vnstat/ChangeLog
index 2b3cfe6b81ed..89fa1c417f28 100644
--- a/net-analyzer/vnstat/ChangeLog
+++ b/net-analyzer/vnstat/ChangeLog
@@ -1,6 +1,12 @@
# ChangeLog for net-analyzer/vnstat
# Copyright 1999-2006 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/net-analyzer/vnstat/ChangeLog,v 1.12 2006/03/26 23:24:11 jokey Exp $
+# $Header: /var/cvsroot/gentoo-x86/net-analyzer/vnstat/ChangeLog,v 1.13 2006/04/09 20:00:23 hansmi Exp $
+
+*vnstat-1.4-r2 (09 Apr 2006)
+
+ 09 Apr 2006; Michael Hanselmann <hansmi@gentoo.org>
+ +files/vnstat-1.4-dbdir.patch, +vnstat-1.4-r2.ebuild:
+ Added patch for --dbdir, see manpage.
26 Mar 2006; Markus Ullmann <jokey@gentoo.org> vnstat-1.4.ebuild,
vnstat-1.4-r1.ebuild:
diff --git a/net-analyzer/vnstat/files/digest-vnstat-1.4-r2 b/net-analyzer/vnstat/files/digest-vnstat-1.4-r2
new file mode 100644
index 000000000000..c2424fe6d2b1
--- /dev/null
+++ b/net-analyzer/vnstat/files/digest-vnstat-1.4-r2
@@ -0,0 +1 @@
+MD5 9184f79b5e60499bc059f670032291e5 vnstat-1.4.tar.gz 26237
diff --git a/net-analyzer/vnstat/files/vnstat-1.4-dbdir.patch b/net-analyzer/vnstat/files/vnstat-1.4-dbdir.patch
new file mode 100644
index 000000000000..77018240ae95
--- /dev/null
+++ b/net-analyzer/vnstat/files/vnstat-1.4-dbdir.patch
@@ -0,0 +1,162 @@
+diff -upr vnstat-1.4.orig/Makefile vnstat-1.4/Makefile
+--- vnstat-1.4.orig/Makefile 2006-04-09 17:03:42.000000000 +0200
++++ vnstat-1.4/Makefile 2006-04-09 17:19:03.000000000 +0200
+@@ -9,12 +9,6 @@ vnstat:
+ 64bit:
+ +make -C src 64bit
+
+-single:
+- +make -C src single
+-
+-64bitsingle:
+- +make -C src 64bitsingle
+-
+ clean:
+ make -C src clean
+
+diff -upr vnstat-1.4.orig/man/vnstat.1 vnstat-1.4/man/vnstat.1
+--- vnstat-1.4.orig/man/vnstat.1 2006-04-09 17:03:42.000000000 +0200
++++ vnstat-1.4/man/vnstat.1 2006-04-09 17:53:23.000000000 +0200
+@@ -16,6 +16,9 @@ vnStat \- a console-based network traffi
+ ] [
+ .B \-\-days
+ ] [
++.B \-\-dbdir
++.I [dir]
++] [
+ .B \-\-debug
+ ] [
+ .B \-\-disable
+@@ -123,6 +126,17 @@ Show traffic for 7 days, current and pre
+ .BI "--cleartop"
+ Remove all top10 entries.
+ .TP
++.BI "--dbdir " [dir]
++If the parameter
++.I dir
++is specified, set the database directory to it. If
++.I dir
++is not specified, set the database directory to $HOME/.vnstat.
++If this parameter is not specified at all, the database directory
++is the global one.
++.I dir
++must not begin with a dash (-).
++.TP
+ .BI "--dumpdb"
+ Instead of showing the database with a formated output, this output will
+ dump the whole database in a format that should be easy to parse with most
+diff -upr vnstat-1.4.orig/src/Makefile vnstat-1.4/src/Makefile
+--- vnstat-1.4.orig/src/Makefile 2006-04-09 17:03:42.000000000 +0200
++++ vnstat-1.4/src/Makefile 2006-04-09 17:19:15.000000000 +0200
+@@ -11,12 +11,6 @@ vnstat: $(OBJS) vnstat.c vnstat.h
+ 64bit: $(OBJS64) vnstat.c vnstat.h
+ $(CC) $(CFLAGS) -o vnstat vnstat.c $(OBJS64) -DBLIMIT
+
+-single: $(OBJS) vnstat.c vnstat.h
+- $(CC) $(CFLAGS) -o vnstat vnstat.c $(OBJS) -DSINGLE
+-
+-64bitsingle: $(OBJS64) vnstat.c vnstat.h
+- $(CC) $(CFLAGS) -o vnstat vnstat.c $(OBJS64) -DSINGLE -DBLIMIT
+-
+ proc.o: proc.c proc.h vnstat.h db.h
+ $(CC) $(CFLAGS) -c proc.c
+
+diff -upr vnstat-1.4.orig/src/vnstat.c vnstat-1.4/src/vnstat.c
+--- vnstat-1.4.orig/src/vnstat.c 2006-04-09 17:03:42.000000000 +0200
++++ vnstat-1.4/src/vnstat.c 2006-04-09 17:55:42.000000000 +0200
+@@ -44,38 +44,7 @@ int main(int argc, char *argv[]) {
+ current=time(NULL);
+
+ /* init dirname */
+-#ifdef SINGLE
+- strncpy(dirname, getenv("HOME"), 500);
+- strcat(dirname,"/.vnstat");
+-#else
+ strncpy(dirname, DATABASEDIR, 500);
+-#endif
+-
+- /* check if the database dir exists and if it contains files */
+- if ((dir=opendir(dirname))!=NULL) {
+- if (debug)
+- printf("Dir OK\n");
+- while ((di=readdir(dir))) {
+- if (di->d_name[0]!='.') {
+- strncpy(definterface, di->d_name, 32);
+- files++;
+- }
+- }
+- if (debug)
+- printf("%d files found\n", files);
+- if (files) {
+- query=1;
+- if (files>1)
+- strncpy(definterface, DEFIFACE, 32);
+- }
+- closedir(dir);
+- } else {
+- printf("Error:\nUnable to open database directory \"%s\".\n", dirname);
+- printf("Make sure it exists and is read enabled for this user.\n");
+- printf("Exiting...\n");
+- exit(0);
+- }
+-
+
+ /* parse parameters, maybe not the best way but... */
+ for (currentarg=1; currentarg<argc; currentarg++) {
+@@ -110,6 +79,8 @@ int main(int argc, char *argv[]) {
+ printf("\t -D, --debug\t\t show some additional debug information\n");
+ printf("\t -v, --version\t\t show version\n");
+ printf("\t -tr, --traffic\t\t calculate traffic\n");
++ printf("\t --dbdir [DIR]\t\t change database directory to DIR\n");
++ printf("\t \t\t DIR defaults to $HOME/.vnstat\n");
+ printf("\t --testkernel\t\t check if the kernel is broken\n");
+ printf("\t --longhelp\t\t display this help\n\n");
+
+@@ -211,6 +182,14 @@ int main(int argc, char *argv[]) {
+ } else if (strcmp(argv[currentarg],"--testkernel")==0) {
+ kerneltest();
+ exit(0);
++ } else if (strncmp(argv[currentarg], "--dbdir", 7)==0) {
++ if ((currentarg + 1) < argc && argv[currentarg + 1][0] != '-') {
++ strncpy(dirname, argv[currentarg + 1], 510);
++ currentarg++;
++ } else {
++ strncpy(dirname, getenv("HOME"), 500);
++ strcat(dirname, "/.vnstat");
++ }
+ } else if ((strcmp(argv[currentarg],"-v")==0) || (strcmp(argv[currentarg],"--version"))==0) {
+ printf("vnStat %s by Teemu Toivola <tst at iki dot fi>\n", VNSTATVERSION);
+ #ifndef SINGLE
+@@ -238,6 +217,31 @@ int main(int argc, char *argv[]) {
+
+ }
+
++ /* check if the database dir exists and if it contains files */
++ if ((dir=opendir(dirname))!=NULL) {
++ if (debug)
++ printf("Dir OK\n");
++ while ((di=readdir(dir))) {
++ if (di->d_name[0]!='.') {
++ strncpy(definterface, di->d_name, 32);
++ files++;
++ }
++ }
++ if (debug)
++ printf("%d files found\n", files);
++ if (files) {
++ query=1;
++ if (files>1)
++ strncpy(definterface, DEFIFACE, 32);
++ }
++ closedir(dir);
++ } else {
++ printf("Error:\nUnable to open database directory \"%s\".\n", dirname);
++ printf("Make sure it exists and is read enabled for this user.\n");
++ printf("Exiting...\n");
++ exit(0);
++ }
++
+ /* counter reset */
+ if (reset) {
+ if (!spacecheck(dirname) && !force) {
+Only in vnstat-1.4/src: .vnstat.c.swp
diff --git a/net-analyzer/vnstat/vnstat-1.4-r2.ebuild b/net-analyzer/vnstat/vnstat-1.4-r2.ebuild
new file mode 100644
index 000000000000..c904f49ed4b6
--- /dev/null
+++ b/net-analyzer/vnstat/vnstat-1.4-r2.ebuild
@@ -0,0 +1,72 @@
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-analyzer/vnstat/vnstat-1.4-r2.ebuild,v 1.1 2006/04/09 20:00:23 hansmi Exp $
+
+inherit eutils toolchain-funcs
+
+DESCRIPTION="Console-based network traffic monitor that keeps statistics of network usage"
+HOMEPAGE="http://humdi.net/vnstat/"
+SRC_URI="http://humdi.net/vnstat/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~ppc ~ppc64 ~x86"
+IUSE=""
+
+RDEPEND="virtual/cron"
+
+src_unpack() {
+ unpack ${A}
+ cd "${S}"
+ epatch \
+ "${FILESDIR}/${P}-long_iface_name.patch" \
+ "${FILESDIR}/${P}-dbdir.patch"
+ sed -i \
+ -e "s:^\(CFLAGS = \).*$:\1${CFLAGS}:" \
+ -e "s:^\(CC = \).*$:\1$(tc-getCC):" \
+ src/Makefile || die "sed failed"
+}
+
+src_compile() {
+ emake || die
+}
+
+src_install() {
+ keepdir /var/lib/vnstat
+
+ dobin src/vnstat || die
+ exeinto /etc/cron.hourly
+ newexe ${FILESDIR}/vnstat.cron vnstat
+ doman man/vnstat.1
+
+ newdoc pppd/vnstat_ip-down ip-down.example
+ newdoc pppd/vnstat_ip-up ip-up.example
+ dodoc CHANGES README UPGRADE FAQ
+ newdoc INSTALL README.setup
+}
+
+pkg_postinst() {
+ # compatibility for 1.1 ebuild
+ if [[ -d ${ROOT}/var/spool/vnstat ]] ; then
+ mv -f "${ROOT}"/var/spool/vnstat/* "${ROOT}"/var/lib/vnstat/ \
+ && rmdir "${ROOT}"/var/spool/vnstat
+ einfo "vnStat db files moved from /var/spool/vnstat to /var/lib/vnstat"
+ fi
+
+ einfo "Repeat the following command for every interface you"
+ einfo "wish to monitor (replace eth0):"
+ einfo " vnstat -u -i eth0"
+ einfo
+ einfo "Note: if an interface transfers more than ~4GB in"
+ einfo "the time between cron runs, you may miss traffic"
+ einfo
+
+ if [[ -e ${ROOT}/etc/cron.d/vnstat ]] ; then
+ einfo "vnstat\'s cron script is now installed as /etc/cron.hourly/vnstat."
+ einfo "Please remove /etc/cron.d/vnstat."
+ else
+ einfo "A cron script has been installed to /etc/cron.hourly/vnstat.cron."
+ fi
+ einfo "To update your interface database automatically with"
+ einfo "cron, uncomment the lines in /etc/cron.hourly/vnstat.cron."
+}