Re: Patch replaces scriptlets with new systemd macros

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

 



Eric Blake píše v Čt 25. 10. 2012 v 10:41 -0600:
> Hello,

> Ah, then maybe you did answer the big question.  Except that I don't see
> the updated patch - did you forget to attach it?

Sure, I did forgot, sorry. Here it is...

diff --git a/daemon/libvirtd.service.in b/daemon/libvirtd.service.in
index b7afadf..b78c301 100644
--- a/daemon/libvirtd.service.in
+++ b/daemon/libvirtd.service.in
@@ -7,6 +7,7 @@
 Description=Virtualization daemon
 Before=libvirt-guests.service
 After=network.target
+Requires=cgconfig.service
 
 [Service]
 EnvironmentFile=-/etc/sysconfig/libvirtd
diff --git a/libvirt.spec.in b/libvirt.spec.in
index ebebfab..9cb07a0 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -319,6 +319,13 @@
 %define with_rhel5  0
 %endif
 
+%if 0%{?fedora} >= 18 || 0%{?rhel} >= 7
+%define with_systemd_macros 1
+%else
+%define with_systemd_macros 0
+%endif
+
+
 Summary: Library providing a simple virtualization API
 Name: libvirt
 Version: @VERSION@
@@ -1465,11 +1472,14 @@ 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
+%if %{with_systemd_macros} 
+    %systemd_post libvirtd.service
+%else
+    if [ $1 -eq 1 ] ; then
+        # Initial installation
+        /bin/systemctl enable libvirtd.service >/dev/null 2>&1 || :
+    fi
+%endif
 %else
 %if %{with_cgconfig}
 # Starting with Fedora 16/RHEL-7, systemd automounts all cgroups,
@@ -1489,11 +1499,15 @@ 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
+%if %{with_systemd_macros}
+    %systemd_preun libvirtd.service
+%else
+    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
+%endif
 %else
 if [ $1 = 0 ]; then
     /sbin/service libvirtd stop 1>/dev/null 2>&1
@@ -1503,11 +1517,15 @@ 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
+%if %{with_systemd_macros}
+    %systemd_postun_with_restart libvirtd.service
+%else
+    /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
+%endif
 %endif
 
 %if %{with_network}
@@ -1539,6 +1557,9 @@ fi
 %preun client
 
 %if %{with_systemd}
+%if %{with_systemd_macros}
+    %systemd_preun libvirt-guests.service
+%endif
 %else
 if [ $1 = 0 ]; then
     /sbin/chkconfig --del libvirt-guests
@@ -1550,6 +1571,9 @@ fi
 
 /sbin/ldconfig
 %if %{with_systemd}
+%if %{with_systemd_macros}
+    %systemd_post libvirt-guests.service
+%endif
 %else
 /sbin/chkconfig --add libvirt-guests
 %endif
@@ -1557,6 +1581,9 @@ fi
 %postun client -p /sbin/ldconfig
 
 %if %{with_systemd}
+%if %{with_systemd_macros}
+    %systemd_postun_with_restart libvirt-guests.service
+%endif
 %triggerun client -- libvirt < 0.9.4
 %{_bindir}/systemd-sysv-convert --save libvirt-guests >/dev/null 2>&1 ||:
 
--
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]