ports/sysutils/py-salt/files/salt_proxy.in
Jason Unovitch 46cc6a938d sysutils/py-salt: add new rc scripts, clean up current scripts
- Add salt-proxy.in and associated pkg-message text for Salt Proxy
- Restore installation of salt-api.in accidentally removed in r396791
- Set a default for PATH to address upstream issue 27151
- While here, make headers more verbose and trim variable quotes per rclint

PR:		203262
Submitted by:	Christer Edwards <christer.edwards@gmail.com> (maintainer)
2015-09-27 14:32:04 +00:00

59 lines
1.5 KiB
Bash

#!/bin/sh
# $FreeBSD$
#
# Salt Proxy startup script
#
# PROVIDE: salt_proxy
# REQUIRE: LOGIN
# KEYWORD: shutdown
# Add the following to /etc/rc.conf[.local] to enable this service
#
# salt_proxy_enable (bool): Set to NO by default.
# Set it to YES to enable salt_proxy.
# salt_proxy_paths (string): Set to "/sbin:/bin:/usr/sbin:/usr/bin:%%PREFIX%%/bin:%%PREFIX%%/sbin" by default.
# Default $PATH for Salt
# salt_proxy_eggcache (string): Set to "/tmp" by default.
# Allows defining egg cache directory to fix runtime on diskless systems.
# salt_proxy_list (string): Set to "" by default.
# Space separated list of proxies.
#
. /etc/rc.subr
name=salt_proxy
rcvar=salt_proxy_enable
load_rc_config ${name}
: ${salt_proxy_enable:=NO}
: ${salt_proxy_paths=/sbin:/bin:/usr/sbin:/usr/bin:%%PREFIX%%/bin:%%PREFIX%%/sbin}
: ${salt_proxy_eggcache=/tmp}
start_cmd=salt_proxy_start
command="%%PREFIX%%/bin/salt-proxy"
command_interpreter="%%PYTHON_CMD%%"
required_files="%%PREFIX%%/etc/salt"
command_args="-c ${required_files} -d"
export PATH="${salt_minion_paths}"
export PYTHON_EGG_CACHE="${salt_minion_eggcache}"
salt_proxy_start()
{
if [ ! -n "${salt_proxy_list}" ]; then
echo "${salt_proxy_list} is undefined"
return 1
fi
local _proxy
for _proxy in ${salt_proxy_list}; do
echo "Starting salt-proxy: ${_proxy}"
${command_interpreter} ${command} --proxyid ${_proxy} ${command_args}
done
}
run_rc_command "$1"