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