Index: head/sysutils/consul/Makefile =================================================================== --- head/sysutils/consul/Makefile (revision 449979) +++ head/sysutils/consul/Makefile (revision 449980) @@ -1,51 +1,52 @@ # $FreeBSD$ PORTNAME= consul PORTVERSION= 0.9.3 +PORTREVISION= 1 DISTVERSIONPREFIX= v CATEGORIES= sysutils MAINTAINER= swills@FreeBSD.org COMMENT= Service discovery and configuration made easy LICENSE= MPL BUILD_DEPENDS= ${LOCALBASE}/bin/go:lang/go USES= compiler USE_GITHUB= yes GH_ACCOUNT= hashicorp GH_SUBDIR= src/github.com/${GH_ACCOUNT}/${PORTNAME} USE_RC_SUBR= consul PLIST_FILES= bin/consul USERS= consul GROUPS= consul post-extract: @${MV} ${WRKSRC}/vendor/ ${WRKSRC}/src/ do-build: @cd ${WRKSRC}/src/github.com/hashicorp/consul; ${SETENV} CGO_ENABLED=0 ${BUILD_ENV} GOPATH=${WRKSRC} go build \ -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} \ " \ -o bin/consul do-install: ${INSTALL_PROGRAM} ${WRKSRC}/src/github.com/hashicorp/consul/bin/consul ${STAGEDIR}${PREFIX}/bin/consul .include # golang assumes that if clang is in use, it is called "clang" and not "cc". If # it's called "cc", go fails. .if ${COMPILER_TYPE} == clang BUILD_ENV= CC=clang .endif .include Index: head/sysutils/consul/files/consul.in =================================================================== --- head/sysutils/consul/files/consul.in (revision 449979) +++ head/sysutils/consul/files/consul.in (revision 449980) @@ -1,53 +1,62 @@ #!/bin/sh # $FreeBSD$ # # PROVIDE: consul # REQUIRE: LOGIN # KEYWORD: shutdown # # Add the following lines to /etc/rc.conf.local or /etc/rc.conf # to enable this service: # # 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". . /etc/rc.subr name=consul rcvar=consul_enable -extra_commands="reload" +extra_commands="reload configtest" load_rc_config $name : ${consul_enable:="NO"} : ${consul_user:="consul"} : ${consul_group:="consul"} : ${consul_dir:="/var/db/consul"} pidfile=/var/run/consul.pid 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}" start_precmd=consul_startprecmd +restart_precmd=consul_checkconfig +reload_precmd=consul_checkconfig +configtest_cmd=consul_checkconfig +upgrade_precmd=consul_checkconfig consul_startprecmd() { 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 + consul_checkconfig +} +consul_checkconfig() +{ + ${procname} validate /usr/local/etc/consul.d } run_rc_command "$1"