summaryrefslogtreecommitdiff
blob: b745146b5b97c838fefb953fe4c190df7ff2f064 (plain)
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
43
44
45
46
47
48
49
50
51
52
53
54
#!/sbin/runscript
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/media-tv/mythtv/files/0.18-mythbackend.rc,v 1.2 2005/05/14 17:10:03 cardoe Exp $

depend() {
	need net
	use mysql
}

checkconfig() {
	for i in $(groups "${MYTH_USER/:*/}") ; do
		[[ "${i}" == "audio" ]] && audio="yes"
		[[ "${i}" == "video" ]] && video="yes"
	done

	if [ -z "${audio}" -o -z "${video}" ] ; then
		ewarn ""
		[[ -z "${audio}" ]] && \
			ewarn "${HILITE}${MYTH_USER/:*/}${NORMAL} is not in the audio group"
		[[ -z "${video}" ]] && \
			ewarn "${HILITE}${MYTH_USER/:*/}${NORMAL} is not in the video group"
		ewarn ""
		ewarn "insufficient permissions discovered"
		ewarn "mythbackend may not start correctly"
		ewarn ""
	fi
}

start() {
	checkconfig
	[[ -z "${MYTH_USER}" ]] && MYTH_USER="nobody:nobody"
	[[ -z "${MYTH_NICE}" ]] && MYTH_NICE="0"
	[[ -z "${MYTH_VERBOSE}" ]] && MYTH_VERBOSE="none"

	HOME="/var/log/mythtv/"
	QTDIR=/usr/qt/3

	# Work around any strange permissions that may be on these files.
	chown -R "${MYTH_USER}" /var/log/mythtv/

	ebegin "Starting myth backend"
	start-stop-daemon --start --quiet --chuid "${MYTH_USER}" \
		--exec /usr/bin/mythbackend --nicelevel "${MYTH_NICE}" -- \
		--daemon --pidfile /var/run/mythbackend.pid --logfile /var/log/mythtv/mythbackend.log \
		--verbose ${MYTH_VERBOSE}
	eend $?
}

stop () {
	ebegin "Stopping myth backend"
	start-stop-daemon --stop --quiet --pidfile=/var/run/mythbackend.pid
	eend $?
}