- Add rc script

- Add vnstat to UIDs and GIDs

PR: ports/179271
Approved by: crees (mentor)
This commit is contained in:
Mark Felder 2013-06-27 20:40:35 +00:00
parent ce8324b451
commit a7ab4c2a5a
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=321902
4 changed files with 51 additions and 2 deletions

1
GIDs
View file

@ -135,6 +135,7 @@ xymon:*:280:
prelude:*:281:
spread:*:282:
devmon:*:283:
vnstat:*:284:
backuppc:*:300:
_sphinx:*:312:
dkfilter:*:325:

1
UIDs
View file

@ -143,6 +143,7 @@ xymon:*:280:280::0:0:Xymon Monitor:/nonexistent:/usr/sbin/nologin
prelude:*:281:281::0:0:Prelude user:/nonexistent:/usr/sbin/nologin
spread:*:282:282::0:0:Spread user:/nonexistent:/usr/sbin/nologin
devmon:*:283:283::0:0:devmon monitor:/nonexistent:/usr/sbin/nologin
vnstat:*:284:284::0:0:vnStat Network Monitor:/nonexistent:/usr/sbin/nologin
backuppc:*:300:300::0:0:BackupPC pseudo-user:/nonexistent:/usr/sbin/nologin
_sphinx:*:312:312::0:0:Sphinxsearch Owner:/nonexistent:/usr/sbin/nologin
dkfilter:*:325:325::0:0:DK Filter Owner:/nonexistent:/usr/sbin/nologin

View file

@ -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

View file

@ -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"