#!/sbin/openrc-run
name="Nebula Networking"
description="Scalable overlay networking tool"

instance=${RC_SVCNAME##*.}
cfgfile="/etc/nebula/${instance:-config}.yml"
command="/usr/sbin/nebula"
command_args="-config $cfgfile"
command_user="nebula"
supervisor="supervise-daemon"
capabilities="^cap_net_admin"
output_log="/var/log/${RC_SVCNAME}.log"
error_log="/var/log/${RC_SVCNAME}.log"

depend() {
	need net
	use logger dns
	after firewall
}

start_pre() {
	$command -config $cfgfile -test
	checkpath -f -m 0644 -o "$command_user" "$output_log" "$error_log"
	checkpath -f -m 0640 -o "$command_user" "$cfgfile"
}
