[xen] add systemd preset support (#1094938)

myoung myoung at fedoraproject.org
Mon May 12 18:22:11 UTC 2014


commit e933726cfaf89d2711d3291ad42f07dfbaeb5907
Author: Michael Young <m.a.young at durham.ac.uk>
Date:   Mon May 12 19:21:45 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 bb6c043..5934d5e 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
 # don't build xend unless rpmbuild was run with --with xend
 %define build_xend %{?_with_xend: 1} %{?!_with_xend: 0}
 
@@ -48,7 +53,7 @@
 Summary: Xen is a virtual machine monitor
 Name:    xen
 Version: 4.4.0
-Release: 3%{?dist}
+Release: 4%{?dist}
 Group:   Development/Libraries
 License: GPLv2+ and LGPLv2+ and BSD
 URL:     http://xen.org/
@@ -162,6 +167,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
@@ -485,10 +496,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 %build_xend
@@ -499,6 +514,9 @@ fi
 %endif
 
 %preun
+%if %with_systemd_presets
+%systemd_preun xendomains.service
+%else
 if [ $1 == 0 ]; then
 %if %with_sysv
 %if %build_xend
@@ -510,6 +528,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
@@ -517,11 +541,15 @@ fi
 /sbin/chkconfig --add xenstored
 %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
@@ -530,6 +558,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
@@ -540,6 +571,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
@@ -559,19 +596,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}
 
@@ -838,6 +888,9 @@ rm -rf %{buildroot}
 %endif
 
 %changelog
+* Mon May 12 2014 Michael Young <m.a.young at durham.ac.uk> - 4.4.0-4
+- add systemd preset support (#1094938)
+
 * Wed Apr 30 2014 Michael Young <m.a.young at durham.ac.uk> - 4.4.0-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