2018-10-29 21:23:34 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# $FreeBSD$
|
|
|
|
#
|
|
|
|
# PROVIDE: albatross_tls
|
|
|
|
# REQUIRE: LOGIN albatross_daemon
|
2018-11-08 08:42:48 +00:00
|
|
|
# KEYWORD: shutdown
|
2018-10-29 21:23:34 +00:00
|
|
|
#
|
|
|
|
# Define these albatross_tls_* variables in one of these files
|
|
|
|
# /etc/rc.conf
|
|
|
|
# /etc/rc.conf.local
|
|
|
|
# /etc/rc.conf.d/albatross_tls
|
|
|
|
# /usr/local/etc/rc.conf.d/albatross_tls
|
|
|
|
#
|
|
|
|
# albatross_tls_flags:
|
|
|
|
# Default: ""
|
|
|
|
#
|
|
|
|
|
|
|
|
. /etc/rc.subr
|
|
|
|
|
|
|
|
name=albatross_tls
|
|
|
|
rcvar=${name}_enable
|
|
|
|
desc="Albatross tls service"
|
|
|
|
load_rc_config $name
|
|
|
|
start_cmd="albatross_tls_start"
|
2018-11-08 08:53:15 +00:00
|
|
|
start_precmd="albatross_tls_precmd"
|
|
|
|
|
2018-10-29 21:23:34 +00:00
|
|
|
|
|
|
|
: ${albatross_tls_enable:="NO"}
|
|
|
|
: ${albatross_tls_flags:=""}
|
|
|
|
: ${albatross_tls_user:="albatross"}
|
|
|
|
|
|
|
|
pidfile="/var/run/albatross_tls.pid"
|
2019-03-27 23:11:43 +00:00
|
|
|
procname="/usr/local/libexec/albatross/albatross_tls_endpoint"
|
2018-10-29 21:23:34 +00:00
|
|
|
|
2018-11-01 21:54:11 +00:00
|
|
|
#
|
|
|
|
# force_depend script [rcvar]
|
|
|
|
# Force a service to start. Intended for use by services
|
|
|
|
# to resolve dependency issues.
|
|
|
|
# $1 - filename of script, in /usr/local/etc/rc.d, to run
|
|
|
|
# $2 - name of the script's rcvar (minus the _enable)
|
|
|
|
#
|
|
|
|
my_force_depend()
|
|
|
|
{
|
|
|
|
local _depend _dep_rcvar
|
|
|
|
|
|
|
|
_depend="$1"
|
|
|
|
_dep_rcvar="${2:-$1}_enable"
|
|
|
|
|
|
|
|
[ -n "$rc_fast" ] && ! checkyesno always_force_depends &&
|
|
|
|
checkyesno $_dep_rcvar && return 0
|
|
|
|
|
|
|
|
/usr/local/etc/rc.d/${_depend} forcestatus >/dev/null 2>&1 && return 0
|
|
|
|
|
|
|
|
info "${name} depends on ${_depend}, which will be forced to start."
|
|
|
|
if ! /usr/local/etc/rc.d/${_depend} forcestart; then
|
|
|
|
warn "Unable to force ${_depend}. It may already be running."
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
albatross_tls_precmd() {
|
|
|
|
my_force_depend albatross_daemon || err 1 "Cannot run albatross_daemon"
|
|
|
|
}
|
|
|
|
|
2018-10-29 21:23:34 +00:00
|
|
|
albatross_tls_start () {
|
2018-11-08 08:50:20 +00:00
|
|
|
echo "Starting ${name}."
|
2018-10-29 21:23:34 +00:00
|
|
|
/usr/sbin/daemon -S -p "${pidfile}" -u "${albatross_tls_user}" \
|
2018-11-08 07:51:37 +00:00
|
|
|
"${procname}" ${albatross_tls_flags}
|
2018-10-29 21:23:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
run_rc_command "$1"
|