[polkit] Use the new systemd macros

Miloslav Trmac mitr at fedoraproject.org
Sat May 11 00:33:25 UTC 2013


commit d049388b01bb03c969cef3cc46e287c221dd5788
Author: Miloslav Trmač <mitr at redhat.com>
Date:   Sat May 11 01:40:25 2013 +0200

    Use the new systemd macros
    
    The macros are primarily targeted at services that can be
    enabled/disabled, while polkit.service is D-Bus-activated only.
    However, they hide/ignore the caused failures while performing the
    required daemon reloads, so we can use the same abstraction as every
    other unit.

 polkit.spec |   23 +++++++++++++++++++++--
 1 files changed, 21 insertions(+), 2 deletions(-)
---
diff --git a/polkit.spec b/polkit.spec
index 16602a3..15e9474 100644
--- a/polkit.spec
+++ b/polkit.spec
@@ -29,6 +29,9 @@ BuildRequires: libtool
 Requires: dbus, js, polkit-pkla-compat
 
 Requires(pre): shadow-utils
+Requires(post): /sbin/ldconfig, systemd
+Requires(preun): systemd
+Requires(postun): /sbin/ldconfig, systemd
 
 Obsoletes: PolicyKit <= 0.10
 Provides: PolicyKit = 0.11
@@ -102,9 +105,23 @@ getent group polkitd >/dev/null || groupadd -r polkitd
 getent passwd polkitd >/dev/null || useradd -r -g polkitd -d / -s /sbin/nologin -c "User for polkitd" polkitd
 exit 0
 
-%post -p /sbin/ldconfig
+%post
+/sbin/ldconfig
+# The implied (systemctl preset) will fail and complain, but the macro hides
+# and ignores the fact.  This is in fact what we want, polkit.service does not
+# have an [Install] section and it is always started on demand.
+%systemd_post polkit.service
 
-%postun -p /sbin/ldconfig
+%preun
+%systemd_preun polkit.service
+
+%postun
+/sbin/ldconfig
+# Not %%systemd_postun_with_restart - let's err on the side of safety, and keep
+# the daemon, with its temporary authorizations and agent registrations, running
+# after the upgrade as well; it would be unfortunate if the upgrade tool failed
+# because a component can't handle polkitd losing state.
+%systemd_postun
 
 %files -f polkit-1.lang
 %defattr(-,root,root,-)
@@ -148,6 +165,8 @@ exit 0
 %changelog
 * Fri May 10 2013 Miloslav Trmač <mitr at redhat.com> - 0.110-4
 - Build with V=1
+- Use the new systemd macros, primarily to run (systemctl daemon-reload)
+  Resolves: #857382
 
 * Fri May 10 2013 Miloslav Trmač <mitr at redhat.com> - 0.110-4
 - Make the JavaScript engine mandatory.  The polkit-js-engine package has been


More information about the scm-commits mailing list