4 %define maj_version 3.4
5 %define tar_subversion patch1
8 Summary: TV streaming server
10 Version: %{maj_version}.%{min_version}
13 Group: Video/Television
14 URL: https://tvheadend.org/projects/tvheadend
15 Source0: https://github.com/tvheadend/tvheadend/archive/%{maj_version}%{tar_subversion}.tar.gz
16 # Source0-md5: 86d1be0ad6e02bd2aecd3d529a026797
18 Source2: %{name}.service
19 Source3: %{name}.sysconfig
20 #BuildRequires: avahi-client-devel
21 #BuildRequires: kdelibs4-devel
22 #BuildRequires: libgcrypt-devel
23 #BuildRequires: qt4-build
24 BuildRequires: rpmbuild(macros) >= 1.647
25 Requires(post,preun,postun): systemd-units >= 38
26 Requires: systemd-units >= 0.38
28 Requires(post): sed >= 4.0
29 Requires: group(video)
30 Provides: user(%{name})
33 Tvheadend is a TV streaming server for Linux supporting DVB-S, DVB-S2,
34 DVB-C, DVB-T, ATSC, IPTV, and Analog video (V4L) as input sources.
37 %setup -q -n %{name}-%{maj_version}%{tar_subversion}
40 #temporary workaround until upstream fixes compilation with gcc-4.6
41 #export CFLAGS="%{rpmcflags} -Wno-error=unused-but-set-variable"
42 export CFLAGS="%{rpmcflags}"
44 #tvheadend uses a custom configure script, so %%configure cannot be used
45 # as not all options are supported
46 ./configure --prefix=%{_prefix} --release --libdir=%{_libdir} --mandir=%{_mandir}/man1 --disable-dvbscan
50 rm -rf $RPM_BUILD_ROOT
51 install -d $RPM_BUILD_ROOT%{_localstatedir}/lib/%{name}/.hts/%{name}/accesscontrol \
52 $RPM_BUILD_ROOT%{_localstatedir}/lib/%{name}/Videos \
53 $RPM_BUILD_ROOT%{systemdunitdir} \
54 $RPM_BUILD_ROOT/etc/sysconfig
57 DESTDIR=$RPM_BUILD_ROOT
59 cp %{SOURCE1} $RPM_BUILD_ROOT%{_localstatedir}/lib/%{name}/.hts/%{name}/accesscontrol/1
60 cp %{SOURCE2} $RPM_BUILD_ROOT%{systemdunitdir}/%{name}.service
61 cp %{SOURCE3} $RPM_BUILD_ROOT/etc/sysconfig/%{name}
63 chmod +x $RPM_BUILD_ROOT%{_bindir}/%{name}
66 %useradd -u 20 -d %{_localstatedir}/lib/%{name} -g video -c "tvheadend User" %{name}
69 %systemd_post %{name}.service
71 # check if the access control file still has the initial dummy password, and
72 # replace the dummy password by a random, 12-character pwgen-generated password
73 if grep -q '"password": "dummypassword"' %{_localstatedir}/lib/%{name}/.hts/%{name}/accesscontrol/1; then
74 sed -i "s,\"password\": \"dummypassword\",\"password\": \"$(pwgen -s 12 1)\"," %{_localstatedir}/lib/%{name}/.hts/%{name}/accesscontrol/1
78 %systemd_preun %{name}.service
81 if [ "$1" = "0" ]; then
87 rm -rf $RPM_BUILD_ROOT
90 %defattr(644,root,root,755)
92 %attr(755,root,root) %{_bindir}/%{name}
93 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/%{name}
94 %{_mandir}/man1/%{name}.1*
96 %{systemdunitdir}/%{name}.service
98 #home directory and config file
99 %dir %attr(755,tvheadend,root) %{_localstatedir}/lib/%{name}
100 %dir %attr(755,tvheadend,video) %{_localstatedir}/lib/%{name}/Videos
101 %dir %attr(750,tvheadend,video) %{_localstatedir}/lib/%{name}/.hts
102 %dir %attr(750,tvheadend,video) %{_localstatedir}/lib/%{name}/.hts/%{name}
103 %dir %attr(750,tvheadend,video) %{_localstatedir}/lib/%{name}/.hts/%{name}/accesscontrol
104 %attr(600,tvheadend,video) %config(noreplace) %verify(not md5 mtime size) %{_localstatedir}/lib/%{name}/.hts/%{name}/accesscontrol/1