4907847
%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
4907847
4907847
Name:           cloud-init
4907847
Version:        0.6.2
a2171c6
Release:        0.6.bzr457%{?dist}
dace9fa
Summary:        Cloud instance init scripts
4907847
4907847
Group:          System Environment/Base
4907847
License:        GPLv3
4907847
URL:            http://launchpad.net/cloud-init
655e316
# bzr export -r 457 cloud-init-0.6.2-bzr457.tar.gz lp:cloud-init
655e316
Source0:        %{name}-%{version}-bzr457.tar.gz
4907847
Source1:        cloud-init-fedora.cfg
4907847
Source2:        cloud-init-README.fedora
4907847
Patch0:         cloud-init-0.6.2-fedora.patch
dace9fa
dace9fa
# The current patch set is in flux as we stabilize cloud-init on Fedora.
dace9fa
# It will be submitted upstream as soon as it becomes reasonable to do so.
dace9fa
4907847
# Add systemd support (not yet upstream)
4907847
Patch2:         cloud-init-0.6.2-systemd.patch
a2171c6
# Restore created files' selinux contexts (not yet upstream)
a2171c6
Patch3:         cloud-init-0.6.2-filecontext.patch
4907847
# Make locale file location configurable (not yet upstream)
4907847
Patch4:         cloud-init-0.6.2-localefile.patch
4907847
# Write timezone data to /etc/sysconfig/clock (not yet upstream)
4907847
Patch5:         cloud-init-0.6.2-tzsysconfig.patch
4907847
# Make enabling the puppet service work on Fedora (not yet upstream)
4907847
Patch7:         cloud-init-0.6.2-puppetenable.patch
f3b8d56
# Make the types of SSH keys to generate configurable (not yet upstream)
f3b8d56
Patch8:         cloud-init-0.6.2-sshkeytypes.patch
de68608
# https://bugs.launchpad.net/cloud-init/+bug/857926
de68608
Patch10:        cloud-init-0.6.2-runparts-emptydir.patch
974de09
# Deal with differences between out sshd service and Ubuntu's (not yet upstream)
974de09
Patch11:        cloud-init-0.6.2-sshsvc.patch
4907847
4907847
BuildArch:      noarch
4907847
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
4907847
4907847
BuildRequires:  python-devel
4907847
BuildRequires:  python-setuptools-devel
4907847
BuildRequires:  systemd-units
4907847
Requires:       e2fsprogs
4907847
Requires:       iproute
4907847
Requires:       libselinux-python
4907847
Requires:       net-tools
4907847
Requires:       procps
4907847
Requires:       python-boto
4907847
Requires:       python-cheetah
4907847
Requires:       python-configobj
4907847
Requires:       PyYAML
a6c1636
Requires:       rsyslog
4907847
Requires:       shadow-utils
4907847
Requires:       xfsprogs
a6c1636
Requires:       /usr/bin/run-parts
4907847
Requires(post):   systemd-units
4907847
Requires(preun):  systemd-units
4907847
Requires(postun): systemd-units
4907847
4907847
%description
4907847
Cloud-init is a set of init scripts for cloud instances.  Cloud instances
4907847
need special scripts to run during initialization to retrieve and install
4907847
ssh keys and to let the user run various scripts.
4907847
4907847
4907847
%prep
655e316
%setup -q -n %{name}-%{version}-bzr457
4907847
%patch0 -p1
4907847
%patch2 -p1
4907847
%patch3 -p1
4907847
%patch4 -p1
4907847
%patch5 -p1
4907847
%patch7 -p1
f3b8d56
%patch8 -p1
de68608
%patch10 -p1
974de09
%patch11 -p1
4907847
4907847
cp -p %{SOURCE2} README.fedora
4907847
4907847
4907847
%build
4907847
%{__python} setup.py build
4907847
4907847
4907847
%install
4907847
rm -rf $RPM_BUILD_ROOT
4907847
%{__python} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT
4907847
7ce36c0
for x in $RPM_BUILD_ROOT/%{_bindir}/*.py; do mv "$x" "${x%.py}"; done
4907847
chmod +x $RPM_BUILD_ROOT/%{python_sitelib}/cloudinit/SshUtil.py
7ce36c0
mkdir -p $RPM_BUILD_ROOT/%{_sharedstatedir}/cloud
4907847
4907847
# We supply our own config file since our software differs from Ubuntu's.
7ce36c0
cp -p %{SOURCE1} $RPM_BUILD_ROOT/%{_sysconfdir}/cloud/cloud.cfg
4907847
dace9fa
# Note that /etc/rsyslog.d didn't exist by default until F15.
dace9fa
# el6 request: https://bugzilla.redhat.com/show_bug.cgi?id=740420
7ce36c0
mkdir -p $RPM_BUILD_ROOT/%{_sysconfdir}/rsyslog.d
7ce36c0
cp -p tools/21-cloudinit.conf $RPM_BUILD_ROOT/%{_sysconfdir}/rsyslog.d/21-cloudinit.conf
4907847
4907847
# Install the systemd bits
4907847
mkdir -p        $RPM_BUILD_ROOT/%{_unitdir}
4907847
cp -p systemd/* $RPM_BUILD_ROOT/%{_unitdir}
4907847
4907847
4907847
%clean
4907847
rm -rf $RPM_BUILD_ROOT
4907847
4907847
4907847
%post
4907847
if [ $1 -eq 1 ] ; then
4907847
    # Initial installation
4907847
    # Enabled by default per "runs once then goes away" exception
4907847
    /bin/systemctl enable cloud-config.service     >/dev/null 2>&1 || :
4907847
    /bin/systemctl enable cloud-final.service      >/dev/null 2>&1 || :
4907847
    /bin/systemctl enable cloud-init.service       >/dev/null 2>&1 || :
4907847
    /bin/systemctl enable cloud-init-local.service >/dev/null 2>&1 || :
4907847
fi
4907847
4907847
%preun
4907847
if [ $1 -eq 0 ] ; then
4907847
    # Package removal, not upgrade
4907847
    /bin/systemctl --no-reload disable cloud-config.service >/dev/null 2>&1 || :
4907847
    /bin/systemctl --no-reload disable cloud-final.service  >/dev/null 2>&1 || :
4907847
    /bin/systemctl --no-reload disable cloud-init.service   >/dev/null 2>&1 || :
4907847
    /bin/systemctl --no-reload disable cloud-init-local.service >/dev/null 2>&1 || :
4907847
    # One-shot services -> no need to stop
4907847
fi
4907847
4907847
%postun
4907847
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
4907847
# One-shot services -> no need to restart
4907847
4907847
4907847
%files
4907847
%doc ChangeLog LICENSE TODO README.fedora
7ce36c0
%config(noreplace) %{_sysconfdir}/cloud/cloud.cfg
7ce36c0
%dir               %{_sysconfdir}/cloud/cloud.cfg.d
7ce36c0
%config(noreplace) %{_sysconfdir}/cloud/cloud.cfg.d/*.cfg
7ce36c0
%doc               %{_sysconfdir}/cloud/cloud.cfg.d/README
7ce36c0
%dir               %{_sysconfdir}/cloud/templates
7ce36c0
%config(noreplace) %{_sysconfdir}/cloud/templates/*
4907847
%{_unitdir}/cloud-config.service
4907847
%{_unitdir}/cloud-config.target
4907847
%{_unitdir}/cloud-final.service
4907847
%{_unitdir}/cloud-init-local.service
4907847
%{_unitdir}/cloud-init.service
4907847
%{python_sitelib}/*
4907847
%{_libexecdir}/%{name}
7ce36c0
%{_bindir}/cloud-init*
7ce36c0
%doc %{_datadir}/doc/%{name}
7ce36c0
%dir %{_sharedstatedir}/cloud
4907847
7ce36c0
%config(noreplace) %{_sysconfdir}/rsyslog.d/21-cloudinit.conf
4907847
4907847
4907847
%changelog
a2171c6
* Wed Sep 28 2011 Garrett Holmstrom <gholms@fedoraproject.org> - 0.6.2-0.6.bzr457
a2171c6
- Consolidated selinux file context patches
56f9947
- Fixed cloud-init.service dependencies
f354744
- Updated sshkeytypes patch
974de09
- Dealt with differences from Ubuntu's sshd
a2171c6
ae2090c
* Sat Sep 24 2011 Garrett Holmstrom <gholms@fedoraproject.org> - 0.6.2-0.5.bzr457
655e316
- Rebased against upstream rev 457
a6c1636
- Added missing dependencies
655e316
7ce36c0
* Fri Sep 23 2011 Garrett Holmstrom <gholms@fedoraproject.org> - 0.6.2-0.4.bzr450
7ce36c0
- Added more macros to the spec file
7ce36c0
3135871
* Fri Sep 23 2011 Garrett Holmstrom <gholms@fedoraproject.org> - 0.6.2-0.3.bzr450
3135871
- Fixed logfile permission checking
f3b8d56
- Fixed SSH key generation
1d49adc
- Fixed a bad method call in FQDN-guessing [LP:857891]
924e2ab
- Updated localefile patch
c338482
- Disabled the grub_dpkg module
de68608
- Fixed failures due to empty script dirs [LP:857926]
3135871
c29b445
* Fri Sep 23 2011 Garrett Holmstrom <gholms@fedoraproject.org> - 0.6.2-0.2.bzr450
c29b445
- Updated tzsysconfig patch
c29b445
4907847
* Wed Sep 21 2011 Garrett Holmstrom <gholms@fedoraproject.org> - 0.6.2-0.1.bzr450
4907847
- Initial packaging