#!/sbin/openrc-run

# fallback values for /etc/conf.d/radarr
: ${command_user:=radarr:radarr}
: ${directory:=/var/lib/radarr}
: ${umask:=0002}

name=radarr
description="Radarr daemon"
command="/usr/lib/radarr/bin/Radarr"
command_args="-nobrowser -data=$directory"
command_background=true
pidfile="/run/$name.pid"

depend() {
	need net
	use dns logger netmount
}

start_pre() {
	checkpath -d -o "$command_user" "$directory"

	if [ -n "$logdir" ]; then
		checkpath -d -o "$command_user" "$logdir"
	fi

	if [ -n "$output_log" ]; then
		checkpath -f -o "$command_user" "$output_log"
	fi

	if [ -n "$error_log" ]; then
		checkpath -f -o "$command_user" "$error_log"
	fi
}
