Please find below a diff to update vnstat to the latest stable version. I had an older version in my tree for a long time, time to push it out.
Latest test on em0 looks good: doas -u _vnstat vnstat --query -i em0 Database updated: 2020-10-23 22:10:00 em0 since 2020-10-23 rx: 231.75 MiB tx: 8.25 MiB total: 240.00 MiB monthly rx | tx | total | avg. rate ------------------------+-------------+-------------+--------------- 2020-10 231.75 MiB | 8.25 MiB | 240.00 MiB | 1.02 kbit/s ------------------------+-------------+-------------+--------------- estimated 311.63 MiB | 10.22 MiB | 321.84 MiB | daily rx | tx | total | avg. rate ------------------------+-------------+-------------+--------------- today 231.75 MiB | 8.25 MiB | 240.00 MiB | 25.23 kbit/s ------------------------+-------------+-------------+--------------- estimated 250.92 MiB | 8.93 MiB | 259.85 MiB | I have adapted the README, so it works fine for me after a first installation. OK? diff --git a/net/vnstat/Makefile b/net/vnstat/Makefile index 5496ab78434..5df95fedfee 100644 --- a/net/vnstat/Makefile +++ b/net/vnstat/Makefile @@ -3,16 +3,15 @@ COMMENT-main = network traffic monitor COMMENT-vnstati = image output support for vnstat -V = 1.14 +V = 2.6 EPOCH = 0 DISTNAME = vnstat-${V} -PKGNAME-main = ${DISTNAME} -PKGNAME-vnstati = vnstati-${V} -REVISION-main = 0 +PKGNAME-main = ${DISTNAME} +PKGNAME-vnstati = vnstati-${V} CATEGORIES = net sysutils -HOMEPAGE = http://humdi.net/vnstat/ +HOMEPAGE = https://humdi.net/vnstat/ MASTER_SITES = ${HOMEPAGE} @@ -21,24 +20,28 @@ MAINTAINER = Pierre-Emmanuel Andre <p...@openbsd.org> # GPLv2 PERMIT_PACKAGE = Yes -WANTLIB = c m -WANTLIB-vnstati = ${WANTLIB} gd pthread +WANTLIB = c sqlite3 m +WANTLIB-vnstati = ${WANTLIB} gd sqlite3 MULTI_PACKAGES = -main -vnstati -LIB_DEPENDS-vnstati = graphics/gd +LIB_DEPENDS-main = databases/sqlite3 + +LIB_DEPENDS-vnstati = graphics/gd \ + databases/sqlite3 + RUN_DEPENDS-vnstati = net/vnstat USE_GMAKE = Yes -NO_TEST = Yes - -INSTALL_TARGET = bsdinstall +CONFIGURE_STYLE = gnu -MAKE_FLAGS = CC="${CC}" CFLAGS="${CFLAGS} -I${LOCALBASE}/include" \ - LDFLAGS="-L${LOCALBASE}/lib -L${X11BASE}/lib" +CONFIGURE_ENV += LDFLAGS="-L${LOCALBASE}/lib -L${X11BASE}/lib " \ + CFLAGS="-I${LOCALBASE}/include -I${X11BASE}/include" post-install: + ${INSTALL_DATA_DIR} ${PREFIX}/share/examples/vnstat/ ${INSTALL_DATA} ${WRKSRC}/examples/vnstat.cgi ${PREFIX}/share/examples/vnstat/ + ${INSTALL_DATA} ${WRKSRC}/cfg/vnstat.conf ${PREFIX}/share/examples/vnstat/ .include <bsd.port.mk> diff --git a/net/vnstat/distinfo b/net/vnstat/distinfo index d4f40fb94f1..2915a3dd5ce 100644 --- a/net/vnstat/distinfo +++ b/net/vnstat/distinfo @@ -1,2 +1,2 @@ -SHA256 (vnstat-1.14.tar.gz) = +EYqR9hdCJBJPcnq6vvHJa5jGqWxA/t/ivTdsjFOg4Y= -SIZE (vnstat-1.14.tar.gz) = 103281 +SHA256 (vnstat-2.6.tar.gz) = iSduCnKBlD7bVUuHQHgnitlH3DEpOKJFHgPrgGeff/c= +SIZE (vnstat-2.6.tar.gz) = 275751 diff --git a/net/vnstat/patches/patch-Makefile b/net/vnstat/patches/patch-Makefile deleted file mode 100644 index 6fc06a3d932..00000000000 --- a/net/vnstat/patches/patch-Makefile +++ /dev/null @@ -1,59 +0,0 @@ -$OpenBSD: patch-Makefile,v 1.5 2015/06/01 16:23:09 pea Exp $ - -- From 6a34745f0e84a990a8fa48e1f1f25be0f08c92a9 Mon Sep 17 00:00:00 2001 - From: Jasper Lievisse Adriaanse <jas...@humppa.nl> - Date: Sat, 3 Jan 2015 14:30:52 +0100 - Subject: [PATCH] Allow for overriding BIN, SBIN and MAN - -- From e4b9c2747bb044f48b35ea02294e73d7c366d9d9 Mon Sep 17 00:00:00 2001 - From: Jasper Lievisse Adriaanse <jas...@humppa.nl> - Date: Sat, 3 Jan 2015 14:34:50 +0100 - Subject: [PATCH] make the path to vnstat.conf variable - -- From ee354ae5e61f332d22b9242f5a2d5af07e4a5373 Mon Sep 17 00:00:00 2001 - From: Jasper Lievisse Adriaanse <jas...@humppa.nl> - Date: Sun, 4 Jan 2015 22:04:20 +0100 - Subject: [PATCH] Adjust manpages for /var/db/ too, just like vnstat.conf - ---- Makefile.orig Mon Jan 5 23:19:37 2015 -+++ Makefile Mon Jun 1 16:37:25 2015 -@@ -5,11 +5,12 @@ MAN ?= $(DESTDIR)/usr/share/man - ETC ?= $(DESTDIR)/etc/ - - # bin and man dirs for *BSD --BIN_BSD ?= $(DESTDIR)/usr/local/bin --SBIN_BSD ?= $(DESTDIR)/usr/local/sbin --MAN_BSD ?= $(DESTDIR)/usr/local/man --ETC_BSD ?= $(DESTDIR)/etc -+BIN_BSD ?= ${PREFIX}/bin -+SBIN_BSD ?= ${PREFIX}/sbin -+MAN_BSD ?= ${PREFIX}/man -+ETC_BSD ?= ${PREFIX}/share/examples/vnstat - -+ - .PHONY: vnstat tests check all clean debug install uninstall bsdinstall bsduninstall dist - - default: vnstat -@@ -140,7 +141,6 @@ bsdinstall: - fi - - # install binaries -- install -d -m 755 $(DESTDIR)/var/db/vnstat - install -s -m 755 src/vnstat $(BIN_BSD) - install -s -m 755 src/vnstatd $(SBIN_BSD) - -@@ -166,14 +166,9 @@ bsdinstall: - install -m 644 man/vnstat.1 $(MAN_BSD)/man1 - install -m 644 man/vnstatd.1 $(MAN_BSD)/man1 - install -m 644 man/vnstat.conf.5 $(MAN_BSD)/man5 -- gzip -f9 $(MAN_BSD)/man1/vnstat.1 -- gzip -f9 $(MAN_BSD)/man1/vnstatd.1 -- gzip -f9 $(MAN_BSD)/man5/vnstat.conf.5 - @if [ -f "src/vnstati" ]; \ - then echo install -m 644 man/vnstati.1 $(MAN_BSD)/man1; \ - install -m 644 man/vnstati.1 $(MAN_BSD)/man1; \ -- echo gzip -f9 $(MAN_BSD)/man1/vnstati.1; \ -- gzip -f9 $(MAN_BSD)/man1/vnstati.1; \ - fi - - # remove vnstat.conf.1 is such exists in the wrong place diff --git a/net/vnstat/patches/patch-cfg_vnstat_conf b/net/vnstat/patches/patch-cfg_vnstat_conf index c8fbc56cfcb..8a5f09b3771 100644 --- a/net/vnstat/patches/patch-cfg_vnstat_conf +++ b/net/vnstat/patches/patch-cfg_vnstat_conf @@ -1,12 +1,16 @@ $OpenBSD: patch-cfg_vnstat_conf,v 1.2 2015/01/05 09:46:42 jasper Exp $ ---- cfg/vnstat.conf.orig Thu Aug 28 22:23:58 2014 -+++ cfg/vnstat.conf Sat Jan 3 14:39:44 2015 -@@ -2,7 +2,7 @@ +Index: cfg/vnstat.conf +--- cfg/vnstat.conf.orig ++++ cfg/vnstat.conf +@@ -2,10 +2,7 @@ ## - # default interface --Interface "eth0" + # default interface (leave empty for automatic selection) +-Interface "" +- +-# location of the database directory +-DatabaseDir "/var/lib/vnstat" +Interface "lo0" - # location of the database directory - DatabaseDir "/var/lib/vnstat" + # locale (LC_ALL) ("-" = use system locale) + Locale "-" diff --git a/net/vnstat/patches/patch-src_Makefile b/net/vnstat/patches/patch-src_Makefile deleted file mode 100644 index fec69901178..00000000000 --- a/net/vnstat/patches/patch-src_Makefile +++ /dev/null @@ -1,14 +0,0 @@ -$OpenBSD: patch-src_Makefile,v 1.5 2018/04/18 10:25:06 kn Exp $ ---- src/Makefile.orig Sun Mar 29 20:56:55 2015 -+++ src/Makefile Mon Jun 1 16:28:52 2015 -@@ -1,8 +1,9 @@ - ifeq "$(origin CC)" "default" - CC = gcc - endif -+CC ?= gcc - CFLAGS ?= -O2 --LDLIBS = -lm -+LDLIBS ?= -lm - OBJS = vnstat.o ifinfo.o dbxml.o dbjson.o dbshow.o dbaccess.o dbmerge.o common.o misc.o cfg.o ibw.o traffic.o - DOBJS = vnstatd.o ifinfo.o dbaccess.o dbcache.o common.o misc.o cfg.o ibw.o daemon.o - IOBJS = vnstati.o image.o dbaccess.o dbmerge.o common.o misc.o cfg.o diff --git a/net/vnstat/pkg/PLIST-main b/net/vnstat/pkg/PLIST-main index 9ca27c75009..d0750f15dc8 100644 --- a/net/vnstat/pkg/PLIST-main +++ b/net/vnstat/pkg/PLIST-main @@ -2,10 +2,11 @@ @pkgpath net/vnstat @newgroup _vnstat:658 @newuser _vnstat:658:_vnstat:daemon:vnstat daemon:/var/db/vnstat:/sbin/nologin +@rcscript ${RCDIR}/vnstatd @bin bin/vnstat @man man/man1/vnstat.1 -@man man/man1/vnstatd.1 @man man/man5/vnstat.conf.5 +@man man/man8/vnstatd.8 @bin sbin/vnstatd @owner _vnstat @sample /var/log/vnstat/ @@ -17,4 +18,3 @@ share/doc/pkg-readmes/${PKGSTEM} share/examples/vnstat/ share/examples/vnstat/vnstat.conf @sample ${SYSCONFDIR}/vnstat.conf -@rcscript ${RCDIR}/vnstatd diff --git a/net/vnstat/pkg/README-main b/net/vnstat/pkg/README-main index 825583a460b..4726e7cb603 100644 --- a/net/vnstat/pkg/README-main +++ b/net/vnstat/pkg/README-main @@ -4,20 +4,20 @@ $OpenBSD: README-main,v 1.3 2018/09/04 12:46:19 espie Exp $ | Running ${PKGSTEM} on OpenBSD +----------------------------------------------------------------------- -1) Launch vnstat --iflist to see all the available interfaces. +1) Edit ${SYSCONFDIR}/vnstat.conf if necessary. -2) For each interface that you want to monitor, launch this command: - # su -m _vnstat -c "vnstat -i interface -u" -This will create the database for the specified interface. +2) Start the vnstatd daemon: + # rcctl start vnstatd -3) Edit ${SYSCONFDIR}/vnstat.conf if necessary. +3) Run "vnstat --iflist" to see all the available interfaces. -4) Finally launch the vnstatd daemon: - # ${RCDIR}/vnstatd start +4) For each interface that you want to monitor, launch this command: + # doas -u _vnstat vnstat --add -i INTERFACE +This will create the database for the specified interface. Otherwise you can +also adjust "Interface" in ${SYSCONFDIR}/vnstat.conf. 5) Create graphics with the command vnstati (you have to install vnstati) - Random hints: * You can enable debug in ${SYSCONFDIR}/vnstat.conf and check the logs in /var/log/vnstat/vnstat.log