]> git.pld-linux.org Git - packages/tvheadend.git/blob - tvheadend.spec
72069096ebbd0110d22e98228774c8a0d7b1a096
[packages/tvheadend.git] / tvheadend.spec
1 Summary:        TV streaming server
2 Name:           tvheadend
3 Version:        3.9
4 Release:        0.1
5 License:        GPL v3
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
10 Source1:        %{name}.conf
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
16 Requires(post): pwgen
17 Requires(post): sed >= 4.0
18 Requires:       group(video)
19 Provides:       user(%{name})
20
21 %description
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.
24
25 %prep
26 %setup -q -n %{name}-%{version}
27
28 %build
29 export CFLAGS="%{rpmcflags}"
30 export CC="%{__cc}"
31 #tvheadend uses a custom configure script, so %%configure cannot be used
32 # as not all options are supported
33 ./configure \
34         --prefix=%{_prefix} \
35         --release \
36         --libdir=%{_libdir} \
37         --mandir=%{_mandir}/man1 \
38         --disable-dvbscan
39
40 %{__make} V=1
41
42 %install
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
48
49 %{__make} install \
50         DESTDIR=$RPM_BUILD_ROOT
51
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}
55
56 chmod +x $RPM_BUILD_ROOT%{_bindir}/%{name}
57
58 %pre
59 %useradd -u 20 -d %{_localstatedir}/lib/%{name} -g video -c "tvheadend User" %{name}
60
61 %post
62 %systemd_post %{name}.service
63
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
68 fi
69
70 %preun
71 %systemd_preun %{name}.service
72
73 %postun
74 if [ "$1" = "0" ]; then
75         %userremove %{name}
76 fi
77 %systemd_reload
78
79 %clean
80 rm -rf $RPM_BUILD_ROOT
81
82 %files
83 %defattr(644,root,root,755)
84 %doc docs
85 %attr(755,root,root) %{_bindir}/%{name}
86 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/%{name}
87 %{_mandir}/man1/%{name}.1*
88 %{_datadir}/%{name}
89 %{systemdunitdir}/%{name}.service
90
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
98
This page took 0.210065 seconds and 2 git commands to generate.