]> git.pld-linux.org Git - packages/tvheadend.git/blob - tvheadend.spec
- switch to stable version 3.4.27
[packages/tvheadend.git] / tvheadend.spec
1 Summary:        TV streaming server
2 Name:           tvheadend
3 # keep stable version announced on web page
4 Version:        3.4.27
5 Release:        0.1
6 License:        GPL v3
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
12 Source1:        %{name}.conf
13 Source2:        %{name}.service
14 Source3:        %{name}.sysconfig
15 Source4:        %{name}.init
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
23 Requires(post): pwgen
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})
29
30 %description
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.
33
34 %prep
35 %setup -q -n %{name}-%{vername}
36
37 %build
38 export CFLAGS="%{rpmcflags}"
39 export CC="%{__cc}"
40
41 # tvheadend uses a custom script, so %%configure cannot be used
42 # as not all options are supported
43 ./configure \
44         --prefix=%{_prefix} \
45         --release \
46         --libdir=%{_libdir} \
47         --mandir=%{_mandir}/man1
48
49 %{__make} V=1
50
51 %install
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}
57
58 %{__make} install \
59         DESTDIR=$RPM_BUILD_ROOT
60
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}
65
66 chmod +x $RPM_BUILD_ROOT%{_bindir}/%{name}
67
68 %pre
69 %useradd -u 20 -d %{_localstatedir}/lib/%{name} -g video -c "tvheadend User" %{name}
70
71 %post
72 /sbin/chkconfig --add tvheadend
73 %service tvheadend reload "tvheadend"
74 %systemd_post %{name}.service
75
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
80 fi
81
82 %preun
83 if [ "$1" = "0" ]; then
84         %service tvheadend stop
85         /sbin/chkconfig --del tvheadend
86 fi
87 %systemd_preun %{name}.service
88
89 %postun
90 if [ "$1" = "0" ]; then
91         %userremove %{name}
92 fi
93 %systemd_reload
94
95 %clean
96 rm -rf $RPM_BUILD_ROOT
97
98 %files
99 %defattr(644,root,root,755)
100 %doc docs
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*
105 %{_datadir}/%{name}
106 %{systemdunitdir}/%{name}.service
107
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
115
This page took 0.103952 seconds and 3 git commands to generate.