[xen/f20] add systemd preset support (#1094938)

myoung myoung at fedoraproject.org
Sun May 18 22:03:46 UTC 2014


commit 7e29a404af2e76fde2d614991009d454b3c62ebf
Author: Michael Young <m.a.young at durham.ac.uk>
Date:   Sun May 18 23:03:07 2014 +0100

    add systemd preset support (#1094938)

 xen.spec |   55 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 54 insertions(+), 1 deletions(-)
---
diff --git a/xen.spec b/xen.spec
index 6baa795..5d3d48b 100644
--- a/xen.spec
+++ b/xen.spec
@@ -39,6 +39,11 @@
 %else
 %define with_systemd 0
 %endif
+%if "%dist" >= ".fc20"
+%define with_systemd_presets 1
+%else
+%define with_systemd_presets 0
+%endif
 
 # Hypervisor ABI
 %define hv_abi  4.3
@@ -46,7 +51,7 @@
 Summary: Xen is a virtual machine monitor
 Name:    xen
 Version: 4.3.2
-Release: 3%{?dist}
+Release: 4%{?dist}
 Group:   Development/Libraries
 License: GPLv2+ and LGPLv2+ and BSD
 URL:     http://xen.org/
@@ -163,6 +168,12 @@ BuildRequires: ocaml, ocaml-findlib
 %if %build_efi
 BuildRequires: mingw64-binutils
 %endif
+%if %with_systemd_presets
+Requires(post): systemd
+Requires(preun): systemd
+Requires(postun): systemd
+BuildRequires: systemd
+%endif
 
 %description
 This package contains the XenD daemon and xm command line
@@ -476,10 +487,14 @@ done
 /sbin/chkconfig --add xendomains
 %endif
 %if %with_systemd
+%if %with_systemd_presets
+%systemd_post xendomains.service
+%else
 if [ $1 == 1 ]; then
   /bin/systemctl enable xendomains.service
 fi
 %endif
+%endif
 
 %if %with_sysv
 if [ $1 != 0 ]; then
@@ -488,6 +503,9 @@ fi
 %endif
 
 %preun
+%if %with_systemd_presets
+%systemd_preun xendomains.service
+%else
 if [ $1 == 0 ]; then
 %if %with_sysv
   /sbin/chkconfig --del xend
@@ -497,6 +515,12 @@ if [ $1 == 0 ]; then
 /bin/systemctl disable xendomains.service
 %endif
 fi
+%endif
+
+%if %with_systemd_presets
+%postun
+%systemd_postun
+%endif
 
 %post runtime
 %if %with_sysv
@@ -505,11 +529,15 @@ fi
 #/sbin/chkconfig --add blktapctrl
 %endif
 %if %with_systemd
+%if %with_systemd_presets
+%systemd_post xenstored.service xenconsoled.service
+%else
 if [ $1 == 1 ]; then
   /bin/systemctl enable xenstored.service
   /bin/systemctl enable xenconsoled.service
 fi
 %endif
+%endif
 
 %if %with_sysv
 if [ $1 != 0 ]; then
@@ -518,6 +546,9 @@ fi
 %endif
 
 %preun runtime
+%if %with_systemd_presets
+%systemd_preun xenstored.service xenconsoled.service
+%else
 if [ $1 == 0 ]; then
 %if %with_sysv
   /sbin/chkconfig --del xenconsoled
@@ -529,6 +560,12 @@ if [ $1 == 0 ]; then
   /bin/systemctl disable xenconsoled.service
 %endif
 fi
+%endif
+
+%if %with_systemd_presets
+%postun runtime
+%systemd_postun
+%endif
 
 %post libs -p /sbin/ldconfig
 %postun libs -p /sbin/ldconfig
@@ -548,19 +585,32 @@ fi
 %if %build_ocaml
 %post ocaml
 %if %with_systemd
+%if %with_systemd_presets
+%systemd_post oxenstored.service
+%else
 if [ $1 == 1 ]; then
   /bin/systemctl enable oxenstored.service
 fi
 %endif
+%endif
 
 %preun ocaml
 %if %with_systemd
+%if %with_systemd_presets
+%systemd_post oxenstored.service
+%else
 if [ $1 == 0 ]; then
   /bin/systemctl disable oxenstored.service
 fi
 %endif
 %endif
 
+%if %with_systemd_presets
+%postun ocaml
+%systemd_postun
+%endif
+%endif
+
 %clean
 rm -rf %{buildroot}
 
@@ -814,6 +864,9 @@ rm -rf %{buildroot}
 %endif
 
 %changelog
+* Sun May 11 2014 Michael Young <m.a.young at durham.ac.uk> - 4.3.2-4
+- add systemd preset support (#1094938)
+
 * Thu May 01 2014 Michael Young <m.a.young at durham.ac.uk> - 4.3.2-3
 - HVMOP_set_mem_type allows invalid P2M entries to be created
 	[XSA-92, CVE-2014-3124] (#1093315)


More information about the scm-commits mailing list