1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-21 00:25:50 +00:00

- Upgrade to USERS/GROUPS

- Provide new rc scripts

PR:		ports/153162
Submitted by:	Corey Smith <corsmith@gmail.com> (maintainer)
This commit is contained in:
Pav Lucistnik 2010-12-22 21:59:21 +00:00
parent 58d6a7c848
commit ac8d209699
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=266739
6 changed files with 182 additions and 20 deletions

1
GIDs
View File

@ -180,5 +180,6 @@ nslcd:*:928:
activemq:*:929:
ifgraph:*:930:
asterisk:*:931:
torrus:*:932:www
sancp:*:932:
dlna:*:933:

1
UIDs
View File

@ -188,5 +188,6 @@ nslcd:*:928:928::0:0:nslcd daemon:/nonexistent:/usr/sbin/nologin
activemq:*:929:929::0:0:ActiveMQ Daemon:/nonexistent:/sbin/nologin
ifgraph:*:930:930::0:0:ifGraph:/nonexistent:/sbin/nologin
asterisk:*:931:931::0:0:Asterisk User:/nonexistent:/sbin/nologin
torrus:*:932:932::0:0:torrus daemon:/nonexistent:/sbin/nologin
sancp:*:932:932::0:0:SANCP Daemon:/var/log/sancp:/sbin/nologin
dlna:*:933:933::0:0:DLNA Daemon:/nonexistent:/sbin/nologin

View File

@ -7,6 +7,7 @@
PORTNAME= torrus
PORTVERSION= 1.0.9
PORTREVISION= 1
CATEGORIES= net-mgmt
MASTER_SITES= SF
@ -30,12 +31,14 @@ USE_GNOME= libxml2
USE_PERL5_RUN= 5.8.1+
GNU_CONFIGURE= YES
TORRUS_USER?= torrus
PLIST_SUB= TORRUS_USER=${TORRUS_USER}
USERS= torrus
GROUPS= torrus
PLIST_SUB= TORRUS_USER=${USERS}
USE_RC_SUBR= torrus_collector torrus_monitor
CONFIGURE_ARGS= --prefix=${PREFIX} \
var_user=${TORRUS_USER} var_group=${TORRUS_USER} \
torrus_user=${TORRUS_USER} \
var_user=${USERS} var_group=${USERS} \
torrus_user=${USERS} \
defrrddir=/var/torrus/collector_rrd \
pkghome=${DATADIR} \
pkgbindir=${PREFIX}/libexec/torrus \
@ -58,20 +61,7 @@ MAN1= torrus.1 torrus_acledit.1 torrus_buildsearchdb.1 \
MAN7= torrus_action_printemail.7 torrus_action_snmptrap.7 \
torrus_action_notify.7 torrus_install_plugin.7
.include <bsd.port.pre.mk>
pre-install:
@if ! pw groupshow ${TORRUS_USER}; then \
pw groupadd ${TORRUS_USER}; \
fi
@if ! pw usershow ${TORRUS_USER}; then \
pw useradd ${TORRUS_USER} -g ${TORRUS_USER} \
-h - -d ${PREFIX}/torrus -c "torrus daemon"; \
pw usermod www -G ${TORRUS_USER}; \
fi
post-install:
${INSTALL_SCRIPT} ${WRKSRC}/init.d/torrus ${PREFIX}/etc/rc.d/torrus.sh
@${CAT} pkg-message
.include <bsd.port.post.mk>
.include <bsd.port.mk>

View File

@ -0,0 +1,94 @@
#!/bin/sh
#
# $FreeBSD $
#
# PROVIDE: torrus_collector
# REQUIRE: DAEMON
#
# Add the following lines to /etc/rc.conf to run torrus_collector:
#
# torrus_collector_enable (bool): Set it to "YES" to enable torrus_collector.
# Default is "NO".
# torrus_collector_flags (flags): Set extra flags here. More options in torrus_collector(1)
# Default is empty "".
# torrus_collector_user (user): Set user to run torrus_collector.
# Default is "torrus".
#
. /etc/rc.subr
name="torrus_collector"
rcvar=${name}_enable
load_rc_config ${name}
: ${torrus_collector_enable="NO"}
: ${torrus_collector_user="torrus"}
start_cmd=${name}_start
status_cmd=${name}_status
stop_cmd=${name}_stop
command=%%PREFIX%%/libexec/torrus/collector
torrus_collector_init()
{
eval trees_collector=\"`/usr/bin/perl -e 'require "'%%PREFIX%%/share/torrus/conf_defaults/torrus-config.pl'";
while((my $key, $val) = each %Torrus::Global::treeConfig) {
print "$key " if $val->{run}{'collector'};
};'`\"
# Get the collector instance numbers for each tree
eval trees=\"\$\{trees_collector\}\"
for t in ${trees}; do
eval col_inst_${t}=\"`/usr/bin/perl -e 'require "'%%PREFIX%%/share/torrus/conf_defaults/torrus-config.pl'";
print join(" ",
(0 .. $Torrus::Global::treeConfig{'${t}'}{run}{collector}-1))'`\"
done
}
torrus_collector_start()
{
start_cmd=""
torrus_collector_init
eval trees=\"\$\{trees_collector\}\"
for t in ${trees}; do
eval instances=\"\$\{col_inst_${t}\}\"
for i in ${instances}; do
echo "starting Torrus collector instance ${i} for tree ${t}"
command_args="--tree=${t} --instance=${i}"
run_rc_command "start"
done
done
}
torrus_collector_status()
{
status_cmd=""
torrus_collector_init
eval trees=\"\$\{trees_collector\}\"
for t in ${trees}; do
eval instances=\"\$\{col_inst_${t}\}\"
for i in ${instances}; do
pidfile="/var/run/torrus/collector.${t}_${i}.pid"
run_rc_command "status"
done
done
}
torrus_collector_stop()
{
stop_cmd=""
torrus_collector_init
eval trees=\"\$\{trees_collector\}\"
for t in ${trees}; do
eval instances=\"\$\{col_inst_${t}\}\"
for i in ${instances}; do
pidfile="/var/run/torrus/collector.${t}_${i}.pid"
echo "stopping Torrus collector instance ${i} for tree ${t}"
stop_postcmd="if [ -f $pidfile ]; then /bin/rm $pidfile; fi"
run_rc_command "stop"
done
done
}
run_rc_command "$1"

View File

@ -0,0 +1,76 @@
#!/bin/sh
#
# $FreeBSD $
#
# PROVIDE: torrus_monitor
# REQUIRE: DAEMON
#
# Add the following lines to /etc/rc.conf to run torrus_monitor:
#
# torrus_monitor_enable (bool): Set it to "YES" to enable torrus_monitor.
# Default is "NO".
# torrus_monitor_flags (flags): Set extra flags here. More options in torrus_monitor(1)
# Default is empty "".
# torrus_monitor_user (user): Set user to run torrus_monitor.
# Default is "torrus".
#
. /etc/rc.subr
name="torrus_monitor"
rcvar=${name}_enable
load_rc_config ${name}
: ${torrus_monitor_enable="NO"}
: ${torrus_monitor_user="torrus"}
start_cmd=${name}_start
status_cmd=${name}_status
stop_cmd=${name}_stop
command=%%PREFIX%%/libexec/torrus/monitor
torrus_monitor_init()
{
eval trees_monitor=\"`/usr/bin/perl -e 'require "'%%PREFIX%%/share/torrus/conf_defaults/torrus-config.pl'";
while((my $key, $val) = each %Torrus::Global::treeConfig) {
print "$key " if $val->{run}{'monitor'};
};'`\"
}
torrus_monitor_start()
{
start_cmd=""
torrus_monitor_init
eval trees=\"\$\{trees_monitor\}\"
for t in ${trees}; do
echo "starting Torrus monitor for tree ${t}"
command_args="--tree=${t}"
run_rc_command "start"
done
}
torrus_monitor_status()
{
status_cmd=""
torrus_monitor_init
eval trees=\"\$\{trees_monitor\}\"
for t in ${trees}; do
pidfile="/var/run/torrus/monitor.${t}.pid"
run_rc_command "status"
done
}
torrus_monitor_stop()
{
stop_cmd=""
torrus_monitor_init
eval trees=\"\$\{trees_monitor\}\"
for t in ${trees}; do
pidfile="/var/run/torrus/monitor.${t}.pid"
echo "stopping Torrus monitor for tree ${t}"
run_rc_command "stop"
done
}
run_rc_command "$1"

View File

@ -1,5 +1,4 @@
bin/torrus
etc/rc.d/torrus.sh
etc/torrus/discovery/README
@unexec if cmp -s %D/etc/torrus/conf/devdiscover-siteconfig.pl.sample %D/etc/torrus/conf/devdiscover-siteconfig.pl; then rm -f %D/etc/torrus/conf/devdiscover-siteconfig.pl; fi
etc/torrus/conf/devdiscover-siteconfig.pl.sample
@ -269,6 +268,8 @@ libexec/torrus/ttproclist
%%SITE_PERL%%/Torrus/SQL/SrvExport.pm
%%SITE_PERL%%/Torrus/SQL.pm
%%SITE_PERL%%/Torrus/TimeStamp.pm
@exec install -d -g %%TORRUS_USER%% -o %%TORRUS_USER%% -m 2775 /var/log/torrus 2>/dev/null || true
@exec install -d -g %%TORRUS_USER%% -o %%TORRUS_USER%% -m 2775 /var/run/torrus 2>/dev/null || true
@exec install -d -g %%TORRUS_USER%% -o %%TORRUS_USER%% -m 755 /var/torrus 2>/dev/null || true
@exec install -d -g %%TORRUS_USER%% -o %%TORRUS_USER%% -m 2775 /var/torrus/cache 2>/dev/null || true
@exec install -d -g %%TORRUS_USER%% -o %%TORRUS_USER%% -m 2775 /var/torrus/collector_rrd 2>/dev/null || true
@ -321,4 +322,3 @@ libexec/torrus/ttproclist
@dirrm %%SITE_PERL%%/Torrus/Collector
@dirrm %%SITE_PERL%%/Torrus/ACL
@dirrm %%SITE_PERL%%/Torrus
@exec mkdir -p /var/log/torrus