]> git.pld-linux.org Git - packages/tvheadend.git/commitdiff
cleanups; useradd/del deps
authorElan Ruusamäe <glen@delfi.ee>
Sat, 11 Jan 2014 22:17:02 +0000 (00:17 +0200)
committerElan Ruusamäe <glen@delfi.ee>
Sat, 11 Jan 2014 22:17:02 +0000 (00:17 +0200)
tvheadend.spec

index a6d9c4ad41a8e67bf949b8bc78c292c68644a08c..2fae4f0cf17612b5be717b6bda503007e5426a85 100644 (file)
@@ -1,31 +1,35 @@
+# TODO
 Summary:       TV streaming server
 Name:          tvheadend
 # keep stable version announced on web page
+%define vername 3.4patch1
 Version:       3.4.27
 Release:       0.1
 License:       GPL v3
 Group:         Applications/Multimedia
-URL:           https://tvheadend.org/projects/tvheadend
-%define vername 3.4patch1
 Source0:       https://github.com/tvheadend/tvheadend/archive/%{vername}.tar.gz
 # Source0-md5: 86d1be0ad6e02bd2aecd3d529a026797
 Source1:       %{name}.conf
 Source2:       %{name}.service
 Source3:       %{name}.sysconfig
 Source4:       %{name}.init
+URL:           https://tvheadend.org/projects/tvheadend
 BuildRequires: avahi-devel
 BuildRequires: curl-devel
 BuildRequires: python-modules
 BuildRequires: rpmbuild(macros) >= 1.647
 BuildRequires: zlib-devel
-Requires(post,preun,postun):   systemd-units >= 38
-Requires:      systemd-units >= 0.38
 Requires(post):        pwgen
 Requires(post):        sed >= 4.0
-Requires(post):        /sbin/chkconfig
 Requires(post,preun):  /sbin/chkconfig
+Requires(post,preun,postun):   systemd-units >= 38
+Requires(postun):      /usr/sbin/userdel
+Requires(pre): /bin/id
+Requires(pre): /usr/sbin/useradd
 Requires:      group(video)
-Provides:      user(%{name})
+Requires:      systemd-units >= 0.38
+Provides:      user(tvheadend)
+BuildRoot:     %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
 %description
 Tvheadend is a TV streaming server for Linux supporting DVB-S, DVB-S2,
@@ -41,8 +45,8 @@ export CC="%{__cc}"
 # tvheadend uses a custom script, so %%configure cannot be used
 # as not all options are supported
 ./configure \
-       --prefix=%{_prefix} \
        --release \
+       --prefix=%{_prefix} \
        --libdir=%{_libdir} \
        --mandir=%{_mandir}/man1
 
@@ -58,15 +62,19 @@ install -d $RPM_BUILD_ROOT%{_localstatedir}/lib/%{name}/.hts/%{name}/accesscontr
 %{__make} install \
        DESTDIR=$RPM_BUILD_ROOT
 
-cp %{SOURCE1} $RPM_BUILD_ROOT%{_localstatedir}/lib/%{name}/.hts/%{name}/accesscontrol/1
-cp %{SOURCE2} $RPM_BUILD_ROOT%{systemdunitdir}/%{name}.service
-cp %{SOURCE3} $RPM_BUILD_ROOT/etc/sysconfig/%{name}
-cp %{SOURCE4} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}
+cp -p %{SOURCE1} $RPM_BUILD_ROOT%{_localstatedir}/lib/%{name}/.hts/%{name}/accesscontrol/1
+cp -p %{SOURCE2} $RPM_BUILD_ROOT%{systemdunitdir}/%{name}.service
+cp -p %{SOURCE3} $RPM_BUILD_ROOT/etc/sysconfig/%{name}
+install -p %{SOURCE4} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}
 
 chmod +x $RPM_BUILD_ROOT%{_bindir}/%{name}
 
+%clean
+rm -rf $RPM_BUILD_ROOT
+
 %pre
-%useradd -u 20 -d %{_localstatedir}/lib/%{name} -g video -G usb -c "tvheadend User" %{name}
+# FIXME: use registered uid!
+%useradd -u 20 -d %{_localstatedir}/lib/%{name} -g video -G usb -c "tvheadend User" tvheadend
 
 %post
 /sbin/chkconfig --add tvheadend
@@ -76,7 +84,7 @@ chmod +x $RPM_BUILD_ROOT%{_bindir}/%{name}
 # check if the access control file still has the initial dummy password, and
 # replace the dummy password by a random, 12-character pwgen-generated password
 if  grep -q '"password": "dummypassword"' %{_localstatedir}/lib/%{name}/.hts/%{name}/accesscontrol/1; then
-  sed -i "s,\"password\": \"dummypassword\",\"password\": \"$(pwgen -s 12 1)\"," %{_localstatedir}/lib/%{name}/.hts/%{name}/accesscontrol/1
+       sed -i "s,\"password\": \"dummypassword\",\"password\": \"$(pwgen -s 12 1)\"," %{_localstatedir}/lib/%{name}/.hts/%{name}/accesscontrol/1
 fi
 
 %preun
@@ -88,13 +96,10 @@ fi
 
 %postun
 if [ "$1" = "0" ]; then
-       %userremove %{name}
+       %userremove tvheadend
 fi
 %systemd_reload
 
-%clean
-rm -rf $RPM_BUILD_ROOT
-
 %files
 %defattr(644,root,root,755)
 %doc docs
@@ -105,11 +110,10 @@ rm -rf $RPM_BUILD_ROOT
 %{_datadir}/%{name}
 %{systemdunitdir}/%{name}.service
 
-#home directory and config file
+# home directory and config file
 %dir %attr(755,tvheadend,root) %{_localstatedir}/lib/%{name}
 %dir %attr(755,tvheadend,video) %{_localstatedir}/lib/%{name}/Videos
 %dir %attr(750,tvheadend,video) %{_localstatedir}/lib/%{name}/.hts
 %dir %attr(750,tvheadend,video) %{_localstatedir}/lib/%{name}/.hts/%{name}
 %dir %attr(750,tvheadend,video) %{_localstatedir}/lib/%{name}/.hts/%{name}/accesscontrol
 %attr(600,tvheadend,video) %config(noreplace) %verify(not md5 mtime size) %{_localstatedir}/lib/%{name}/.hts/%{name}/accesscontrol/1
-
This page took 0.126189 seconds and 4 git commands to generate.