[vdradmin-am] Use systemd macros in scriptlets (#850360).

Ville Skyttä scop at fedoraproject.org
Thu Jan 9 22:00:51 UTC 2014


commit 3234daf255f1da58b6ba086354318bad1c2f3c17
Author: Ville Skyttä <ville.skytta at iki.fi>
Date:   Fri Jan 10 00:00:55 2014 +0200

    Use systemd macros in scriptlets (#850360).
    
    - Clean up cache on package removal.

 vdradmin-am.spec |   37 ++++++++++++++++++-------------------
 1 files changed, 18 insertions(+), 19 deletions(-)
---
diff --git a/vdradmin-am.spec b/vdradmin-am.spec
index dec9946..064616f 100644
--- a/vdradmin-am.spec
+++ b/vdradmin-am.spec
@@ -3,7 +3,7 @@
 
 Name:           vdradmin-am
 Version:        3.6.9
-Release:        8%{?dist}
+Release:        9%{?dist}
 Summary:        Web interface for VDR
 
 # infobox.js is GPLv2, crystal icons LGPLv2+, everything else GPLv2+
@@ -23,14 +23,15 @@ BuildRequires:  perl(CGI)
 BuildRequires:  perl(HTTP::Date)
 BuildRequires:  perl(Locale::gettext)
 BuildRequires:  perl(URI)
-BuildRequires:  systemd-units
+# systemd >= 186 for scriptlet macros
+BuildRequires:  systemd >= 186
 Requires:       perl(Locale::gettext)
 Requires:       perl(Sys::Syslog)
 Requires:       perl(Template::Plugin::JavaScript)
 Requires(pre):  shadow-utils
-Requires(post): systemd-units
-Requires(preun): systemd-units
-Requires(postun): systemd-units
+Requires(post): systemd
+Requires(preun): systemd
+Requires(postun): systemd
 
 %description
 VDRAdmin-AM is a web interface for managing VDR.  You will need access
@@ -88,27 +89,21 @@ useradd -r -g vdradmin -d /var/lib/vdradmin -s /sbin/nologin \
 exit 0
 
 %post
-if [ $1 -eq 1 ] ; then
-   systemctl daemon-reload >/dev/null 2>&1 || :
 %if %{svdrpport} == 6419
-else
+if [ $1 -gt 1 ] ; then
     sed -i -e 's/^VDR_PORT = 2001.*/VDR_PORT = %{svdrpport}/' \
-        /var/lib/vdradmin/vdradmind.conf || :
-%endif
+        /var/lib/vdradmin/vdradmind.conf
 fi
+%endif
+%systemd_post vdradmind.service
 
 %preun
-if [ $1 -eq 0 ] ; then
-    systemctl --no-reload disable vdradmind.service >/dev/null 2>&1
-    systemctl stop vdradmind.service >/dev/null 2>&1 || :
-fi
+[ $1 -eq 0 ] && rm -rf /var/cache/vdradmin/*
+%systemd_preun vdradmind.service
 
 %postun
-systemctl daemon-reload >/dev/null 2>&1
-if [ $1 -gt 0 ] ; then
-    rm -rf /var/cache/vdradmin/*
-    systemctl try-restart vdradmind.service >/dev/null 2>&1 || :
-fi
+[ $1 -gt 0 ] && rm -rf /var/cache/vdradmin/*
+%systemd_postun_with_restart vdradmind.service
 
 %files -f vdradmin.lang
 %doc COPYING CREDITS FAQ HISTORY INSTALL LGPL.txt README*
@@ -130,6 +125,10 @@ fi
 
 
 %changelog
+* Thu Jan  9 2014 Ville Skyttä <ville.skytta at iki.fi> - 3.6.9-9
+- Use systemd macros in scriptlets (#850360).
+- Clean up cache on package removal.
+
 * Sat Aug 03 2013 Petr Pisar <ppisar at redhat.com> - 3.6.9-8
 - Perl 5.18 rebuild
 


More information about the scm-commits mailing list