aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorfeld <feld@FreeBSD.org>2013-06-28 04:40:35 +0800
committerfeld <feld@FreeBSD.org>2013-06-28 04:40:35 +0800
commitbaada972397de92631ac8f7d874d5a63ae0719db (patch)
tree498d0e5e0cd6af246bbb8722dbe0072d78995c37 /net
parent3a4309d3d48b166cc6b6ca24e483fafc25f49f1d (diff)
downloadfreebsd-ports-gnome-baada972397de92631ac8f7d874d5a63ae0719db.tar.gz
freebsd-ports-gnome-baada972397de92631ac8f7d874d5a63ae0719db.tar.zst
freebsd-ports-gnome-baada972397de92631ac8f7d874d5a63ae0719db.zip
- Add rc script
- Add vnstat to UIDs and GIDs PR: ports/179271 Approved by: crees (mentor)
Diffstat (limited to 'net')
-rw-r--r--net/vnstat/Makefile11
-rw-r--r--net/vnstat/files/vnstat.in40
2 files changed, 49 insertions, 2 deletions
diff --git a/net/vnstat/Makefile b/net/vnstat/Makefile
index 29824e464d2c..71633ce403bd 100644
--- a/net/vnstat/Makefile
+++ b/net/vnstat/Makefile
@@ -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 @@ MAKE_ARGS= CC="${CC}" CFLAGS="-I${LOCALBASE}/include" \
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 @@ PLIST_FILES= bin/vnstat \
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
diff --git a/net/vnstat/files/vnstat.in b/net/vnstat/files/vnstat.in
new file mode 100644
index 000000000000..735a72d0b6cd
--- /dev/null
+++ b/net/vnstat/files/vnstat.in
@@ -0,0 +1,40 @@
+#!/bin/sh
+# Created by: Mark Felder <feld@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}"
+
+start_precmd=vnstat_startprecmd
+
+vnstat_startprecmd()
+{
+ if [ ! -e ${pidfile%/*} ]; then
+ install -d -o ${vnstat_user} -g ${vnstat_group} ${pidfile%/*}
+ fi
+}
+
+run_rc_command "$1"