1 Summary: TV streaming server
6 Group: Video/Television
7 URL: https://tvheadend.org/projects/tvheadend
8 Source0: https://github.com/tvheadend/tvheadend/archive/v3.9.tar.gz
9 # Source0-md5: 177f5ecf771a1877d38a00bf18806f15
11 Source2: %{name}.service
12 Source3: %{name}.sysconfig
13 BuildRequires: rpmbuild(macros) >= 1.647
14 Requires(post,preun,postun): systemd-units >= 38
15 Requires: systemd-units >= 0.38
17 Requires(post): sed >= 4.0
18 Requires: group(video)
19 Provides: user(%{name})
22 Tvheadend is a TV streaming server for Linux supporting DVB-S, DVB-S2,
23 DVB-C, DVB-T, ATSC, IPTV, and Analog video (V4L) as input sources.
26 %setup -q -n %{name}-%{version}
29 export CFLAGS="%{rpmcflags}"
31 #tvheadend uses a custom configure script, so %%configure cannot be used
32 # as not all options are supported
37 --mandir=%{_mandir}/man1 \
43 rm -rf $RPM_BUILD_ROOT
44 install -d $RPM_BUILD_ROOT%{_localstatedir}/lib/%{name}/.hts/%{name}/accesscontrol \
45 $RPM_BUILD_ROOT%{_localstatedir}/lib/%{name}/Videos \
46 $RPM_BUILD_ROOT%{systemdunitdir} \
47 $RPM_BUILD_ROOT/etc/sysconfig
50 DESTDIR=$RPM_BUILD_ROOT
52 cp %{SOURCE1} $RPM_BUILD_ROOT%{_localstatedir}/lib/%{name}/.hts/%{name}/accesscontrol/1
53 cp %{SOURCE2} $RPM_BUILD_ROOT%{systemdunitdir}/%{name}.service
54 cp %{SOURCE3} $RPM_BUILD_ROOT/etc/sysconfig/%{name}
56 chmod +x $RPM_BUILD_ROOT%{_bindir}/%{name}
59 %useradd -u 20 -d %{_localstatedir}/lib/%{name} -g video -c "tvheadend User" %{name}
62 %systemd_post %{name}.service
64 # check if the access control file still has the initial dummy password, and
65 # replace the dummy password by a random, 12-character pwgen-generated password
66 if grep -q '"password": "dummypassword"' %{_localstatedir}/lib/%{name}/.hts/%{name}/accesscontrol/1; then
67 sed -i "s,\"password\": \"dummypassword\",\"password\": \"$(pwgen -s 12 1)\"," %{_localstatedir}/lib/%{name}/.hts/%{name}/accesscontrol/1
71 %systemd_preun %{name}.service
74 if [ "$1" = "0" ]; then
80 rm -rf $RPM_BUILD_ROOT
83 %defattr(644,root,root,755)
85 %attr(755,root,root) %{_bindir}/%{name}
86 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/%{name}
87 %{_mandir}/man1/%{name}.1*
89 %{systemdunitdir}/%{name}.service
91 #home directory and config file
92 %dir %attr(755,tvheadend,root) %{_localstatedir}/lib/%{name}
93 %dir %attr(755,tvheadend,video) %{_localstatedir}/lib/%{name}/Videos
94 %dir %attr(750,tvheadend,video) %{_localstatedir}/lib/%{name}/.hts
95 %dir %attr(750,tvheadend,video) %{_localstatedir}/lib/%{name}/.hts/%{name}
96 %dir %attr(750,tvheadend,video) %{_localstatedir}/lib/%{name}/.hts/%{name}/accesscontrol
97 %attr(600,tvheadend,video) %config(noreplace) %verify(not md5 mtime size) %{_localstatedir}/lib/%{name}/.hts/%{name}/accesscontrol/1