# # spec file for package cloud-init # # Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed # upon. The license for this file, and modifications and additions to the # file, is the same license as for the pristine package itself (unless the # license for the pristine package is not an Open Source License, in which # case the license is the MIT License). An "Open Source License" is a # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. # Please submit bugfixes or comments via http://bugs.opensuse.org/ # %define component cloud-init Name: %{component} Version: 0.7.2 Release: 0 Summary: Cloud node initialization tool License: GPL-3.0 Group: System/Management Url: http://launchpad.net/cloud-init/ Source0: %{component}-%{version}.tar.bz2 Source1: cloud.cfg.suse Patch0: fixupSysVinit.patch Patch1: slesHandler.patch Patch2: openSUSEHandler.diff Requires: python-argparse Requires: python-boto Requires: python-cheetah Requires: python-configobj Requires: python-oauth Requires: python-prettytable Requires: python-requests Requires: python-xml Requires: python-yaml BuildRequires: filesystem BuildRequires: python-devel BuildRequires: python-setuptools #BuildRequires: python-distribute BuildRequires: fdupes BuildRoot: %{_tmppath}/%{name}-%{version}-build %define docdir %{_defaultdocdir}/%{name} %if 0%{?suse_version} && 0%{?suse_version} <= 1110 %{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")} %else BuildArch: noarch %endif %if 0%{?suse_version} && 0%{?suse_version} <= 1210 %define initsys sysvinit %else %define initsys systemd %endif %{py_requires} %description Cloud-init is an init script that initializes a cloud node (VM) according to the fetched configuration data from the admin node. Authors: -------- Scott Moser %package doc Summary: Cloud node initialization tool doc Group: System/Management Recommends: cloud-init = %version %description doc Documentation and examples for cloud-init tools %package test Summary: Cloud node initialization tool tests Group: System/Management Requires: cloud-init = %version %description test Unit tests for the cloud-init tools %prep %setup -q -n %{component}-%{version} %patch0 %patch1 -p1 %patch2 -p1 %if 0%{?suse_version} <= 1130 # disable ecdsa for SLE 11 (not available) echo "ssh_genkeytypes: ['rsa', 'dsa']" >> %{S:1} %endif %build python setup.py build %install python setup.py install --skip-build --root=%{buildroot} --prefix=%{_prefix} --record-rpm=INSTALLED_FILES --install-lib=%{python_sitelib} --init-system=%{initsys} find %{buildroot} \( -name .gitignore -o -name .placeholder \) -delete # from debian install script for x in "%{buildroot}%{_bindir}/"*.py; do [ -f "${x}" ] && mv "${x}" "${x%.py}" done mkdir -p %{buildroot}%{_localstatedir}/lib/cloud # move documentation mkdir -p %{buildroot}%{_defaultdocdir} mv %{buildroot}/usr/share/doc/%{component} %{buildroot}%{docdir} cp -a %{S:1} %{buildroot}/%{_sysconfdir}/cloud/cloud.cfg %if 0%{?suse_version} %if 0%{?sles_version} != 0 sed -i s/INSERT_SUSE_DISTRO/sles/ %{buildroot}/%{_sysconfdir}/cloud/cloud.cfg %endif %if 0%{?sles_version} == 0 sed -i s/INSERT_SUSE_DISTRO/opensuse/ %{buildroot}/%{_sysconfdir}/cloud/cloud.cfg %endif %endif # remove debian/ubuntu specific profile.d file (bnc#779553) rm -f %{buildroot}%{_sysconfdir}/profile.d/Z99-cloud-locale-test.sh # move sysvinit scripts into the "right" place %if 0%{?suse_version} && 0%{?suse_version} <= 1210 mkdir -p %{buildroot}/%{_initddir} mv %{buildroot}%{_sysconfdir}/rc.d/init.d/* %{buildroot}%{_initddir}/ mkdir -p %{buildroot}/%{_sbindir} pushd "%{buildroot}%{_initddir}" for iniF in *; do ln -s "%{_initddir}/${iniF}" "%{buildroot}/%{_sbindir}/rc${iniF}" done popd %endif # remove duplicate files %if 0%{?suse_version} %fdupes %{buildroot}%{python_sitelib} %endif %files %defattr(-,root,root) %{python_sitelib}/cloudinit %{python_sitelib}/cloud_init*egg-info %{_bindir}/cloud-init %{_bindir}/cloud-init-per %config(noreplace) %{_sysconfdir}/cloud/ /usr/lib/cloud-init %if 0%{?suse_version} && 0%{?suse_version} <= 1210 %{_sbindir}/rc* %attr(0755, root, root) %{_initddir}/* %else %dir /etc/systemd %dir /etc/systemd/system %{_sysconfdir}/systemd/system/* %endif %dir %attr(0755, root, root) %{_localstatedir}/lib/cloud %files doc %defattr(-,root,root) %doc %{docdir} %files test %defattr(-,root,root) %{python_sitelib}/tests %postun %insserv_cleanup %changelog