ports/179271: [patch] net/vnstat add rc script
Mark Felder
feld at feld.me
Mon Jun 3 20:30:01 UTC 2013
>Number: 179271
>Category: ports
>Synopsis: [patch] net/vnstat add rc script
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-ports-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: update
>Submitter-Id: current-users
>Arrival-Date: Mon Jun 03 20:30:00 UTC 2013
>Closed-Date:
>Last-Modified:
>Originator: Mark Felder
>Release:
>Organization:
>Environment:
>Description:
-add rc script
-run as non-root user
-gd LIB_DEPENDS fixed to not require version .4 of library and make portlint happy
please add these users to UIDs and GIDs
vnstat:*:284:284::0:0:vnStat Network Monitor:/nonexistent:/usr/sbin/nologin
vnstat:*:284:
>How-To-Repeat:
>Fix:
Patch attached with submission follows:
Index: Makefile
===================================================================
--- Makefile (revision 319795)
+++ Makefile (working copy)
@@ -3,7 +3,7 @@
PORTNAME= vnstat
PORTVERSION= 1.11
-PORTREVISION= 1
+PORTREVISION= 2
CATEGORIES= net
MASTER_SITES= http://humdi.net/vnstat/ \
http://mirror.mcx2.org/
@@ -15,11 +15,18 @@
LDFLAGS="-L${LOCALBASE}/lib"
INSTALL_TARGET= bsdinstall
+USE_RC_SUBR= vnstat
+
+USERS= vnstat
+GROUPS= vnstat
+
MAN1= vnstat.1 vnstatd.1
MAN5= vnstat.conf.5
MANCOMPRESSED= yes
PORTDOCS= README INSTALL_BSD UPGRADE vnstat-cron
SUB_FILES= pkg-message
+SUB_LIST= USERS=${USERS} \
+ GROUPS=${GROUPS}
# will compile with image output
OPTIONS_DEFINE= GUI DOCS
@@ -34,7 +41,7 @@
etc/vnstat.conf.sample
.if ${PORT_OPTIONS:MGUI}
-LIB_DEPENDS+= gd.4:${PORTSDIR}/graphics/gd
+LIB_DEPENDS+= gd:${PORTSDIR}/graphics/gd
PLIST_SUB+= GUI=""
MAN1+= vnstati.1
.else
Index: files/vnstat.in
===================================================================
--- files/vnstat.in (revision 0)
+++ files/vnstat.in (working copy)
@@ -0,0 +1,31 @@
+#!/bin/sh
+# Created by: Mark Felder <feld at feld.me>
+# $FreeBSD$
+
+# PROVIDE: vnstat
+# REQUIRE: LOGIN
+# KEYWORD: shutdown
+
+# Add the following line to /etc/rc.conf to enable vnstat:
+#
+# vnstat_enable="YES"
+# vnstat_flags="-d -p ${vnstat_pidfile} --config %%PREFIX%%/etc/vnstat.cfg"
+# vnstat_pidfile="/var/run/vnstat/vnstat.pid"
+
+. /etc/rc.subr
+
+name=vnstat
+rcvar=vnstat_enable
+load_rc_config $name
+
+vnstat_enable=${vnstat_enable-"NO"}
+vnstat_pidfile=${vnstat_pidfile-"/var/run/vnstat/vnstat.pid"}
+vnstat_flags=${vnstat_flags-"-d -p ${vnstat_pidfile} --config %%PREFIX%%/etc/vnstat.cfg"}
+vnstat_user=${vnstat_user-"%%USERS%%"}
+vnstat_group=${vnstat_group-"%%GROUPS%%"}
+
+command="%%PREFIX%%/bin/vnstatd"
+command_args="${vnstat_flags}"
+pidfile="${vnstat_pidfile}"
+
+run_rc_command "$1"
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-ports-bugs
mailing list