blob: 3a8788a77e8b5e7a0a151e140fbd39c90e0e5c3c (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
|
#!/bin/sh
# $FreeBSD: head/sysutils/puppetserver/files/puppetserver.in 428145 2016-12-08 17:41:39Z swills $
#
# PROVIDE: puppetserver
# REQUIRE: LOGIN
# KEYWORD: shutdown
#
# Configuration settings for puppetserver in /etc/rc.conf:
#
# puppetserver_enable (bool):
# Set to "NO" by default.
# Set it to "YES" to enable puppetserver
#
# puppetserver_args (str):
# Extra arguments passed to start command
#
# puppetserver_java_home (str):
# Set to "%%JAVA_HOME%%" by default.
# Set the Java virtual machine to run puppetserver
#
# puppetserver_java_opts (str):
# Set to "" by default.
# Java VM args to use.
#
# puppetserver_user (str):
# Set to "puppet" by default.
# User to run puppetserver as.
#
# puppetserver_group (str):
# Set to "puppet" by default.
# Group for data file ownership.
#
# puppetserver_log_file (str):
# Set to "/var/log/puppetserver/puppetserver.log" by default.
# Log file location.
#
. /etc/rc.subr
name="puppetserver"
rcvar=puppetserver_enable
load_rc_config "${name}"
: ${puppetserver_enable="NO"}
: ${puppetserver_args="--config %%PREFIX%%/etc/puppetserver/conf.d -b %%PREFIX%%/etc/puppetserver/services.d"}
: ${puppetserver_java_home="%%JAVA_HOME%%"}
: ${puppetserver_user="puppet"}
: ${puppetserver_group="puppet"}
: ${puppetserver_log_file="/var/log/puppetserver/puppetserver.log"}
pidfile="/var/run/puppetserver/puppetserver.pid"
command="/usr/sbin/daemon"
java_cmd="${puppetserver_java_home}/bin/java"
procname="${java_cmd}"
command_args="-p ${pidfile} ${java_cmd} -cp %%DATADIR%%/puppet-server-release.jar:%%DATADIR%%/jruby-9k.jar clojure.main -m puppetlabs.trapperkeeper.main ${puppetserver_args} > ${puppetserver_log_file} 2>&1"
required_files="${java_cmd}"
start_precmd="puppetserver_prestart"
# An UTF-8 locale is required
: LC_ALL=${LC_ALL:=C.UTF-8}
case $LC_ALL in
*.UTF-8)
;;
*.*)
LC_ALL="${LC_ALL%.*}.UTF-8"
;;
*)
LC_ALL=C.UTF-8
;;
esac
export LC_ALL
puppetserver_prestart() {
if [ ! -f "${puppetserver_log_file}" ]; then
touch "${puppetserver_log_file}"
chown "${puppetserver_user}:${puppetserver_group}" "${puppetserver_log_file}"
chmod 640 "${puppetserver_log_file}"
fi
if [ ! -d "/var/run/puppetserver" ]; then
install -d -o "${puppetserver_user}" -g "${puppetserver_group}" -m 750 "/var/run/puppetserver"
fi
chown -R "root:${puppetserver_group}" "%%PREFIX%%/etc/puppetserver/conf.d"
chmod 0750 "%%PREFIX%%/etc/puppetserver/conf.d"
chown "root:${puppetserver_group}" "%%PREFIX%%/etc/puppetserver/logback.xml"
chmod 0640 "%%PREFIX%%/etc/puppetserver/logback.xml"
}
run_rc_command "$1"
|