#!/sbin/openrc-run

name="Tvheadend"
supervisor=supervise-daemon
log_file="/var/log/tvheadend/tvheadend.log"
supervise_daemon_args="--stdout $log_file --stderr $log_file"
command="/usr/bin/tvheadend"
command_args="-c /etc/tvheadend $TVH_ARGS"
command_user="tvheadend:video"
pidfile=/run/tvheadend.pid

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

start_pre() {
	if [ ! -f /etc/tvheadend/config ]; then
		ewarn "No configuration found!"
		ewarn "Configure tvheadend and setup a user via web interface and restart this service!"
		command_args="$command_args --firstrun"
	fi
}

