Project

General

Profile

Tvheadend gentoo » History » Version 11

William Peters, 2010-10-29 11:42
Add improved init scripts

1 10 William Peters
This article describes how to build Tvheadend from source 
2 1 William Peters
3 8 Andreas Smas
Make sure you have avahi and subversion installed, these are required to build Tvheadend
4 1 William Peters
5
{{{
6
# emerge -av avahi subversion
7
}}}
8
9 2 William Peters
now create the following directories
10 1 William Peters
11
{{{
12
mkdir -p /opt/tvheadend/src
13
}}}
14
15 9 William Peters
now you need to check out the Tvheadend source code using svn
16 1 William Peters
17
{{{
18
svn co svn://svn.lonelycoder.com/hts/trunk/tvheadend /opt/tvheadend/src/
19
}}}
20
21 9 William Peters
now you need to prepare the Tvheadend source code
22 1 William Peters
23
{{{
24
cd /opt/tvheadend/src
25 4 William Peters
./configure --prefix=/opt/tvheadend 
26 1 William Peters
}}}
27
28 9 William Peters
if all went well you can compile the Tvheadend source code
29 1 William Peters
30
{{{
31
make
32
}}}
33
34
If the source is compiled with no errors you can install the compiled source
35
36
{{{
37
make install
38
}}}
39
40 9 William Peters
if you want you can also create this init script to start Tvheadend at boot time
41 7 William Peters
42 6 William Peters
/etc/init.d/tvheadend
43 1 William Peters
{{{
44
#!/sbin/runscript
45
# Copyright 1999-2010 Gentoo Foundation
46
# Distributed under the terms of the GNU General Public License v2
47
# $Header:
48
49
depend() {
50
        need net
51
}
52
53
start() {
54 11 William Peters
        ebegin "Starting tvheadend"
55
        start-stop-daemon --start \
56
                --user ${TVHUSER} \
57
                --exec ${TVHBIN} -- -C -f
58 1 William Peters
        eend $?
59
}
60
61
stop() {
62 11 William Peters
        ebegin "Stopping tvheadend"
63
        start-stop-daemon --stop --quiet --name ${TVHNAME} --signal 2
64 1 William Peters
        eend $?
65
}
66
}}}
67
68 11 William Peters
/etc/conf.d/tvheadend
69
70
{{{
71
# /etc/conf.d/tvheadend: config file for /etc/init.d/tvheadend
72
73
TVHROOT="/opt/tvheadend"
74
TVHNAME="tvheadend"
75
TVHBIN="${TVHROOT}/bin/${TVHNAME}"
76
TVHUSER="${TVHNAME}"
77
}}}
78
79 1 William Peters
now set /etc/init.d/tvheadend as executable
80
81
{{{
82
chmod +x /etc/init.d/tvheadend
83 11 William Peters
}}}
84
85
Create a user for Tvheadend
86
87
{{{
88
useradd -d /opt/tvheadend/home/ -G tvheadend -s /sbin/nologin -m tvheadend
89 1 William Peters
}}}
90
91 9 William Peters
now you can try to start Tvheadend
92 1 William Peters
93
{{{
94
/etc/init.d/tvheadend start
95
}}}
96
97 9 William Peters
if this works fine you can also add it to runlevel default so Tvheadend starts automatically
98 1 William Peters
99
{{{
100
rc-update add tvheadend default
101
}}} 
102
103 9 William Peters
now you can go to [http://hostname:9981/ http://hostname:9981/] and start using/configuring Tvheadend