Ubuntu Pastebin

Paste from rharper at Thu, 8 Jun 2017 23:48:27 +0000

Download as text
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
commit 940fde0350e03382d7fed8d7e0f8414ebf02fca4 (HEAD -> redhat-selinux-fixes)
Author: Ryan Harper <ryan.harper@canonical.com>
Date:   Thu Jun 8 18:12:31 2017 -0500

    Update redhat spec to use versions to determine if we use systemd

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
Download as text