]> git.pld-linux.org Git - packages/tvheadend.git/blob - tvheadend.spec
- initial; unfinished init script, more work/testing needed
[packages/tvheadend.git] / tvheadend.spec
1 Summary:        TV streaming server
2 Name:           tvheadend
3 Version:        3.9
4 Release:        0.1
5 License:        GPL v3
6 Group:          Applications/Multimedia
7 URL:            https://tvheadend.org/projects/tvheadend
8 Source0:        https://github.com/tvheadend/tvheadend/archive/v%{version}.tar.gz
9 # Source0-md5:  177f5ecf771a1877d38a00bf18806f15
10 Source1:        %{name}.conf
11 Source2:        %{name}.service
12 Source3:        %{name}.sysconfig
13 Source4:        %{name}.init
14 BuildRequires:  avahi-devel
15 BuildRequires:  curl-devel
16 BuildRequires:  python-modules
17 BuildRequires:  rpmbuild(macros) >= 1.647
18 BuildRequires:  zlib-devel
19 Requires(post,preun,postun):    systemd-units >= 38
20 Requires:       systemd-units >= 0.38
21 Requires(post): pwgen
22 Requires(post): sed >= 4.0
23 Requires(post): /sbin/chkconfig
24 Requires(post,preun):   /sbin/chkconfig
25 Requires:       group(video)
26 Provides:       user(%{name})
27
28 %description
29 Tvheadend is a TV streaming server for Linux supporting DVB-S, DVB-S2,
30 DVB-C, DVB-T, ATSC, IPTV, and Analog video (V4L) as input sources.
31
32 %prep
33 %setup -q
34
35 %build
36 export CFLAGS="%{rpmcflags}"
37 export CC="%{__cc}"
38
39 # tvheadend uses a custom script, so %%configure cannot be used
40 # as not all options are supported
41 ./configure \
42         --prefix=%{_prefix} \
43         --release \
44         --libdir=%{_libdir} \
45         --mandir=%{_mandir}/man1 \
46         --disable-dvbscan
47
48 %{__make} V=1
49
50 %install
51 rm -rf $RPM_BUILD_ROOT
52 install -d $RPM_BUILD_ROOT%{_localstatedir}/lib/%{name}/.hts/%{name}/accesscontrol \
53         $RPM_BUILD_ROOT%{_localstatedir}/lib/%{name}/Videos \
54         $RPM_BUILD_ROOT%{systemdunitdir} \
55         $RPM_BUILD_ROOT/etc/{rc.d/init.d,sysconfig}
56
57 %{__make} install \
58         DESTDIR=$RPM_BUILD_ROOT
59
60 cp %{SOURCE1} $RPM_BUILD_ROOT%{_localstatedir}/lib/%{name}/.hts/%{name}/accesscontrol/1
61 cp %{SOURCE2} $RPM_BUILD_ROOT%{systemdunitdir}/%{name}.service
62 cp %{SOURCE3} $RPM_BUILD_ROOT/etc/sysconfig/%{name}
63 cp %{SOURCE4} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}
64
65 chmod +x $RPM_BUILD_ROOT%{_bindir}/%{name}
66
67 %pre
68 %useradd -u 20 -d %{_localstatedir}/lib/%{name} -g video -c "tvheadend User" %{name}
69
70 %post
71 /sbin/chkconfig --add tvheadend
72 %service tvheadend reload "tvheadend"
73 %systemd_post %{name}.service
74
75 # check if the access control file still has the initial dummy password, and
76 # replace the dummy password by a random, 12-character pwgen-generated password
77 if  grep -q '"password": "dummypassword"' %{_localstatedir}/lib/%{name}/.hts/%{name}/accesscontrol/1; then
78   sed -i "s,\"password\": \"dummypassword\",\"password\": \"$(pwgen -s 12 1)\"," %{_localstatedir}/lib/%{name}/.hts/%{name}/accesscontrol/1
79 fi
80
81 %preun
82 if [ "$1" = "0" ]; then
83         %service tvheadend stop
84         /sbin/chkconfig --del tvheadend
85 fi
86 %systemd_preun %{name}.service
87
88 %postun
89 if [ "$1" = "0" ]; then
90         %userremove %{name}
91 fi
92 %systemd_reload
93
94 %clean
95 rm -rf $RPM_BUILD_ROOT
96
97 %files
98 %defattr(644,root,root,755)
99 %doc docs
100 %attr(755,root,root) %{_bindir}/%{name}
101 %attr(754,root,root) /etc/rc.d/init.d/tvheadend
102 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/%{name}
103 %{_mandir}/man1/%{name}.1*
104 %{_datadir}/%{name}
105 %{systemdunitdir}/%{name}.service
106
107 #home directory and config file
108 %dir %attr(755,tvheadend,root) %{_localstatedir}/lib/%{name}
109 %dir %attr(755,tvheadend,video) %{_localstatedir}/lib/%{name}/Videos
110 %dir %attr(750,tvheadend,video) %{_localstatedir}/lib/%{name}/.hts
111 %dir %attr(750,tvheadend,video) %{_localstatedir}/lib/%{name}/.hts/%{name}
112 %dir %attr(750,tvheadend,video) %{_localstatedir}/lib/%{name}/.hts/%{name}/accesscontrol
113 %attr(600,tvheadend,video) %config(noreplace) %verify(not md5 mtime size) %{_localstatedir}/lib/%{name}/.hts/%{name}/accesscontrol/1
114
This page took 0.030257 seconds and 4 git commands to generate.