This is an update for net/vnstat to 2.10 released on 22-Oct-2022.
The diff is originally from tj@ with tweaks by me.
changelog: https://humdi.net/vnstat/CHANGES
This diff does the following three things ports-wise:
1. Proofread and edit README to get rid of the usage of second-person.
Add 80 column rulers. Fill in missing steps on logging. Use
LOCALSTATEDIR.
2. patch for vnstat_conf no longer specifies Interface lo0. DatabaseDir
is correctly specified to be /var/db/vnstat, which is the location of
vnstat.db.
Everything is commented out now and has default values if not
specified. `Interface ""' works fine. Interface lo0 is not a valid
interface.
$ vnstat -i lo0
Error: No interface matching "lo0" found in database.
From revision 1.1.1.1 of this patch, it used to replace `Interface
"eth0"' with `Interface "lo0"' so it must have been to have a safe name,
since eth0 does not exist.
3. new patch for expr syntax errors in configure.
see:
https://github.com/vergoh/vnstat/commit/7e3795ebe3e6c31ff09aa967954a51f6d9e19d35
It uses gexpr syntax with the match keyword, so convert it to an
equivalent form for expr.
according to gexpr(1): "match STRING REGEXP same as STRING : REGEXP"
This only serves to print full install paths in configure output
(changing vnstat: ${exec_prefix}/bin/vnstat to vnstat:
/usr/local/bin/vnstat).
The port functions without this configure patch. Should we add or remove
it for maintainability?
Testing
-------
I tested lightly on amd64 and generated a graph with
`vnstati -hg -o /tmp/bw.jpg'.
Feedback and tests are welcome. OK?
Index: Makefile
===================================================================
RCS file: /cvs/ports/net/vnstat/Makefile,v
retrieving revision 1.36
diff -u -p -u -p -r1.36 Makefile
--- Makefile 8 Nov 2022 11:17:03 -0000 1.36
+++ Makefile 3 May 2023 00:38:07 -0000
@@ -1,13 +1,11 @@
COMMENT-main = network traffic monitor
COMMENT-vnstati = image output support for vnstat
-V = 2.6
+V = 2.10
EPOCH = 0
DISTNAME = vnstat-${V}
PKGNAME-main = ${DISTNAME}
PKGNAME-vnstati = vnstati-${V}
-REVISION-main = 0
-REVISION-vnstati = 0
CATEGORIES = net sysutils
Index: distinfo
===================================================================
RCS file: /cvs/ports/net/vnstat/distinfo,v
retrieving revision 1.8
diff -u -p -u -p -r1.8 distinfo
--- distinfo 31 Oct 2020 08:55:41 -0000 1.8
+++ distinfo 3 May 2023 00:38:07 -0000
@@ -1,2 +1,2 @@
-SHA256 (vnstat-2.6.tar.gz) = iSduCnKBlD7bVUuHQHgnitlH3DEpOKJFHgPrgGeff/c=
-SIZE (vnstat-2.6.tar.gz) = 275751
+SHA256 (vnstat-2.10.tar.gz) = qcYXROXNjDZuLbTSgrrcdAId22FL1ltBJAk3mX5FfSU=
+SIZE (vnstat-2.10.tar.gz) = 304464
Index: patches/patch-cfg_vnstat_conf
===================================================================
RCS file: /cvs/ports/net/vnstat/patches/patch-cfg_vnstat_conf,v
retrieving revision 1.4
diff -u -p -u -p -r1.4 patch-cfg_vnstat_conf
--- patches/patch-cfg_vnstat_conf 11 Mar 2022 19:48:07 -0000 1.4
+++ patches/patch-cfg_vnstat_conf 3 May 2023 00:38:07 -0000
@@ -1,15 +1,12 @@
Index: cfg/vnstat.conf
--- cfg/vnstat.conf.orig
+++ cfg/vnstat.conf
-@@ -2,10 +2,7 @@
- ##
+@@ -8,7 +8,7 @@
+ ;Interface ""
- # 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"
++;DatabaseDir "/var/db/vnstat"
# locale (LC_ALL) ("-" = use system locale)
- Locale "-"
+ ;Locale "-"
Index: patches/patch-configure
===================================================================
RCS file: patches/patch-configure
diff -N patches/patch-configure
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-configure 3 May 2023 00:38:07 -0000
@@ -0,0 +1,30 @@
+expr: syntax error
+change gexpr-specific syntax from `match STRING REGEXP' to the
+equivalent `STRING : REGEXP' for compatibility with expr
+
+Index: configure
+--- configure.orig
++++ configure
+@@ -7259,19 +7259,19 @@ fi
+
+ # Resolve install paths for output.
+ msg_bindir=$bindir
+-while expr match "${msg_bindir}" '^.*\$.*$' 1>/dev/null;
++while expr "${msg_bindir}" : '^.*\$.*$' 1>/dev/null;
+ do
+ msg_bindir="$(eval echo ${msg_bindir})"
+ done
+
+ msg_sbindir=$sbindir
+-while expr match "${msg_sbindir}" '^.*\$.*$' 1>/dev/null;
++while expr "${msg_sbindir}" : '^.*\$.*$' 1>/dev/null;
+ do
+ msg_sbindir="$(eval echo ${msg_sbindir})"
+ done
+
+ msg_sysconfdir=$sysconfdir
+-while expr match "${msg_sysconfdir}" '^.*\$.*$' 1>/dev/null;
++while expr "${msg_sysconfdir}" : '^.*\$.*$' 1>/dev/null;
+ do
+ msg_sysconfdir="$(eval echo ${msg_sysconfdir})"
+ done
Index: pkg/README-main
===================================================================
RCS file: /cvs/ports/net/vnstat/pkg/README-main,v
retrieving revision 1.5
diff -u -p -u -p -r1.5 README-main
--- pkg/README-main 11 Mar 2022 19:48:07 -0000 1.5
+++ pkg/README-main 3 May 2023 00:38:07 -0000
@@ -1,6 +1,6 @@
-+-----------------------------------------------------------------------
++-------------------------------------------------------------------------------
| Running ${PKGSTEM} on OpenBSD
-+-----------------------------------------------------------------------
++-------------------------------------------------------------------------------
1) Edit ${SYSCONFDIR}/vnstat.conf if necessary.
@@ -9,13 +9,15 @@
3) Run "vnstat --iflist" to see all the available interfaces.
-4) For each interface that you want to monitor, launch this command:
+4) For each interface to be monitored, launch this command:
# su -m _vnstat -c "vnstat --add -i INTERFACE"
-This will create the database for the specified interface. Otherwise you can
-also adjust "Interface" in ${SYSCONFDIR}/vnstat.conf.
+This will create the database for the specified interface. Otherwise,
+adjust "Interface" in ${SYSCONFDIR}/vnstat.conf.
-5) Create graphics with the command vnstati (you have to install vnstati)
+5) Create graphics with the command "vnstati". (Install the vnstati
+package with "pkg_add vnstati".)
Random hints:
- * You can enable debug in ${SYSCONFDIR}/vnstat.conf and check
- the logs in /var/log/vnstat/vnstat.log
+ * "UseLogging" in ${SYSCONFDIR}/vnstat.conf enables logging.
+ "UseLogging 1" uses ${LOCALSTATEDIR}/log/vnstat/vnstat.log
+ "UseLogging 2" uses ${LOCALSTATEDIR}/log/messages
No comments:
Post a Comment