forked from Lainports/freebsd-ports
constructions that parse out to [ -z "$foo" ] && foo="" These are bad examples that get copied and pasted into new code, so the hope is that with less bad examples there will be less need for me to bring this up in review. In a few of these files all that were changed were comments so that next time I search for these patterns I won't trip on the file for no reason. In a few places, add $FreeBSD$ No functional changes, so no PORTREVISION bumps
56 lines
1.3 KiB
Bash
56 lines
1.3 KiB
Bash
#!/bin/sh
|
|
#
|
|
# $FreeBSD$
|
|
#
|
|
|
|
# PROVIDE: puppetmaster
|
|
# REQUIRE: NETWORK
|
|
|
|
# Add the following lines to /etc/rc.conf to enable the puppetmaster:
|
|
#
|
|
# puppetmaster_enable="YES"
|
|
#
|
|
|
|
. /etc/rc.subr
|
|
|
|
name="puppetmaster"
|
|
rcvar=`set_rcvar`
|
|
|
|
load_rc_config "${name}"
|
|
|
|
: ${puppetmaster_enable="NO"}
|
|
: ${puppetmaster_rundir="%%PUPPET_RUNDIR%%"}
|
|
: ${puppetmaster_flags="--rundir=${puppetmaster_rundir}"}
|
|
|
|
command_interpreter="%%PREFIX%%/bin/ruby18"
|
|
command="%%PREFIX%%/bin/puppet"
|
|
command_args="master ${puppetmaster_flags}"
|
|
unset puppetmaster_flags
|
|
|
|
pidfile="${puppetmaster_rundir}/master.pid"
|
|
|
|
start_precmd="puppetmaster_checkconfig"
|
|
restart_precmd="puppetmaster_checkconfig"
|
|
puppetmaster_checkconfig() {
|
|
echo -n "Performing sanity check of ${name} configuration: "
|
|
${command} ${command_args} --parseonly >/dev/null 2>&1
|
|
rv=$?
|
|
if [ $rv != 0 ]; then
|
|
echo "FAILED, ${name} exited with status ${rv}"
|
|
${command} ${command_args} --parseonly
|
|
return 1
|
|
else
|
|
echo "OK"
|
|
fi
|
|
}
|
|
|
|
if [ -z "${puppetmaster_mongrel_ports}" ]; then
|
|
run_rc_command "$1"
|
|
else
|
|
for port in ${puppetmaster_mongrel_ports}; do
|
|
pidfile="${puppetmaster_rundir}/mongrel.${port}.pid"
|
|
command_args="master --pidfile=${pidfile} --servertype=mongrel --masterport=${port}"
|
|
run_rc_command "$1"
|
|
_rc_restart_done="false"
|
|
done
|
|
fi
|