1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-27 05:10:36 +00:00
freebsd-ports/net-p2p/sonarr/files/sonarr.in
Mark Felder 8eff792d53 net-p2p/sonarr: Fix $sonarr_data_dir creation
Now that $sonarr_data_dir is configurable, move creation from package to
rc script to prevent sonarr from failing to start successfully.

PR:		205986
MFH:		2016Q1
2016-01-07 17:26:21 +00:00

42 lines
774 B
Bash

#!/bin/sh
#
# Author: Mark Felder <feld@FreeBSD.org>
#
# $FreeBSD$
#
# PROVIDE: sonarr
# REQUIRE: LOGIN
# KEYWORD: shutdown
# Add the following lines to /etc/rc.conf to enable sonarr:
# sonarr_enable="YES"
. /etc/rc.subr
name="sonarr"
rcvar=sonarr_enable
load_rc_config $name
: ${sonarr_enable="NO"}
: ${sonarr_user:="sonarr"}
: ${sonarr_data_dir:="%%PREFIX%%/sonarr"}
pidfile="${sonarr_data_dir}/nzbdrone.pid"
procname="%%PREFIX%%/bin/mono"
command="/usr/sbin/daemon"
command_args="-f ${procname} %%DATADIR%%/NzbDrone.exe --nobrowser --data=${sonarr_data_dir}"
start_precmd=sonarr_precmd
sonarr_precmd()
{
export XDG_CONFIG_HOME=${sonarr_data_dir}
if [ ! -d ${sonarr_data_dir} ]; then
install -d -o ${sonarr_user} ${sonarr_data_dir}
fi
}
run_rc_command "$1"