## template: cheetah %{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")} # See: http://www.zarb.org/~jasonc/macros.php # Or: http://fedoraproject.org/wiki/Packaging:ScriptletSnippets # Or: http://www.rpm.org/max-rpm/ch-rpm-inside.html Name: cloud-init Version: ${rpm_upstream_version} Release: 1${subrelease}%{?dist} Summary: Cloud instance init scripts Group: System Environment/Base License: GPLv3 URL: http://launchpad.net/cloud-init Source0: ${archive_name} BuildArch: noarch BuildRoot: %{_tmppath} BuildRequires: python-devel BuildRequires: python-setuptools BuildRequires: python-cheetah # System util packages needed Requires: shadow-utils Requires: rsyslog Requires: iproute Requires: e2fsprogs Requires: net-tools Requires: procps Requires: shadow-utils Requires: sudo >= 1.7.2p2-3 # Install pypi 'dynamic' requirements #for $r in $requires Requires: ${r} #end for # Custom patches #set $size = 0 #for $p in $patches Patch${size}: $p #set $size += 1 #end for #if $sysvinit Requires(post): chkconfig Requires(postun): initscripts Requires(preun): chkconfig Requires(preun): initscripts #end if #if $systemd BuildRequires: systemd-units Requires(post): systemd-units Requires(postun): systemd-units Requires(preun): systemd-units #end if %description Cloud-init is a set of init scripts for cloud instances. Cloud instances need special scripts to run during initialization to retrieve and install ssh keys and to let the user run various scripts. %prep %setup -q -n ${source_name} # Custom patches activation #set $size = 0 #for $p in $patches %patch${size} -p1 #set $size += 1 #end for %build %{__python} setup.py build %install %{__python} setup.py install -O1 \ --skip-build --root \$RPM_BUILD_ROOT \ --init-system=${init_sys} # Note that /etc/rsyslog.d didn't exist by default until F15. # el6 request: https://bugzilla.redhat.com/show_bug.cgi?id=740420 mkdir -p \$RPM_BUILD_ROOT/%{_sysconfdir}/rsyslog.d cp -p tools/21-cloudinit.conf \ \$RPM_BUILD_ROOT/%{_sysconfdir}/rsyslog.d/21-cloudinit.conf # Remove the tests rm -rf \$RPM_BUILD_ROOT%{python_sitelib}/tests # Required dirs... mkdir -p \$RPM_BUILD_ROOT/%{_sharedstatedir}/cloud mkdir -p \$RPM_BUILD_ROOT/%{_libexecdir}/%{name} #if $systemd mkdir -p \$RPM_BUILD_ROOT/%{_unitdir} cp -p systemd/* \$RPM_BUILD_ROOT/%{_unitdir} #end if %clean rm -rf \$RPM_BUILD_ROOT %post #if $systemd if [ \$1 -eq 1 ] then /bin/systemctl enable cloud-config.service >/dev/null 2>&1 || : /bin/systemctl enable cloud-final.service >/dev/null 2>&1 || : /bin/systemctl enable cloud-init.service >/dev/null 2>&1 || : /bin/systemctl enable cloud-init-local.service >/dev/null 2>&1 || : fi #end if #if $sysvinit /sbin/chkconfig --add %{_initrddir}/cloud-init-local /sbin/chkconfig --add %{_initrddir}/cloud-init /sbin/chkconfig --add %{_initrddir}/cloud-config /sbin/chkconfig --add %{_initrddir}/cloud-final #end if %preun #if $sysvinit if [ \$1 -eq 0 ] then /sbin/service cloud-init stop >/dev/null 2>&1 || : /sbin/chkconfig --del cloud-init || : /sbin/service cloud-init-local stop >/dev/null 2>&1 || : /sbin/chkconfig --del cloud-init-local || : /sbin/service cloud-config stop >/dev/null 2>&1 || : /sbin/chkconfig --del cloud-config || : /sbin/service cloud-final stop >/dev/null 2>&1 || : /sbin/chkconfig --del cloud-final || : fi #end if #if $systemd if [ \$1 -eq 0 ] then /bin/systemctl --no-reload disable cloud-config.service >/dev/null 2>&1 || : /bin/systemctl --no-reload disable cloud-final.service >/dev/null 2>&1 || : /bin/systemctl --no-reload disable cloud-init.service >/dev/null 2>&1 || : /bin/systemctl --no-reload disable cloud-init-local.service >/dev/null 2>&1 || : fi #end if %postun #if $systemd /bin/systemctl daemon-reload >/dev/null 2>&1 || : #end if %files /lib/udev/rules.d/66-azure-ephemeral.rules #if $sysvinit %attr(0755, root, root) %{_initddir}/cloud-config %attr(0755, root, root) %{_initddir}/cloud-final %attr(0755, root, root) %{_initddir}/cloud-init-local %attr(0755, root, root) %{_initddir}/cloud-init #end if #if $systemd /usr/lib/systemd/system-generators/cloud-init-generator %{_unitdir}/cloud-* %{_unitdir}/cloud-* #end if # Program binaries %{_bindir}/cloud-init* %{_libexecdir}/%{name}/uncloud-init %{_libexecdir}/%{name}/write-ssh-key-fingerprints # Docs %doc LICENSE ChangeLog TODO.rst requirements.txt %doc %{_defaultdocdir}/cloud-init/* # Configs %config(noreplace) %{_sysconfdir}/cloud/cloud.cfg %dir %{_sysconfdir}/cloud/cloud.cfg.d %config(noreplace) %{_sysconfdir}/cloud/cloud.cfg.d/*.cfg %config(noreplace) %{_sysconfdir}/cloud/cloud.cfg.d/README %dir %{_sysconfdir}/cloud/templates %config(noreplace) %{_sysconfdir}/cloud/templates/* %config(noreplace) %{_sysconfdir}/rsyslog.d/21-cloudinit.conf %{_libexecdir}/%{name} %dir %{_sharedstatedir}/cloud # Python code is here... %{python_sitelib}/*