1 Summary: TV streaming server
3 # keep stable version announced on web page
7 Group: Applications/Multimedia
8 URL: https://tvheadend.org/projects/tvheadend
9 %define vername 3.4patch1
10 Source0: https://github.com/tvheadend/tvheadend/archive/%{vername}.tar.gz
11 # Source0-md5: 86d1be0ad6e02bd2aecd3d529a026797
13 Source2: %{name}.service
14 Source3: %{name}.sysconfig
16 BuildRequires: avahi-devel
17 BuildRequires: curl-devel
18 BuildRequires: python-modules
19 BuildRequires: rpmbuild(macros) >= 1.647
20 BuildRequires: zlib-devel
21 Requires(post,preun,postun): systemd-units >= 38
22 Requires: systemd-units >= 0.38
24 Requires(post): sed >= 4.0
25 Requires(post): /sbin/chkconfig
26 Requires(post,preun): /sbin/chkconfig
27 Requires: group(video)
28 Provides: user(%{name})
31 Tvheadend is a TV streaming server for Linux supporting DVB-S, DVB-S2,
32 DVB-C, DVB-T, ATSC, IPTV, and Analog video (V4L) as input sources.
35 %setup -q -n %{name}-%{vername}
38 export CFLAGS="%{rpmcflags}"
41 # tvheadend uses a custom script, so %%configure cannot be used
42 # as not all options are supported
47 --mandir=%{_mandir}/man1
52 rm -rf $RPM_BUILD_ROOT
53 install -d $RPM_BUILD_ROOT%{_localstatedir}/lib/%{name}/.hts/%{name}/accesscontrol \
54 $RPM_BUILD_ROOT%{_localstatedir}/lib/%{name}/Videos \
55 $RPM_BUILD_ROOT%{systemdunitdir} \
56 $RPM_BUILD_ROOT/etc/{rc.d/init.d,sysconfig}
59 DESTDIR=$RPM_BUILD_ROOT
61 cp %{SOURCE1} $RPM_BUILD_ROOT%{_localstatedir}/lib/%{name}/.hts/%{name}/accesscontrol/1
62 cp %{SOURCE2} $RPM_BUILD_ROOT%{systemdunitdir}/%{name}.service
63 cp %{SOURCE3} $RPM_BUILD_ROOT/etc/sysconfig/%{name}
64 cp %{SOURCE4} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}
66 chmod +x $RPM_BUILD_ROOT%{_bindir}/%{name}
69 %useradd -u 20 -d %{_localstatedir}/lib/%{name} -g video -c "tvheadend User" %{name}
72 /sbin/chkconfig --add tvheadend
73 %service tvheadend reload "tvheadend"
74 %systemd_post %{name}.service
76 # check if the access control file still has the initial dummy password, and
77 # replace the dummy password by a random, 12-character pwgen-generated password
78 if grep -q '"password": "dummypassword"' %{_localstatedir}/lib/%{name}/.hts/%{name}/accesscontrol/1; then
79 sed -i "s,\"password\": \"dummypassword\",\"password\": \"$(pwgen -s 12 1)\"," %{_localstatedir}/lib/%{name}/.hts/%{name}/accesscontrol/1
83 if [ "$1" = "0" ]; then
84 %service tvheadend stop
85 /sbin/chkconfig --del tvheadend
87 %systemd_preun %{name}.service
90 if [ "$1" = "0" ]; then
96 rm -rf $RPM_BUILD_ROOT
99 %defattr(644,root,root,755)
101 %attr(755,root,root) %{_bindir}/%{name}
102 %attr(754,root,root) /etc/rc.d/init.d/tvheadend
103 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/%{name}
104 %{_mandir}/man1/%{name}.1*
106 %{systemdunitdir}/%{name}.service
108 #home directory and config file
109 %dir %attr(755,tvheadend,root) %{_localstatedir}/lib/%{name}
110 %dir %attr(755,tvheadend,video) %{_localstatedir}/lib/%{name}/Videos
111 %dir %attr(750,tvheadend,video) %{_localstatedir}/lib/%{name}/.hts
112 %dir %attr(750,tvheadend,video) %{_localstatedir}/lib/%{name}/.hts/%{name}
113 %dir %attr(750,tvheadend,video) %{_localstatedir}/lib/%{name}/.hts/%{name}/accesscontrol
114 %attr(600,tvheadend,video) %config(noreplace) %verify(not md5 mtime size) %{_localstatedir}/lib/%{name}/.hts/%{name}/accesscontrol/1