This is an update for net/vnstat to 2.9 released on 23-Jan-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. It continues
to delete the DatabaseDir setting.

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, so 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.35
diff -u -p -u -p -r1.35 Makefile
--- Makefile    11 Mar 2022 19:48:06 -0000      1.35
+++ Makefile    8 May 2022 01:58:43 -0000
@@ -1,7 +1,7 @@
 COMMENT-main =         network traffic monitor
 COMMENT-vnstati =      image output support for vnstat
 
-V =                    2.6
+V =                    2.9
 EPOCH =                        0
 DISTNAME =             vnstat-${V}
 PKGNAME-main =         ${DISTNAME}
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    8 May 2022 01:58:43 -0000
@@ -1,2 +1,2 @@
-SHA256 (vnstat-2.6.tar.gz) = iSduCnKBlD7bVUuHQHgnitlH3DEpOKJFHgPrgGeff/c=
-SIZE (vnstat-2.6.tar.gz) = 275751
+SHA256 (vnstat-2.9.tar.gz) = EaIUdd6pFwZQCrp8Y+JBJnA/0B8TsfOs35K6pa6tncc=
+SIZE (vnstat-2.9.tar.gz) = 300796
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       8 May 2022 01:58:43 -0000
@@ -1,15 +1,13 @@
 Index: cfg/vnstat.conf
 --- cfg/vnstat.conf.orig
 +++ cfg/vnstat.conf
-@@ -2,10 +2,7 @@
- ##
- 
+@@ -7,9 +7,6 @@
  # default interface (leave empty for automatic selection)
--Interface ""
--
--# location of the database directory
--DatabaseDir "/var/lib/vnstat"
-+Interface "lo0"
+ ;Interface ""
  
+-# location of the database directory
+-;DatabaseDir "/var/lib/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     8 May 2022 01:58:43 -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     8 May 2022 01:58:43 -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

Reply via email to