1 Summary: TV streaming server
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
11 Source2: %{name}.service
12 Source3: %{name}.sysconfig
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
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})
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.
36 export CFLAGS="%{rpmcflags}"
39 # tvheadend uses a custom script, so %%configure cannot be used
40 # as not all options are supported
45 --mandir=%{_mandir}/man1 \
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}
58 DESTDIR=$RPM_BUILD_ROOT
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}
65 chmod +x $RPM_BUILD_ROOT%{_bindir}/%{name}
68 %useradd -u 20 -d %{_localstatedir}/lib/%{name} -g video -c "tvheadend User" %{name}
71 /sbin/chkconfig --add tvheadend
72 %service tvheadend reload "tvheadend"
73 %systemd_post %{name}.service
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
82 if [ "$1" = "0" ]; then
83 %service tvheadend stop
84 /sbin/chkconfig --del tvheadend
86 %systemd_preun %{name}.service
89 if [ "$1" = "0" ]; then
95 rm -rf $RPM_BUILD_ROOT
98 %defattr(644,root,root,755)
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*
105 %{systemdunitdir}/%{name}.service
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