View | Details | Raw Unified | Return to bug 240882 | Differences between
and this patch

Collapse All | Expand All

(-)sysutils/consul/Makefile (-2 / +20 lines)
Lines 26-37 Link Here
26
26
27
PLIST_FILES=	bin/consul
27
PLIST_FILES=	bin/consul
28
28
29
USERS=		consul
29
ETCDIR=			${PREFIX}/etc/${PORTNAME}.d
30
GROUPS=		consul
30
CONSUL_USER?=		consul
31
CONSUL_GROUP?=		consul
32
CONSUL_DATADIR?=	/var/db/${PORTNAME}
31
33
34
USERS=		${CONSUL_USER}
35
GROUPS=		${CONSUL_GROUP}
36
37
SUB_LIST=	ETCDIR=${ETCDIR} \
38
		CONSUL_USER=${CONSUL_USER} \
39
		CONSUL_GROUP=${CONSUL_GROUP} \
40
		CONSUL_DATADIR=${CONSUL_DATADIR}
41
32
post-extract:
42
post-extract:
33
	${MKDIR} ${WRKSRC}/vendor/github.com/${GH_ACCOUNT}/${PORTNAME}
43
	${MKDIR} ${WRKSRC}/vendor/github.com/${GH_ACCOUNT}/${PORTNAME}
34
	${LN} -s ${WRKSRC}/api ${WRKSRC}/vendor/github.com/${GH_ACCOUNT}/${PORTNAME}/api
44
	${LN} -s ${WRKSRC}/api ${WRKSRC}/vendor/github.com/${GH_ACCOUNT}/${PORTNAME}/api
35
	${LN} -s ${WRKSRC}/sdk ${WRKSRC}/vendor/github.com/${GH_ACCOUNT}/${PORTNAME}/sdk
45
	${LN} -s ${WRKSRC}/sdk ${WRKSRC}/vendor/github.com/${GH_ACCOUNT}/${PORTNAME}/sdk
36
46
47
pre-install:
48
	${MKDIR} ${STAGEDIR}${ETCDIR}
49
	${MKDIR} ${STAGEDIR}${CONSUL_DATADIR}
50
51
post-install:
52
	@${ECHO_CMD} "@dir(${CONSUL_USER},${CONSUL_GROUP},750) ${ETCDIR}" >> ${TMPPLIST}
53
	@${ECHO_CMD} "@dir(${CONSUL_USER},${CONSUL_GROUP},750) ${CONSUL_DATADIR}" >> ${TMPPLIST}
54
37
.include <bsd.port.mk>
55
.include <bsd.port.mk>
(-)sysutils/consul/files/consul.in (-26 / +58 lines)
Lines 6-52 Link Here
6
# REQUIRE: LOGIN
6
# REQUIRE: LOGIN
7
# KEYWORD: shutdown
7
# KEYWORD: shutdown
8
#
8
#
9
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
9
# Add consul_enable="YES" to /etc/rc.conf to enable Consul
10
# to enable this service:
11
#
10
#
12
# consul_enable (bool):	Set to NO by default.
11
# Additional variables you can define are:
13
#				Set it to YES to enable consul.
12
#
14
# consul_user (user):        Set user to run consul.
13
# consul_debug (bool)
15
#                               Default is "consul".
14
#     Set it to YES to enable Consul debugging to syslog
16
# consul_group (group):      Set group to run consul.
15
#     Set to NO by default
17
#                               Default is "consul".
16
# consul_user (string)
18
# consul_dir (dir):          Set dir to run consul in.
17
#     Set user that Consul will run under
19
#                               Default is "/var/db/consul".
18
#     Default is "%%CONSUL_USER%%"
19
# consul_pidfile (string)
20
#     Set full path to pid file
21
#     Default is "/var/run/consul.pid"
22
# consul_configtest (bool)
23
#     Set it to NO to disable Consul config validation
24
#     Set to YES by default
25
# consul_data_dir (string)
26
#     Set dir to store Consul state
27
#     Default is "%%CONSUL_DATADIR%%"
28
# consul_env (string)
29
#     Set environment variables used with Consul
30
#     Default is ""
31
# consul_args (string)
32
#     Set additional command line arguments
33
#     Default is ""
20
34
21
. /etc/rc.subr
35
. /etc/rc.subr
22
36
23
name=consul
37
name=consul
24
rcvar=consul_enable
38
rcvar=consul_enable
25
extra_commands="reload configtest"
26
39
40
extra_commands="reload"
41
27
load_rc_config $name
42
load_rc_config $name
28
43
29
: ${consul_enable:="NO"}
44
: ${consul_enable:="NO"}
30
: ${consul_user:="consul"}
45
: ${consul_debug:="NO"}
31
: ${consul_group:="consul"}
46
: ${consul_user:="%%CONSUL_USER%%"}
32
: ${consul_dir:="/var/db/consul"}
47
: ${consul_pidfile:="/var/run/consul.pid"}
48
: ${consul_configtest:="YES"}
49
: ${consul_datadir:="%%CONSUL_DATADIR%%"}
33
50
34
pidfile=/var/run/consul.pid
51
_consul_user=${consul_user}
52
unset consul_user
53
54
# backwards compatibility
55
if [ -n "${consul_dir}"; ]; then
56
	consul_datadir=${consul_dir}
57
fi
58
59
if checkyesno consul_debug; then
60
	consul_syslog_flags="-T ${name}"
61
fi
62
63
if checkyesno consul_configtest; then
64
	restart_precmd="consul_checkconfig"
65
	reload_precmd="consul_checkconfig"
66
	configtest_cmd="consul_checkconfig"
67
	extra_commands="${extra_commands} configtest"
68
fi
69
70
pidfile=${consul_pidfile}
71
required_dirs="%%ETCDIR%% ${consul_datadir}"
72
35
procname="%%PREFIX%%/bin/consul"
73
procname="%%PREFIX%%/bin/consul"
36
command="/usr/sbin/daemon"
74
command="/usr/sbin/daemon"
37
command_args="-f -p ${pidfile} /usr/bin/env ${consul_env} ${procname} agent -data-dir=${consul_dir} -config-dir=%%PREFIX%%/etc/consul.d ${consul_args}"
75
command_consul="/usr/bin/env ${consul_env} ${procname} agent -data-dir=${consul_datadir} -config-dir=%%ETCDIR%% ${consul_args}"
76
command_args="-f ${consul_syslog_flags} -p ${pidfile} -u ${_consul_user} -t ${name} ${command_consul}"
38
77
39
start_precmd=consul_startprecmd
78
consul_checkconfig()
40
41
consul_startprecmd()
42
{
79
{
43
        if [ ! -e ${pidfile} ]; then
80
	echo "Performing sanity check on ${name} configuration:"
44
                install -o ${consul_user} -g ${consul_group} /dev/null ${pidfile};
81
	eval ${procname} validate %%ETCDIR%%
45
        fi
46
47
        if [ ! -d ${consul_dir} ]; then
48
                install -d -o ${consul_user} -g ${consul_group} ${consul_dir}
49
        fi
50
}
82
}
51
83
52
run_rc_command "$1"
84
run_rc_command "$1"

Return to bug 240882