1 Summary: TV streaming server
3 # https://tvheadend.org/projects/tvheadend/wiki/Releases
7 Group: Applications/Multimedia
8 Source0: https://github.com/tvheadend/tvheadend/archive/v%{version}/%{name}-%{version}.tar.gz
9 # Source0-md5: dbb33a9b27a68749961f6aae700d9848
11 Source2: %{name}.service
12 Source3: %{name}.sysconfig
18 URL: https://tvheadend.org/projects/tvheadend
19 BuildRequires: avahi-devel
20 BuildRequires: curl-devel
21 BuildRequires: ffmpeg-devel
22 BuildRequires: python-modules
23 BuildRequires: rpmbuild(macros) >= 1.647
24 BuildRequires: uriparser-devel
25 BuildRequires: zlib-devel
27 Requires(post): sed >= 4.0
28 Requires(post,preun): /sbin/chkconfig
29 Requires(post,preun,postun): systemd-units >= 38
30 Requires(postun): /usr/sbin/userdel
31 Requires(pre): /bin/id
32 Requires(pre): /usr/sbin/useradd
34 Requires: systemd-units >= 0.38
35 Provides: user(tvheadend)
36 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
39 Tvheadend is a TV streaming server for Linux supporting DVB-S, DVB-S2,
40 DVB-C, DVB-T, ATSC, IPTV, and Analog video (V4L) as input sources.
54 export CFLAGS="%{rpmcflags}"
57 # tvheadend uses a custom script, so %%configure cannot be used
58 # as not all options are supported
69 rm -rf $RPM_BUILD_ROOT
70 install -d $RPM_BUILD_ROOT%{_localstatedir}/lib/%{name}/.hts/%{name}/accesscontrol \
71 $RPM_BUILD_ROOT%{_localstatedir}/lib/%{name}/Videos \
72 $RPM_BUILD_ROOT%{systemdunitdir} \
73 $RPM_BUILD_ROOT/etc/{rc.d/init.d,sysconfig}
76 DESTDIR=$RPM_BUILD_ROOT
78 cp -p %{SOURCE1} $RPM_BUILD_ROOT%{_localstatedir}/lib/%{name}/.hts/%{name}/accesscontrol/1
79 cp -p %{SOURCE2} $RPM_BUILD_ROOT%{systemdunitdir}/%{name}.service
80 cp -p %{SOURCE3} $RPM_BUILD_ROOT/etc/sysconfig/%{name}
81 install -p %{SOURCE4} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}
83 chmod +x $RPM_BUILD_ROOT%{_bindir}/%{name}
86 rm -rf $RPM_BUILD_ROOT
89 %useradd -u 20 -d %{_localstatedir}/lib/%{name} -g video -G usb -c "tvheadend User" tvheadend
92 /sbin/chkconfig --add tvheadend
93 %service tvheadend reload "tvheadend"
94 %systemd_post %{name}.service
96 # check if the access control file still has the initial dummy password, and
97 # replace the dummy password by a random, 12-character pwgen-generated password
98 if grep -q '"password": "dummypassword"' %{_localstatedir}/lib/%{name}/.hts/%{name}/accesscontrol/1; then
99 sed -i "s,\"password\": \"dummypassword\",\"password\": \"$(pwgen -s 12 1)\"," %{_localstatedir}/lib/%{name}/.hts/%{name}/accesscontrol/1
103 if [ "$1" = "0" ]; then
104 %service tvheadend stop
105 /sbin/chkconfig --del tvheadend
107 %systemd_preun %{name}.service
110 if [ "$1" = "0" ]; then
111 %userremove tvheadend
116 %defattr(644,root,root,755)
118 %attr(755,root,root) %{_bindir}/%{name}
119 %attr(754,root,root) /etc/rc.d/init.d/tvheadend
120 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/%{name}
121 %{_mandir}/man1/%{name}.1*
123 %{systemdunitdir}/%{name}.service
125 # home directory and config file
126 %dir %attr(755,tvheadend,root) %{_localstatedir}/lib/%{name}
127 %dir %attr(755,tvheadend,video) %{_localstatedir}/lib/%{name}/Videos
128 %dir %attr(750,tvheadend,video) %{_localstatedir}/lib/%{name}/.hts
129 %dir %attr(750,tvheadend,video) %{_localstatedir}/lib/%{name}/.hts/%{name}
130 %dir %attr(750,tvheadend,video) %{_localstatedir}/lib/%{name}/.hts/%{name}/accesscontrol
131 %attr(600,tvheadend,video) %config(noreplace) %verify(not md5 mtime size) %{_localstatedir}/lib/%{name}/.hts/%{name}/accesscontrol/1