mirror of
https://git.FreeBSD.org/ports.git
synced 2024-11-18 00:10:04 +00:00
sysutils/tuptime: installation upgrade with _tuptime UID/GID
Create an unprivileged user/group for their execution. Also, add the cron file and update the rc.d script. PR: 270433 Reported by: r@rfmoz.eu Approved by: jeremy@smart-serv.net (maintainer)
This commit is contained in:
parent
69b7a41e75
commit
98513a9139
2
GIDs
2
GIDs
@ -768,7 +768,7 @@ dotlrn:*:821:
|
||||
selenium:*:824:
|
||||
polw:*:825:
|
||||
statsd:*:826:
|
||||
# free: 827
|
||||
_tuptime:*:827:
|
||||
# free: 828
|
||||
# free: 829
|
||||
# free: 830
|
||||
|
2
UIDs
2
UIDs
@ -773,7 +773,7 @@ titus-keys:*:823:65533::0:0:Titus Keyserver User:/nonexistent:/usr/sbin/nologin
|
||||
selenium:*:824:824::0:0:Selenium Daemon User:/usr/local/selenium:/bin/sh
|
||||
polw:*:825:825::0:0:Policyd-weight Cache Owner:/nonexistent:/sbin/nologin
|
||||
statsd:*:826:826::0:0:Statsd Daemon:/nonexistent:/sbin/nologin
|
||||
# free: 827
|
||||
_tuptime:*:827:827::0:0:Tuptime:/var/lib/tuptime:/usr/sbin/nologin
|
||||
# free: 828
|
||||
# free: 829
|
||||
# free: 830
|
||||
|
@ -1,5 +1,6 @@
|
||||
PORTNAME= tuptime
|
||||
DISTVERSION= 5.2.2
|
||||
PORTREVISION= 1
|
||||
CATEGORIES= sysutils
|
||||
|
||||
MAINTAINER= jeremy@smart-serv.net
|
||||
@ -21,11 +22,24 @@ NO_ARCH= yes
|
||||
NO_BUILD= yes
|
||||
SUB_FILES= pkg-message
|
||||
|
||||
PLIST_FILES= bin/tuptime \
|
||||
USERS= _tuptime
|
||||
GROUPS= _tuptime
|
||||
|
||||
PLIST_FILES= bin/tuptime \
|
||||
"@rmtry /var/lib/tuptime/tuptime.db" \
|
||||
"@dir /var/lib" \
|
||||
"@dir(${USERS},${GROUPS},755) /var/lib/tuptime" \
|
||||
"@dir etc/cron.d" \
|
||||
"etc/cron.d/tuptime" \
|
||||
man/man1/tuptime.1.gz
|
||||
|
||||
do-install:
|
||||
${INSTALL_SCRIPT} ${WRKSRC}/src/tuptime ${STAGEDIR}${PREFIX}/bin/tuptime
|
||||
${INSTALL_MAN} ${WRKSRC}/src/man/tuptime.1 ${STAGEDIR}${MANPREFIX}/man/man1
|
||||
|
||||
post-install:
|
||||
${MKDIR} ${STAGEDIR}/var/lib/tuptime
|
||||
${MKDIR} ${STAGEDIR}${LOCALBASE}/etc/cron.d
|
||||
${INSTALL_DATA} ${FILESDIR}/cron ${STAGEDIR}${LOCALBASE}/etc/cron.d/tuptime
|
||||
|
||||
.include <bsd.port.mk>
|
||||
|
1
sysutils/tuptime/files/cron
Normal file
1
sysutils/tuptime/files/cron
Normal file
@ -0,0 +1 @@
|
||||
*/5 * * * * _tuptime (grep '^tuptime_enable="YES"' /etc/rc.conf) && /usr/local/bin/tuptime -q
|
@ -1,16 +1,17 @@
|
||||
[
|
||||
{ type: install
|
||||
message: <<EOM
|
||||
tuptime requires execution at startup and shutdown on rc.d, please
|
||||
add it to /etc/rc.conf and start:
|
||||
#####################################################################
|
||||
|
||||
sysrc tuptime_enable=YES
|
||||
tuptime requires execution at startup and shutdown on rc.d, please
|
||||
enable it on "/etc/rc.conf" and start:
|
||||
|
||||
sysrc tuptime_enable="YES"
|
||||
service tuptime start
|
||||
|
||||
tuptime requires a scheduled execution on cron, please add to
|
||||
/etc/crontab:
|
||||
that also enables "%%LOCALBASE%%/etc/cron.d/tuptime" execution.
|
||||
|
||||
*/5 * * * * root %%PREFIX%%/bin/tuptime -q > /dev/null
|
||||
#####################################################################
|
||||
EOM
|
||||
}
|
||||
]
|
||||
|
@ -4,11 +4,13 @@
|
||||
# REQUIRE: DAEMON
|
||||
# KEYWORD: nojail shutdown
|
||||
|
||||
tuptime_enable=${tuptime_enable:-"NO"}
|
||||
|
||||
. /etc/rc.subr
|
||||
|
||||
name="tuptime"
|
||||
rcvar=tuptime_enable
|
||||
tuptime_user="tuptime"
|
||||
tuptime_user="_tuptime"
|
||||
|
||||
start_cmd="${name}_start"
|
||||
stop_cmd="${name}_stop"
|
||||
@ -20,11 +22,7 @@ tuptime_start()
|
||||
echo "Starting $name."
|
||||
command_args="-q"
|
||||
|
||||
if /usr/sbin/pw usershow "${tuptime_user}" >/dev/null 2>&1; then
|
||||
su -m ${tuptime_user} -c "$name $command_args"
|
||||
else
|
||||
$name $command_args
|
||||
fi
|
||||
su -m ${tuptime_user} -c "$name $command_args" 2> /dev/null || $name $command_args 2> /dev/null
|
||||
}
|
||||
|
||||
tuptime_stop()
|
||||
@ -32,11 +30,7 @@ tuptime_stop()
|
||||
echo "Stopping $name."
|
||||
command_args="-qg"
|
||||
|
||||
if /usr/sbin/pw usershow "${tuptime_user}" >/dev/null 2>&1; then
|
||||
su -m ${tuptime_user} -c "$name $command_args"
|
||||
else
|
||||
$name $command_args
|
||||
fi
|
||||
su -m ${tuptime_user} -c "$name $command_args" 2> /dev/null || $name $command_args 2> /dev/null
|
||||
}
|
||||
|
||||
load_rc_config $name
|
||||
|
Loading…
Reference in New Issue
Block a user