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
19 Patch5: no-Werror.patch
20 URL: https://tvheadend.org/projects/tvheadend
21 BuildRequires: avahi-devel
22 BuildRequires: curl-devel
23 BuildRequires: ffmpeg-devel
24 BuildRequires: python-modules
25 BuildRequires: rpmbuild(macros) >= 1.647
26 BuildRequires: uriparser-devel
27 BuildRequires: zlib-devel
29 Requires(post): sed >= 4.0
30 Requires(post,preun): /sbin/chkconfig
31 Requires(post,preun,postun): systemd-units >= 38
32 Requires(postun): /usr/sbin/userdel
33 Requires(pre): /bin/id
34 Requires(pre): /usr/sbin/useradd
36 Requires: systemd-units >= 0.38
37 Provides: user(tvheadend)
38 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
41 Tvheadend is a TV streaming server for Linux supporting DVB-S, DVB-S2,
42 DVB-C, DVB-T, ATSC, IPTV, and Analog video (V4L) as input sources.
58 export CFLAGS="%{rpmcflags}"
61 # tvheadend uses a custom script, so %%configure cannot be used
62 # as not all options are supported
73 rm -rf $RPM_BUILD_ROOT
74 install -d $RPM_BUILD_ROOT%{_localstatedir}/lib/%{name}/.hts/%{name}/accesscontrol \
75 $RPM_BUILD_ROOT%{_localstatedir}/lib/%{name}/Videos \
76 $RPM_BUILD_ROOT%{systemdunitdir} \
77 $RPM_BUILD_ROOT/etc/{rc.d/init.d,sysconfig}
80 DESTDIR=$RPM_BUILD_ROOT
82 cp -p %{SOURCE1} $RPM_BUILD_ROOT%{_localstatedir}/lib/%{name}/.hts/%{name}/accesscontrol/1
83 cp -p %{SOURCE2} $RPM_BUILD_ROOT%{systemdunitdir}/%{name}.service
84 cp -p %{SOURCE3} $RPM_BUILD_ROOT/etc/sysconfig/%{name}
85 install -p %{SOURCE4} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}
87 chmod +x $RPM_BUILD_ROOT%{_bindir}/%{name}
90 rm -rf $RPM_BUILD_ROOT
93 %useradd -u 20 -d %{_localstatedir}/lib/%{name} -g video -G usb -c "tvheadend User" tvheadend
96 /sbin/chkconfig --add tvheadend
97 %service tvheadend reload "tvheadend"
98 %systemd_post %{name}.service
100 # check if the access control file still has the initial dummy password, and
101 # replace the dummy password by a random, 12-character pwgen-generated password
102 if grep -q '"password": "dummypassword"' %{_localstatedir}/lib/%{name}/.hts/%{name}/accesscontrol/1; then
103 sed -i "s,\"password\": \"dummypassword\",\"password\": \"$(pwgen -s 12 1)\"," %{_localstatedir}/lib/%{name}/.hts/%{name}/accesscontrol/1
107 if [ "$1" = "0" ]; then
108 %service tvheadend stop
109 /sbin/chkconfig --del tvheadend
111 %systemd_preun %{name}.service
114 if [ "$1" = "0" ]; then
115 %userremove tvheadend
120 %defattr(644,root,root,755)
122 %attr(755,root,root) %{_bindir}/%{name}
123 %attr(754,root,root) /etc/rc.d/init.d/tvheadend
124 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/%{name}
125 %{_mandir}/man1/%{name}.1*
127 %{systemdunitdir}/%{name}.service
129 # home directory and config file
130 %dir %attr(755,tvheadend,root) %{_localstatedir}/lib/%{name}
131 %dir %attr(755,tvheadend,video) %{_localstatedir}/lib/%{name}/Videos
132 %dir %attr(750,tvheadend,video) %{_localstatedir}/lib/%{name}/.hts
133 %dir %attr(750,tvheadend,video) %{_localstatedir}/lib/%{name}/.hts/%{name}
134 %dir %attr(750,tvheadend,video) %{_localstatedir}/lib/%{name}/.hts/%{name}/accesscontrol
135 %attr(600,tvheadend,video) %config(noreplace) %verify(not md5 mtime size) %{_localstatedir}/lib/%{name}/.hts/%{name}/accesscontrol/1