Patch replaces scriptlets with new systemd macros

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I created patch for spec file to follow changes in guidelines with
respect to new systemd macros (see
https://fedoraproject.org/wiki/Packaging:ScriptletSnippets#Systemd)

diff --git a/libvirt.spec b/libvirt.spec
index b47ec0e..675290f 100644
--- a/libvirt.spec
+++ b/libvirt.spec
@@ -316,7 +316,7 @@
 Summary: Library providing a simple virtualization API
 Name: libvirt
 Version: 0.10.2
-Release: 3%{?dist}%{?extra_release}
+Release: 4%{?dist}%{?extra_release}
 License: LGPLv2+
 Group: Development/Libraries
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
@@ -675,10 +675,10 @@ Requires: dmidecode
 %endif
 # For service management
 %if %{with_systemd}
-Requires(post): systemd-units
+Requires(post): systemd
 Requires(post): systemd-sysv
-Requires(preun): systemd-units
-Requires(postun): systemd-units
+Requires(preun): systemd
+Requires(postun): systemd
 %endif
 %if %{with_numad}
 Requires: numad
@@ -1444,11 +1444,8 @@ done
 %endif
 
 %if %{with_systemd}
-if [ $1 -eq 1 ] ; then
-    # Initial installation
-    /bin/systemctl enable libvirtd.service >/dev/null 2>&1 || :
-    /bin/systemctl enable cgconfig.service >/dev/null 2>&1 || :
-fi
+%systemd_post libvirtd.service cgconfig.service
+
 %else
 %if %{with_cgconfig}
 # Starting with Fedora 16/RHEL-7, systemd automounts all cgroups,
@@ -1468,11 +1465,7 @@ fi
 
 %preun daemon
 %if %{with_systemd}
-if [ $1 -eq 0 ] ; then
-    # Package removal, not upgrade
-    /bin/systemctl --no-reload disable libvirtd.service > /dev/null 2>&1 || :
-    /bin/systemctl stop libvirtd.service > /dev/null 2>&1 || :
-fi
+%systemd_preun libvirtd.service
 %else
 if [ $1 = 0 ]; then
     /sbin/service libvirtd stop 1>/dev/null 2>&1
@@ -1482,11 +1475,7 @@ fi
 
 %postun daemon
 %if %{with_systemd}
-/bin/systemctl daemon-reload >/dev/null 2>&1 || :
-if [ $1 -ge 1 ] ; then
-    # Package upgrade, not uninstall
-    /bin/systemctl try-restart libvirtd.service >/dev/null 2>&1 || :
-fi
+%systemd_postun_with_restart libvirtd.service
 %endif
 
 %if %{with_network}
@@ -1891,6 +1880,9 @@ rm -f $RPM_BUILD_ROOT%{_sysconfdir}/sysctl.d/libvirtd
 %endif
 
 %changelog
+* Fri Oct 19 2012 Václav Pavlín <vpavlin@xxxxxxxxxx> - 0.10.2-4
+- Scriptlets replaced with new systemd macros (#850186)
+
 * Mon Sep 24 2012 Richard W.M. Jones <rjones@xxxxxxxxxx> - 0.10.2-3
 - Re-add 0001-Use-qemu-system-i386-as-binary-instead-of-qemu.patch
   NB: This patch is Fedora-specific and not upstream.
--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]