summaryrefslogtreecommitdiff
blob: df44e7e7c7e6bc843af0c18ac303f332029b7ca4 (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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/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/freevo/files/freevo.rc6,v 1.6 2004/07/14 22:52:05 agriffis Exp $

depend() {
	use net xfs lircd
}

checkconfig() {
	if [ -z "${freevo}" -o "${freevo}" = "no" ] && \
		[ -z "${webserver}" -o "${webserver}" = "no" ] && \
		[ -z "${recordserver}" -o "${recordserver}" = "no" ] ; then
		eerror "All services are disabled."
		eerror "Please check /etc/conf.d/freevo"
		return 1
	fi

	sysctl -w dev.rtc.max-user-freq=1024 &> /dev/null
}

start() {
	checkconfig || return 1

	if [ "${freevo}" == "daemon" ] ; then
		ebegin "Starting Freevo daemon"
		/usr/bin/freevo daemon start
		eend $?
	elif [ "${freevo}" == "yes" ]; then
		ebegin "Starting Freevo"
		if egrep -q '^display.*(x11|dga)' /etc/freevo/freevo.conf ; then
			/usr/bin/freevo -fs &>/dev/null &
		else
			/usr/bin/freevo start
		fi
		eend $?
	fi

	if [ "${recordserver}" == "yes" ]; then
		ebegin "Starting Freevo recordserver"
		/usr/bin/freevo recordserver start
		eend $?
	fi

	if [ "${webserver}" == "yes" ]; then
		ebegin "Starting Freevo webserver"
		/usr/bin/freevo webserver start
		eend $?
	fi
}

stop() {
	if [ "${webserver}" == "yes" ]; then
		ebegin "Stopping Freevo webserver"
		/usr/bin/freevo webserver stop
		eend $?
	fi

	if [ "${recordserver}" == "yes" ]; then
		ebegin "Stopping Freevo recordserver"
		/usr/bin/freevo recordserver stop
		eend $?
	fi

	if [ "${freevo}" == "daemon" ]; then
		ebegin "Stopping Freevo daemon"
		/usr/bin/freevo daemon stop
		eend $?
	elif [ "${freevo}" == "yes" ]; then
		ebegin "Stopping Freevo"
		/usr/bin/freevo stop
		eend $?
	fi
}