Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 27 Apr 2018 07:35:13 +0000 (UTC)
From:      Ben Woods <woodsb02@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r468402 - in head/sysutils/zrepl: . files
Message-ID:  <201804270735.w3R7ZDih024057@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: woodsb02
Date: Fri Apr 27 07:35:13 2018
New Revision: 468402
URL: https://svnweb.freebsd.org/changeset/ports/468402

Log:
  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>
  MFH:		2018Q2

Modified:
  head/sysutils/zrepl/Makefile
  head/sysutils/zrepl/files/zrepl.in

Modified: head/sysutils/zrepl/Makefile
==============================================================================
--- head/sysutils/zrepl/Makefile	Fri Apr 27 07:03:56 2018	(r468401)
+++ head/sysutils/zrepl/Makefile	Fri Apr 27 07:35:13 2018	(r468402)
@@ -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.co
 
 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>

Modified: head/sysutils/zrepl/files/zrepl.in
==============================================================================
--- head/sysutils/zrepl/files/zrepl.in	Fri Apr 27 07:03:56 2018	(r468401)
+++ head/sysutils/zrepl/files/zrepl.in	Fri Apr 27 07:35:13 2018	(r468402)
@@ -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}"



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201804270735.w3R7ZDih024057>