diff options
-rw-r--r-- | packages/redhat/cloud-init.spec.in | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/packages/redhat/cloud-init.spec.in b/packages/redhat/cloud-init.spec.in index 1939ca88..3e92c98f 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 |