aboutsummaryrefslogtreecommitdiff
path: root/multimedia/mythtv/files/mythbackend.in
blob: 8c536759abf89ce4f2759899af7cd7573b9edfd8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/sh

# $FreeBSD$

# PROVIDE: mythbackend
# REQUIRE: DAEMON mysql
# KEYWORD: shutdown

# Define mythbackend_enable in /etc/rc.conf[.local] to enable mythbackend
#
# mythbackend_enable (bool):  Set to "NO" by default.
#                             Set it to "YES" to enable mythbackend.
# mythbackend_logpath (str):  Custom logpath for mythbackend.
#                             (default /var/log/mythtv)
# mythbackend_flags (str):    Additional flags for mythbackend.
# mythbackend_user (str):     Username to run with.

. /etc/rc.subr

name="mythbackend"
rcvar=mythbackend_enable
command="%%PREFIX%%/bin/${name}"

start_precmd="mythbackend_prestart"

mythbackend_prestart()
{
	if [ ! -d ${mythbackend_logpath} ]; then
		/usr/bin/install -o ${mythbackend_user} -g wheel -m 755 -d ${mythbackend_logpath}
	fi
}

load_rc_config $name

: ${mythbackend_enable="NO"}
: ${mythbackend_logpath="/var/log/mythtv"}
: ${mythbackend_user="root"}

command_args="-d --logpath ${mythbackend_logpath}"
HOME=$(/usr/sbin/pw usershow -7 -n "${mythbackend_user}" | /usr/bin/cut -d: -f6)

run_rc_command "$1"