On Sun, Oct 13, 2013 at 12:03:41AM +0200, Antoine Jacoutot wrote:
> On Sat, Oct 12, 2013 at 03:29:01PM +0200, Remi Locherer wrote:
> > On Fri, Oct 11, 2013 at 10:02:08AM +0100, Stuart Henderson wrote:
> > > On 2013/10/10 23:00, Remi Locherer wrote:
> > > > On Thu, Oct 03, 2013 at 11:32:59PM -0400, Brad Smith wrote:
> > > > > Here is an update to darkstat 3.0.717.
> > > > > 
> > > > > One nice new feature is darkstat can now monitor multiple interfaces.
> > > > > 
> > > > > OK?
> > > > 
> > > > Works for me on amd64. I added an rc.d script for convenience.
> > > 
> > > If you're adding a script, I think it also needs a readme to explain
> > > that the user must set darkstat_flags="-i <interface>"
> > > 
> > > Brad, update is ok with me, let's deal with the script separately.
> > > 
> > 
> > Here a patch that adds an rc script and a readme.
> 
> That is a pretty useless readme imho....

Maybe it's better to have an rc script with default flags and no readme. 
The new diff works as long as there is an egress interface.


Index: Makefile
===================================================================
RCS file: /cvs/ports/net/darkstat/Makefile,v
retrieving revision 1.20
diff -u -p -r1.20 Makefile
--- Makefile    11 Oct 2013 17:23:16 -0000      1.20
+++ Makefile    14 Oct 2013 20:53:04 -0000
@@ -3,6 +3,7 @@
 COMMENT=               network statistics gatherer with graphs
 
 DISTNAME=              darkstat-3.0.717
+REVISION=              1
 CATEGORIES=            net www
 
 HOMEPAGE=              http://unix4lyfe.org/darkstat/
Index: pkg/PLIST
===================================================================
RCS file: /cvs/ports/net/darkstat/pkg/PLIST,v
retrieving revision 1.5
diff -u -p -r1.5 PLIST
--- pkg/PLIST   26 Jan 2012 08:03:57 -0000      1.5
+++ pkg/PLIST   14 Oct 2013 20:53:04 -0000
@@ -3,3 +3,4 @@
 @newuser _darkstat:587:_darkstat:daemon:Darkstat Network Monitor 
Account:/nonexistent:/sbin/nologin
 @man man/man8/darkstat.8
 @bin sbin/darkstat
+@rcscript ${RCDIR}/darkstat
Index: pkg/darkstat.rc
===================================================================
RCS file: pkg/darkstat.rc
diff -N pkg/darkstat.rc
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ pkg/darkstat.rc     14 Oct 2013 20:53:04 -0000
@@ -0,0 +1,14 @@
+#!/bin/sh
+#
+# $OpenBSD$
+
+egress_if=$( ifconfig egress 2>/dev/null | head -1 | cut -d : -f 1 )
+
+daemon="/usr/local/sbin/darkstat"
+daemon_flags="-i $egress_if -b 127.0.0.1 --syslog"
+
+. /etc/rc.d/rc.subr
+
+rc_reload=NO
+
+rc_cmd $1

Reply via email to