]>
Commit | Line | Data |
---|---|---|
e08e4dbf AF |
1 | Summary: TV streaming server |
2 | Name: tvheadend | |
977b0310 AM |
3 | # keep stable version announced on web page |
4 | Version: 3.4.27 | |
5ab46ce7 | 5 | Release: 0.1 |
e08e4dbf | 6 | License: GPL v3 |
7d3739f8 | 7 | Group: Applications/Multimedia |
e08e4dbf | 8 | URL: https://tvheadend.org/projects/tvheadend |
977b0310 AM |
9 | %define vername 3.4patch1 |
10 | Source0: https://github.com/tvheadend/tvheadend/archive/%{vername}.tar.gz | |
11 | # Source0-md5: 86d1be0ad6e02bd2aecd3d529a026797 | |
e08e4dbf AF |
12 | Source1: %{name}.conf |
13 | Source2: %{name}.service | |
14 | Source3: %{name}.sysconfig | |
7d3739f8 AM |
15 | Source4: %{name}.init |
16 | BuildRequires: avahi-devel | |
17 | BuildRequires: curl-devel | |
18 | BuildRequires: python-modules | |
e08e4dbf | 19 | BuildRequires: rpmbuild(macros) >= 1.647 |
7d3739f8 | 20 | BuildRequires: zlib-devel |
e08e4dbf AF |
21 | Requires(post,preun,postun): systemd-units >= 38 |
22 | Requires: systemd-units >= 0.38 | |
23 | Requires(post): pwgen | |
24 | Requires(post): sed >= 4.0 | |
7d3739f8 AM |
25 | Requires(post): /sbin/chkconfig |
26 | Requires(post,preun): /sbin/chkconfig | |
e08e4dbf AF |
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 | |
977b0310 | 35 | %setup -q -n %{name}-%{vername} |
e08e4dbf AF |
36 | |
37 | %build | |
e08e4dbf AF |
38 | export CFLAGS="%{rpmcflags}" |
39 | export CC="%{__cc}" | |
7d3739f8 AM |
40 | |
41 | # tvheadend uses a custom script, so %%configure cannot be used | |
e08e4dbf | 42 | # as not all options are supported |
5ab46ce7 AM |
43 | ./configure \ |
44 | --prefix=%{_prefix} \ | |
45 | --release \ | |
46 | --libdir=%{_libdir} \ | |
977b0310 | 47 | --mandir=%{_mandir}/man1 |
5ab46ce7 | 48 | |
e08e4dbf AF |
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} \ | |
7d3739f8 | 56 | $RPM_BUILD_ROOT/etc/{rc.d/init.d,sysconfig} |
e08e4dbf AF |
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} | |
7d3739f8 | 64 | cp %{SOURCE4} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name} |
e08e4dbf AF |
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 | |
7d3739f8 AM |
72 | /sbin/chkconfig --add tvheadend |
73 | %service tvheadend reload "tvheadend" | |
e08e4dbf AF |
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 | |
7d3739f8 AM |
83 | if [ "$1" = "0" ]; then |
84 | %service tvheadend stop | |
85 | /sbin/chkconfig --del tvheadend | |
86 | fi | |
e08e4dbf AF |
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} | |
7d3739f8 | 102 | %attr(754,root,root) /etc/rc.d/init.d/tvheadend |
e08e4dbf AF |
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 |