aboutsummaryrefslogtreecommitdiffstats
path: root/sysutils/puppetserver5/files/puppetserver.in
diff options
context:
space:
mode:
authorzleslie <zleslie@FreeBSD.org>2017-10-04 07:37:18 +0800
committerzleslie <zleslie@FreeBSD.org>2017-10-04 07:37:18 +0800
commit6b702d6fc66c09f931f8475982e26164c5f4e347 (patch)
tree631ab9cc4ba43f38f2baa11a305f39ea63908425 /sysutils/puppetserver5/files/puppetserver.in
parent29be6e7a83fca4982bb6f8303226f2c5b0f84e8f (diff)
downloadfreebsd-ports-gnome-6b702d6fc66c09f931f8475982e26164c5f4e347.tar.gz
freebsd-ports-gnome-6b702d6fc66c09f931f8475982e26164c5f4e347.tar.zst
freebsd-ports-gnome-6b702d6fc66c09f931f8475982e26164c5f4e347.zip
New port: sysutils/puppetserver5
This port is based on prior wor done in sysutils/puppetserver, and updated to leverage the CFACTER build of sysutils/facter. Approved by: swills(mentor) Differential Revision: D12513
Diffstat (limited to 'sysutils/puppetserver5/files/puppetserver.in')
-rw-r--r--sysutils/puppetserver5/files/puppetserver.in96
1 files changed, 96 insertions, 0 deletions
diff --git a/sysutils/puppetserver5/files/puppetserver.in b/sysutils/puppetserver5/files/puppetserver.in
new file mode 100644
index 000000000000..3a8788a77e8b
--- /dev/null
+++ b/sysutils/puppetserver5/files/puppetserver.in
@@ -0,0 +1,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"