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