]> git.pld-linux.org Git - packages/tvheadend.git/blame - tvheadend.spec
cleanups; useradd/del deps
[packages/tvheadend.git] / tvheadend.spec
CommitLineData
f2240875 1# TODO
e08e4dbf
AF
2Summary: TV streaming server
3Name: tvheadend
977b0310 4# keep stable version announced on web page
f2240875 5%define vername 3.4patch1
977b0310 6Version: 3.4.27
5ab46ce7 7Release: 0.1
e08e4dbf 8License: GPL v3
7d3739f8 9Group: Applications/Multimedia
977b0310
AM
10Source0: https://github.com/tvheadend/tvheadend/archive/%{vername}.tar.gz
11# Source0-md5: 86d1be0ad6e02bd2aecd3d529a026797
e08e4dbf
AF
12Source1: %{name}.conf
13Source2: %{name}.service
14Source3: %{name}.sysconfig
7d3739f8 15Source4: %{name}.init
f2240875 16URL: https://tvheadend.org/projects/tvheadend
7d3739f8
AM
17BuildRequires: avahi-devel
18BuildRequires: curl-devel
19BuildRequires: python-modules
e08e4dbf 20BuildRequires: rpmbuild(macros) >= 1.647
7d3739f8 21BuildRequires: zlib-devel
e08e4dbf
AF
22Requires(post): pwgen
23Requires(post): sed >= 4.0
7d3739f8 24Requires(post,preun): /sbin/chkconfig
f2240875
ER
25Requires(post,preun,postun): systemd-units >= 38
26Requires(postun): /usr/sbin/userdel
27Requires(pre): /bin/id
28Requires(pre): /usr/sbin/useradd
e08e4dbf 29Requires: group(video)
f2240875
ER
30Requires: systemd-units >= 0.38
31Provides: user(tvheadend)
32BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
e08e4dbf
AF
33
34%description
35Tvheadend is a TV streaming server for Linux supporting DVB-S, DVB-S2,
36DVB-C, DVB-T, ATSC, IPTV, and Analog video (V4L) as input sources.
37
38%prep
977b0310 39%setup -q -n %{name}-%{vername}
e08e4dbf
AF
40
41%build
e08e4dbf
AF
42export CFLAGS="%{rpmcflags}"
43export CC="%{__cc}"
7d3739f8
AM
44
45# tvheadend uses a custom script, so %%configure cannot be used
e08e4dbf 46# as not all options are supported
5ab46ce7 47./configure \
5ab46ce7 48 --release \
f2240875 49 --prefix=%{_prefix} \
5ab46ce7 50 --libdir=%{_libdir} \
977b0310 51 --mandir=%{_mandir}/man1
5ab46ce7 52
e08e4dbf
AF
53%{__make} V=1
54
55%install
56rm -rf $RPM_BUILD_ROOT
57install -d $RPM_BUILD_ROOT%{_localstatedir}/lib/%{name}/.hts/%{name}/accesscontrol \
58 $RPM_BUILD_ROOT%{_localstatedir}/lib/%{name}/Videos \
59 $RPM_BUILD_ROOT%{systemdunitdir} \
7d3739f8 60 $RPM_BUILD_ROOT/etc/{rc.d/init.d,sysconfig}
e08e4dbf
AF
61
62%{__make} install \
63 DESTDIR=$RPM_BUILD_ROOT
64
f2240875
ER
65cp -p %{SOURCE1} $RPM_BUILD_ROOT%{_localstatedir}/lib/%{name}/.hts/%{name}/accesscontrol/1
66cp -p %{SOURCE2} $RPM_BUILD_ROOT%{systemdunitdir}/%{name}.service
67cp -p %{SOURCE3} $RPM_BUILD_ROOT/etc/sysconfig/%{name}
68install -p %{SOURCE4} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}
e08e4dbf
AF
69
70chmod +x $RPM_BUILD_ROOT%{_bindir}/%{name}
71
f2240875
ER
72%clean
73rm -rf $RPM_BUILD_ROOT
74
e08e4dbf 75%pre
f2240875
ER
76# FIXME: use registered uid!
77%useradd -u 20 -d %{_localstatedir}/lib/%{name} -g video -G usb -c "tvheadend User" tvheadend
e08e4dbf
AF
78
79%post
7d3739f8
AM
80/sbin/chkconfig --add tvheadend
81%service tvheadend reload "tvheadend"
e08e4dbf
AF
82%systemd_post %{name}.service
83
84# check if the access control file still has the initial dummy password, and
85# replace the dummy password by a random, 12-character pwgen-generated password
86if grep -q '"password": "dummypassword"' %{_localstatedir}/lib/%{name}/.hts/%{name}/accesscontrol/1; then
f2240875 87 sed -i "s,\"password\": \"dummypassword\",\"password\": \"$(pwgen -s 12 1)\"," %{_localstatedir}/lib/%{name}/.hts/%{name}/accesscontrol/1
e08e4dbf
AF
88fi
89
90%preun
7d3739f8
AM
91if [ "$1" = "0" ]; then
92 %service tvheadend stop
93 /sbin/chkconfig --del tvheadend
94fi
e08e4dbf
AF
95%systemd_preun %{name}.service
96
97%postun
98if [ "$1" = "0" ]; then
f2240875 99 %userremove tvheadend
e08e4dbf
AF
100fi
101%systemd_reload
102
e08e4dbf
AF
103%files
104%defattr(644,root,root,755)
105%doc docs
106%attr(755,root,root) %{_bindir}/%{name}
7d3739f8 107%attr(754,root,root) /etc/rc.d/init.d/tvheadend
e08e4dbf
AF
108%config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/%{name}
109%{_mandir}/man1/%{name}.1*
110%{_datadir}/%{name}
111%{systemdunitdir}/%{name}.service
112
f2240875 113# home directory and config file
e08e4dbf
AF
114%dir %attr(755,tvheadend,root) %{_localstatedir}/lib/%{name}
115%dir %attr(755,tvheadend,video) %{_localstatedir}/lib/%{name}/Videos
116%dir %attr(750,tvheadend,video) %{_localstatedir}/lib/%{name}/.hts
117%dir %attr(750,tvheadend,video) %{_localstatedir}/lib/%{name}/.hts/%{name}
118%dir %attr(750,tvheadend,video) %{_localstatedir}/lib/%{name}/.hts/%{name}/accesscontrol
119%attr(600,tvheadend,video) %config(noreplace) %verify(not md5 mtime size) %{_localstatedir}/lib/%{name}/.hts/%{name}/accesscontrol/1
This page took 0.903025 seconds and 4 git commands to generate.