Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 4 Jan 2020 00:42:39 +0000 (UTC)
From:      Steve Wills <swills@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r521969 - in head/sysutils/consul: . files
Message-ID:  <202001040042.0040gdM1056848@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: swills
Date: Sat Jan  4 00:42:39 2020
New Revision: 521969
URL: https://svnweb.freebsd.org/changeset/ports/521969

Log:
  sysutils/consul: Update to 1.6.2 and refactoring rc.script
  
  PR:		240882
  Submitted by:	Dmitry Wagin <dmitry.wagin@ya.ru> (with changes)

Modified:
  head/sysutils/consul/Makefile   (contents, props changed)
  head/sysutils/consul/distinfo   (contents, props changed)
  head/sysutils/consul/files/consul.in

Modified: head/sysutils/consul/Makefile
==============================================================================
--- head/sysutils/consul/Makefile	Fri Jan  3 23:46:49 2020	(r521968)
+++ head/sysutils/consul/Makefile	Sat Jan  4 00:42:39 2020	(r521969)
@@ -1,7 +1,7 @@
 # $FreeBSD$
 
 PORTNAME=	consul
-PORTVERSION=	1.6.1
+PORTVERSION=	1.6.2
 DISTVERSIONPREFIX=	v
 CATEGORIES=	sysutils
 
@@ -16,7 +16,7 @@ USES=		go:modules
 USE_GITHUB=	yes
 GH_ACCOUNT=	hashicorp
 
-GO_BUILDFLAGS=	-ldflags="\
+GO_BUILDFLAGS=	-ldflags=" \
 		-X github.com/hashicorp/consul/version.Version=${PORTVERSION} \
 		-X github.com/hashicorp/consul/version.VersionPrerelease= \
 		-X github.com/hashicorp/consul/version.GitDescribe=v${PORTVERSION} \
@@ -26,8 +26,18 @@ USE_RC_SUBR=	consul
 
 PLIST_FILES=	bin/consul
 
-USERS=		consul
-GROUPS=		consul
+ETCDIR=			${PREFIX}/etc/${PORTNAME}.d
+CONSUL_USER?=		consul
+CONSUL_GROUP?=		consul
+CONSUL_DATADIR?=	/var/db/${PORTNAME}
+
+USERS=		${CONSUL_USER}
+GROUPS=		${CONSUL_GROUP}
+
+SUB_LIST=	CONSUL_DATADIR=${CONSUL_DATADIR} \
+		CONSUL_GROUP=${CONSUL_GROUP} \
+		CONSUL_USER=${CONSUL_USER} \
+		ETCDIR=${ETCDIR}
 
 post-extract:
 	${MKDIR} ${WRKSRC}/vendor/github.com/${GH_ACCOUNT}/${PORTNAME}

Modified: head/sysutils/consul/distinfo
==============================================================================
--- head/sysutils/consul/distinfo	Fri Jan  3 23:46:49 2020	(r521968)
+++ head/sysutils/consul/distinfo	Sat Jan  4 00:42:39 2020	(r521969)
@@ -1,3 +1,3 @@
-TIMESTAMP = 1572039537
-SHA256 (hashicorp-consul-v1.6.1_GH0.tar.gz) = c02a8a9a8b775066cdc33765bbf928f3dd20e3cc0f61cf41f35ed5f0e12a8749
-SIZE (hashicorp-consul-v1.6.1_GH0.tar.gz) = 22621651
+TIMESTAMP = 1576365597
+SHA256 (hashicorp-consul-v1.6.2_GH0.tar.gz) = 98ba4f3e271536954deb118fe88bfcbd3c6150defeee8a2b946a4dff98594a75
+SIZE (hashicorp-consul-v1.6.2_GH0.tar.gz) = 22041280

Modified: head/sysutils/consul/files/consul.in
==============================================================================
--- head/sysutils/consul/files/consul.in	Fri Jan  3 23:46:49 2020	(r521968)
+++ head/sysutils/consul/files/consul.in	Sat Jan  4 00:42:39 2020	(r521969)
@@ -6,47 +6,95 @@
 # REQUIRE: LOGIN
 # KEYWORD: shutdown
 #
-# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
-# to enable this service:
+# Add consul_enable="YES" to /etc/rc.conf to enable Consul
 #
-# consul_enable (bool):	Set to NO by default.
-#				Set it to YES to enable consul.
-# consul_user (user):        Set user to run consul.
-#                               Default is "consul".
-# consul_group (group):      Set group to run consul.
-#                               Default is "consul".
-# consul_dir (dir):          Set dir to run consul in.
-#                               Default is "/var/db/consul".
+# Additional variables you can define are:
+#
+# consul_user (string):       Set user to run consul.
+#                             Default is "%%CONSUL_USER%%".
+# consul_group (string):      Set group to run consul.
+#                             Default is "%%CONSUL_GROUP%%".
+# consul_pidfile (string):    Set full path to pid file
+#                             Default is "/var/run/consul.pid"
+# consul_configtest (string): Set to yes to enable Consul config validation
+#                             Set to NO by default
+# consul_datadir (dir):       Set dir to run consul in.
+#                             Default is "%%CONSUL_DATADIR%%"
+# consul_syslog_output_enable (bool):  Set to YES to enable syslog output
+#                                      Default is "NO". See daemon(8).
+# consul_syslog_output_priority (str): Set syslog priority if syslog enabled.
+#                                      Default is "info". See daemon(8).
+# consul_syslog_output_facility (str): Set to YES to enable syslog output
+#                                      Default is "daemon". See daemon(8).
+#
+# see rc.subr(8) for additional variables and options
+#
 
 . /etc/rc.subr
 
 name=consul
 rcvar=consul_enable
-extra_commands="reload configtest"
 
 load_rc_config $name
 
 : ${consul_enable:="NO"}
-: ${consul_user:="consul"}
-: ${consul_group:="consul"}
-: ${consul_dir:="/var/db/consul"}
+: ${consul_syslog_output_enable:="NO"}
+: ${consul_user:="%%CONSUL_USER%%"}
+: ${consul_group:="%%CONSUL_GROUP%%"}
+: ${consul_pidfile:="/var/run/${name}.pid"}
+: ${consul_configtest:="NO"}
+: ${consul_datadir:="%%CONSUL_DATADIR%%"}
 
-pidfile=/var/run/consul.pid
+start_precmd="consul_start_precmd"
+extra_commands="reload configtest"
+configtest_cmd="consul_checkconfig"
+
+# backwards compatibility
+if [ -n "${consul_dir}" ]; then
+        consul_datadir=${consul_dir}
+fi
+
+if checkyesno consul_syslog_output_enable; then
+        consul_syslog_output_flags="-T ${name}"
+
+        if [ -n "${consul_syslog_output_priority}" ]; then
+                consul_syslog_output_flags="${consul_syslog_output_flags} -s ${consul_syslog_output_priority}"
+        fi  
+
+        if [ -n "${consul_syslog_output_facility}" ]; then
+                consul_syslog_output_flags="${consul_syslog_output_flags} -l ${consul_syslog_output_facility}"
+        fi  
+fi  
+
+if checkyesno consul_configtest; then
+        restart_precmd="consul_checkconfig"
+        reload_precmd="consul_checkconfig"
+fi
+
+pidfile=${consul_pidfile}
 procname="%%PREFIX%%/bin/consul"
 command="/usr/sbin/daemon"
-command_args="-f -p ${pidfile} /usr/bin/env ${consul_env} ${procname} agent -data-dir=${consul_dir} -config-dir=%%PREFIX%%/etc/consul.d ${consul_args}"
+command_args="-f -t ${name} ${consul_syslog_output_flags} -p ${pidfile} /usr/bin/env ${consul_env} ${procname} agent -data-dir=${consul_datadir} -config-dir=%%ETCDIR%% ${consul_args}"
 
-start_precmd=consul_startprecmd
-
-consul_startprecmd()
+consul_start_precmd()
 {
         if [ ! -e ${pidfile} ]; then
-                install -o ${consul_user} -g ${consul_group} /dev/null ${pidfile};
+                install -o ${consul_user} -g ${consul_group} /dev/null ${pidfile}
         fi
 
-        if [ ! -d ${consul_dir} ]; then
-                install -d -o ${consul_user} -g ${consul_group} ${consul_dir}
+        if [ ! -d ${consul_datadir} ]; then
+                install -d -m 0750 -o ${consul_user} -g ${consul_group} ${consul_datadir}
         fi
+
+        if [ ! -d %%ETCDIR%% ]; then
+		install -d -m 0750 -o ${consul_user} -g ${consul_group} %%ETCDIR%%
+	fi
+}
+
+consul_checkconfig()
+{
+	echo "Performing sanity check on ${name} configuration:"
+	eval ${procname} validate "%%ETCDIR%%"
 }
 
 run_rc_command "$1"



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