MFH: r468402

sysutils/zrepl: Fix rc.d init script on FreeBSD < 11.1

This change removes the daemon syslog feature on FreeBSD < 11.1.
This has little effect to the usefulness of zrepl logging, as the daemon
itself has inbuilt syslog support which is enabled by default in the
sample config file /usr/local/etc/zrepl/zrepl.yml. The only output to
stdout/stderr from zrepl will be if its inbuilt syslog feature is not
working.

PR:		224844
Reported by:	Bernhard <bernhard.kneip@postadigitale.de>

Approved by:	ports-secteam (riggs)
This commit is contained in:
Ben Woods 2018-04-29 14:18:46 +00:00
parent e475c8dc24
commit 7aaf5fb621
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/branches/2018Q2/; revision=468629
2 changed files with 27 additions and 7 deletions

View File

@ -3,6 +3,7 @@
PORTNAME= zrepl
PORTVERSION= 0.0.2
PORTREVISION= 1
CATEGORIES= sysutils
MAINTAINER= woodsb02@FreeBSD.org
@ -35,6 +36,14 @@ GH_TUPLE= davecgh:go-spew:v1.1.0:go_spew/src/github.com/davecgh/go-spew \
GO_PKGNAME= github.com/${GH_ACCOUNT}/${GH_PROJECT}
.include <bsd.port.pre.mk>
.if ${OPSYS} == "FreeBSD" && ((${OSVERSION} >= 1100513 && ${OSVERSION} < 1200000) || ${OSVERSION} >= 1200015)
SUB_LIST+= DAEMON_LOGGING="-S -l \$${zrepl_facility} -s \$${zrepl_priority} -T \$${name}"
.else
SUB_LIST+= DAEMON_LOGGING=""
.endif
post-extract:
${LN} -sf ${WRKSRC}/src ${WRKDIR}
@ -49,4 +58,4 @@ post-install:
${INSTALL_DATA} ${FILESDIR}/syslog-zrepl.conf.sample ${STAGEDIR}${PREFIX}/etc/syslog.d/zrepl.conf.sample
${INSTALL_DATA} ${FILESDIR}/zrepl.yml.sample ${STAGEDIR}${PREFIX}/etc/zrepl/zrepl.yml.sample
.include <bsd.port.mk>
.include <bsd.port.post.mk>

View File

@ -9,18 +9,24 @@
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
# to enable this service:
#
# zrepl_enable: Set to YES to enable the zrepl service.
# zrepl_enable (bool): Set to YES to enable the zrepl service.
# Default: NO
# zrepl_config: File containing zrepl configuration details.
# zrepl_config (str): File containing zrepl configuration details.
# Default: %%PREFIX%%/etc/zrepl/zrepl.yml
# zrepl_user: The user account used to run the zrepl daemon.
# zrepl_user (str): The user account used to run the zrepl daemon.
# Do not specifically set this to an empty string as this
# will cause the daemon to run as root.
# Default: root
# zrepl_group: The group account used to run the zrepl daemon.
# zrepl_group (str): The group account used to run the zrepl daemon.
# Do not specifically set this to an empty string as this
# will cause the daemon to run with group wheel.
# Default: wheel
# zrepl_flags (str): Extra flags passed to zrepl
# Default: ""
# zrepl_facility (str): Syslog facility to use
# Default: local0
# zrepl_priority (str): Syslog priority to use
# Default: alert
. /etc/rc.subr
name=zrepl
@ -31,13 +37,19 @@ load_rc_config $name
: ${zrepl_config:="%%PREFIX%%/etc/zrepl/zrepl.yml"}
: ${zrepl_user:="root"}
: ${zrepl_group:="wheel"}
: ${zrepl_flags:=""}
: ${zrepl_facility:="local0"}
: ${zrepl_priority:="alert"}
: ${zrepl_options:="${zrepl_flags} --config ${zrepl_config} daemon"}
pidfile="/var/run/zrepl/daemon.pid"
command="/usr/sbin/daemon"
procname="%%PREFIX%%/bin/zrepl"
command_args="-p ${pidfile} -S -l local0 -s alert -T zrepl ${procname} --config ${zrepl_config} daemon"
command_args="-p ${pidfile} %%DAEMON_LOGGING%% ${procname} ${zrepl_options}"
start_precmd=zrepl_precmd
stop_postcmd=zrepl_postcmd
zrepl_precmd()
{
if [ ! -d "/var/run/zrepl/stdinserver" ]; then
@ -50,7 +62,6 @@ zrepl_precmd()
fi
}
stop_postcmd=zrepl_postcmd
zrepl_postcmd()
{
rm -f -- "${pidfile}"