Index: sysutils/consul/Makefile =================================================================== --- sysutils/consul/Makefile (revision 512771) +++ sysutils/consul/Makefile (working copy) @@ -1,7 +1,7 @@ # $FreeBSD$ PORTNAME= consul -PORTVERSION= 1.5.1 +PORTVERSION= 1.6.1 DISTVERSIONPREFIX= v CATEGORIES= sysutils @@ -26,12 +26,30 @@ 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= ETCDIR=${ETCDIR} \ + CONSUL_USER=${CONSUL_USER} \ + CONSUL_GROUP=${CONSUL_GROUP} \ + CONSUL_DATADIR=${CONSUL_DATADIR} + post-extract: ${MKDIR} ${WRKSRC}/vendor/github.com/${GH_ACCOUNT}/${PORTNAME} ${LN} -s ${WRKSRC}/api ${WRKSRC}/vendor/github.com/${GH_ACCOUNT}/${PORTNAME}/api ${LN} -s ${WRKSRC}/sdk ${WRKSRC}/vendor/github.com/${GH_ACCOUNT}/${PORTNAME}/sdk +pre-install: + ${MKDIR} ${STAGEDIR}${ETCDIR} + ${MKDIR} ${STAGEDIR}${CONSUL_DATADIR} + +post-install: + @${ECHO_CMD} "@dir(${CONSUL_USER},${CONSUL_GROUP},750) ${ETCDIR}" >> ${TMPPLIST} + @${ECHO_CMD} "@dir(${CONSUL_USER},${CONSUL_GROUP},750) ${CONSUL_DATADIR}" >> ${TMPPLIST} + .include Index: sysutils/consul/distinfo =================================================================== --- sysutils/consul/distinfo (revision 512771) +++ sysutils/consul/distinfo (working copy) @@ -1,3 +1,3 @@ -TIMESTAMP = 1558709843 -SHA256 (hashicorp-consul-v1.5.1_GH0.tar.gz) = b8376369b16987e87d3fcda20eb9463144737dbc7dfddd13cba6db9f8f427fd9 -SIZE (hashicorp-consul-v1.5.1_GH0.tar.gz) = 21123963 +TIMESTAMP = 1568593483 +SHA256 (hashicorp-consul-v1.6.1_GH0.tar.gz) = e31ee84ee95efe3c27ebac46ba9f7973f1f7017589b7aece22715e304fccd464 +SIZE (hashicorp-consul-v1.6.1_GH0.tar.gz) = 22621649 Index: sysutils/consul/files/consul.in =================================================================== --- sysutils/consul/files/consul.in (revision 512771) +++ sysutils/consul/files/consul.in (working copy) @@ -6,47 +6,67 @@ # 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_debug: Set it to YES to enable Consul debugging to syslog +# Default: NO +# consul_configtest: Set it to NO to disable Consul validate config +# Default: YES +# consul_user: Username to run Consul +# Default: %%CONSUL_USER%% +# consul_datadir: Directory for the agent to store state +# Default: %%CONSUL_DATADIR%% +# consul_pidfile: Full path of the Consul PID file +# Default: /var/run/consul.pid +# consul_env: Set environment variables used with Consul +# Default: +# consul_args: Additional command-line options +# Default: . /etc/rc.subr name=consul rcvar=consul_enable -extra_commands="reload configtest" +extra_commands="reload" + load_rc_config $name : ${consul_enable:="NO"} -: ${consul_user:="consul"} -: ${consul_group:="consul"} -: ${consul_dir:="/var/db/consul"} +: ${consul_debug:="NO"} +: ${consul_configtest:="YES"} +: ${consul_user:="%%CONSUL_USER%%"} +: ${consul_datadir:="%%CONSUL_DATADIR%%"} +: ${consul_pidfile:="/var/run/consul.pid"} -pidfile=/var/run/consul.pid +_consul_user=${consul_user} +unset consul_user + +if checkyesno consul_debug; then + consul_syslog_flags="-T ${name}" +fi + +if checkyesno consul_configtest; then + restart_precmd="consul_checkconfig" + reload_precmd="consul_checkconfig" + configtest_cmd="consul_checkconfig" + extra_commands="${extra_commands} configtest" +fi + +pidfile=${consul_pidfile} +required_dirs="%%ETCDIR%% ${consul_datadir}" + 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_consul="/usr/bin/env ${consul_env} ${procname} agent -data-dir=${consul_datadir} -config-dir=%%ETCDIR%% ${consul_args}" +command_args="-f ${consul_syslog_flags} -p ${pidfile} -u ${_consul_user} -t ${name} ${command_consul}" -start_precmd=consul_startprecmd - -consul_startprecmd() +consul_checkconfig() { - if [ ! -e ${pidfile} ]; then - 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} - fi + echo "Performing sanity check on ${name} configuration:" + eval ${procname} validate %%ETCDIR%% } run_rc_command "$1"