Blob Blame History Raw
From 20becc2c3174ab500f4bce4f75a9604de30c9c35 Mon Sep 17 00:00:00 2001
From: Douglas Schilling Landgraf <dougsland@redhat.com>
Date: Mon, 4 Mar 2013 16:18:24 -0500
Subject: [PATCH 45/47] vdsm.spec: Adding with_systemd macro

This patch adds the macro with_systemd which can be used
to validate if the system uses Systemd.

Change-Id: Ibcd8567868e16453ed6633f143a6b1fff8e9c454
Signed-off-by: Douglas Schilling Landgraf <dougsland@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/12086
Tested-by: oVirt Jenkins CI Server
Reviewed-by: Vinzenz Feenstra <vfeenstr@redhat.com>
Reviewed-by: Yaniv Bronhaim <ybronhei@redhat.com>
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/13814
Reviewed-by: Federico Simoncelli <fsimonce@redhat.com>
---
 vdsm.spec.in | 45 ++++++++++++++++++++++++++++++---------------
 1 file changed, 30 insertions(+), 15 deletions(-)

diff --git a/vdsm.spec.in b/vdsm.spec.in
index 0120c3e..d7944cb 100644
--- a/vdsm.spec.in
+++ b/vdsm.spec.in
@@ -20,6 +20,15 @@
 %global _polkitdir %{_localstatedir}/lib/polkit-1/localauthority/10-vendor.d
 %endif
 
+# Systemd macro
+%if 0%{?fedora} >= 15
+%global with_systemd 1
+%endif
+
+%if 0%{?rhel} >= 7
+%global with_systemd 1
+%endif
+
 # Default to skipping autoreconf.  Distros can change just this one line
 # (or provide a command-line override) if they backport any patches that
 # touch configure.ac or Makefile.am.
@@ -66,6 +75,9 @@ BuildRequires: libtool
 %if !0%{?rhel}
 BuildRequires: pyflakes
 BuildRequires: python-pep8
+%endif
+
+%if 0%{?with_systemd}
 BuildRequires: systemd-units
 %endif
 
@@ -454,11 +466,21 @@ install -Dm 0644 vdsm/storage/12-vdsm-lvm.rules \
 install -Dm 0644 vdsm/limits.conf \
                  %{buildroot}/etc/security/limits.d/99-vdsm.conf
 
-%if 0%{?rhel}
+%if 0%{?with_systemd}
+# Install the systemd scripts
+install -Dm 0755 vdsm/vdsmd.init %{buildroot}/lib/systemd/systemd-vdsmd
+install -Dm 0644 vdsm/vdsmd.service %{buildroot}%{_unitdir}/vdsmd.service
+install -Dm 0755 vdsm_reg/vdsm-reg.init \
+                 %{buildroot}/lib/systemd/systemd-vdsm-reg
+install -Dm 0644 vdsm_reg/vdsm-reg.service \
+                 %{buildroot}%{_unitdir}/vdsm-reg.service
+%else
 # Install the SysV init scripts
 install -Dm 0755 vdsm/vdsmd.init %{buildroot}%{_initrddir}/vdsmd
 install -Dm 0755 vdsm_reg/vdsm-reg.init %{buildroot}%{_initrddir}/vdsm-reg
+%endif
 
+%if 0%{?rhel}
 # This is not commonplace, but we want /var/log/core to be a world-writable
 # dropbox for core dumps
 install -dDm 1777 %{buildroot}%{_localstatedir}/log/core
@@ -467,14 +489,6 @@ install -dDm 1777 %{buildroot}%{_localstatedir}/log/core
 install -Dm 0644 vdsm/vdsm.conf.sample \
                  %{buildroot}%{_sysconfdir}/vdsm/vdsm.conf
 
-# Install the systemd scripts
-install -Dm 0755 vdsm/vdsmd.init %{buildroot}/lib/systemd/systemd-vdsmd
-install -Dm 0644 vdsm/vdsmd.service %{buildroot}%{_unitdir}/vdsmd.service
-install -Dm 0755 vdsm_reg/vdsm-reg.init \
-                 %{buildroot}/lib/systemd/systemd-vdsm-reg
-install -Dm 0644 vdsm_reg/vdsm-reg.service \
-                 %{buildroot}%{_unitdir}/vdsm-reg.service
-
 # Install the polkit for libvirt
 %if 0%{?fedora} >= 18
 install -Dm 0644 vdsm/vdsm-libvirt-access.rules \
@@ -628,12 +642,13 @@ exit 0
 %files
 %defattr(-, root, root, -)
 %doc COPYING README vdsm/vdsm.conf.sample
-%if 0%{?rhel}
-%{_initrddir}/vdsmd
-%else
+%if 0%{?with_systemd}
 /lib/systemd/systemd-vdsmd
 %{_unitdir}/vdsmd.service
+%else
+%{_initrddir}/vdsmd
 %endif
+
 %dir %attr(-, %{vdsm_user}, %{vdsm_group}) @vdsmrepo@
 %ghost %dir %attr(-, %{vdsm_user}, %{vdsm_group}) @vdsmrepo@/hsm-tasks
 %ghost %dir %attr(-, %{vdsm_user}, %{vdsm_group}) @vdsmrepo@/mnt
@@ -981,11 +996,11 @@ exit 0
 %config(noreplace) %{_sysconfdir}/%{vdsm_reg}/logger.conf
 %ghost %dir /data
 %ghost %dir %attr(0775, root, root) /data/updates
-%if 0%{?rhel}
-%{_initrddir}/vdsm-reg
-%else
+%if 0%{?with_systemd}
 /lib/systemd/systemd-vdsm-reg
 %{_unitdir}/vdsm-reg.service
+%else
+%{_initrddir}/vdsm-reg
 %endif
 %{_datadir}/%{vdsm_reg}/vdsm-reg-setup
 %{_datadir}/%{vdsm_reg}/vdsm-complete
-- 
1.8.1.4