Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 19 Nov 2012 22:16:01 GMT
From:      Yuri <yuri@tsoft.com>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   ports/173730: [PATCH] Added rc.d script for net/vnstat port
Message-ID:  <201211192216.qAJMG12h050151@red.freebsd.org>
Resent-Message-ID: <201211192220.qAJMK0At050283@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         173730
>Category:       ports
>Synopsis:       [PATCH] Added rc.d script for net/vnstat port
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Mon Nov 19 22:20:00 UTC 2012
>Closed-Date:
>Last-Modified:
>Originator:     Yuri
>Release:        9.1-RC3
>Organization:
n/a
>Environment:
>Description:
Patch adds /usr/local/etc/rc.d/vnstatd script to allow vnstatd daemon start automatically. Currently it can only be started manually.
Linux distros and OpenWRT have rc scripts for it for a long time.

Maintainer of record for net/vnstat didn't respond since Nov 9, 2012.

>How-To-Repeat:

>Fix:


Patch attached with submission follows:

Index: net/vnstat/Makefile
===================================================================
--- net/vnstat/Makefile	(revision 307567)
+++ net/vnstat/Makefile	(working copy)
@@ -28,13 +28,10 @@
 # will compile with image output
 OPTIONS=	GUI "Build with graphics/gd dependency" on
 
+USE_RC_SUBR=    vnstatd
+
 .include <bsd.port.options.mk>
 
-PLIST_FILES=	bin/vnstat \
-		sbin/vnstatd \
-		%%GUI%%bin/vnstati \
-		etc/vnstat.conf.sample
-
 .if !defined(WITHOUT_GUI)
 LIB_DEPENDS+=	gd.4:${PORTSDIR}/graphics/gd
 PLIST_SUB+=	GUI=""
Index: net/vnstat/files/vnstatd.in
===================================================================
--- net/vnstat/files/vnstatd.in	(revision 0)
+++ net/vnstat/files/vnstatd.in	(working copy)
@@ -0,0 +1,42 @@
+#!/bin/sh
+
+# $FreeBSD: head/net-im/vnstat/files/vnstatd.in $
+
+# PROVIDE: vnstatd
+# REQUIRE: %%REQUIRE%%
+# KEYWORD: shutdown
+
+
+# Define these vnstatd_* variables in one of these files:
+#       /etc/rc.conf
+#       /etc/rc.conf.local
+#
+# DO NOT CHANGE THESE DEFAULT VALUES HERE
+#
+vnstatd_enable=${vnstatd_enable-"NO"}
+
+. /etc/rc.subr
+
+name="vnstatd"
+rcvar=vnstatd_enable
+command="%%PREFIX%%/sbin/vnstatd"
+command_args="--daemon"
+stop_postcmd=vnstatd_post_stopcmd
+
+load_rc_config $name
+
+vnstatd_post_stopcmd()
+{
+	rm -f /var/run/vnstatd.pid
+}
+
+case "$1" in
+	forcestop)
+		echo "Stopping vnstatd."
+		killall vnstatd
+		vnstatd_post_stopcmd
+	;;
+	*)
+		run_rc_command "$1"
+	;;
+esac
Index: net/vnstat/pkg-plist
===================================================================
--- net/vnstat/pkg-plist	(revision 0)
+++ net/vnstat/pkg-plist	(working copy)
@@ -0,0 +1,5 @@
+@unexec [ ! -f /var/run/vnstat.pid ] || %D/etc/rc.d/vnstatd stop || true
+bin/vnstat
+sbin/vnstatd
+%%GUI%%bin/vnstati
+etc/vnstat.conf.sample


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201211192216.qAJMG12h050151>