← Back to team overview

cloud-init-dev team mailing list archive

[Merge] ~raharper/cloud-init:redhat-fix-spec-systemd into cloud-init:master

 

Ryan Harper has proposed merging ~raharper/cloud-init:redhat-fix-spec-systemd into cloud-init:master.

Requested reviews:
  cloud-init commiters (cloud-init-dev)

For more details, see:
https://code.launchpad.net/~raharper/cloud-init/+git/cloud-init/+merge/325402

Update redhat spec to use distro release version to determine if we use systemd

The typical rpm build process will examine the spec file to determine
which packages should be installed in the boot root.  This requires
the specfile to declare that it needs system.  Provide this information
by checking which version in which the rpm is being built and exporting
requirements for systemd.
-- 
Your team cloud-init commiters is requested to review the proposed merge of ~raharper/cloud-init:redhat-fix-spec-systemd into cloud-init:master.
diff --git a/packages/redhat/cloud-init.spec.in b/packages/redhat/cloud-init.spec.in
index 1939ca8..3e92c98 100644
--- a/packages/redhat/cloud-init.spec.in
+++ b/packages/redhat/cloud-init.spec.in
@@ -1,10 +1,12 @@
 ## template: cheetah
 %{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
 
-%if %{undefined systemd_requires}
-%define init_system sysvinit
-%else
+%define use_systemd (0%{?fedora} && 0%{?fedora} >= 18) || (0%{?rhel} && 0%{?rhel} >= 7)
+
+%if %{use_systemd}
 %define init_system systemd
+%else
+%define init_system sysvinit
 %endif
 
 # See: http://www.zarb.org/~jasonc/macros.php
@@ -29,6 +31,18 @@ BuildRequires:  python-setuptools
 %if "%{?el6}" == "1"
 BuildRequires:  python-argparse
 %endif
+%if %{use_systemd}
+Requires:           systemd
+BuildRequires:      systemd
+Requires:           systemd-units
+BuildRequires:      systemd-units
+%else
+Requires:           initscripts >= 8.36
+Requires(postun):   initscripts
+Requires(post):     chkconfig
+Requires(preun):    chkconfig
+%endif
+
 # These are runtime dependencies, but declared as BuildRequires so that
 # - tests can be run here.
 # - parts of cloud-init such (setup.py) use these dependencies.
@@ -68,8 +82,9 @@ Patch${size}: $p
 #end for
 
 %if "%{init_system}" == "systemd"
-BuildRequires:  systemd-units
-%{systemd_requires}
+Requires(post):       systemd
+Requires(preun):      systemd
+Requires(postun):     systemd
 %else
 Requires(post):       chkconfig
 Requires(postun):     initscripts

Follow ups