File suse-ami-tools.spec of Package suse-ami-tools
#
# spec file for package suse-ami-tools (Version 1.0.2)
#
# Copyright (c) 2010 Novell, Inc.
# This file and all modifications and additions to the pristine
# package are under the same license as the package itself.
#
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
# norootforbuild
%define service amazon
%define service_late amazon-late
Name: suse-ami-tools
License: Apache 2.0, Amazon Software License
Group: Productivity/Networking/System
Version: 1.0.2
Release: 1
Summary: Tools for running openSUSE and SLE on Amazon EC2
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Source: %{name}-%{version}.tar.bz2
BuildArch: noarch
# We want a highly compatible package, so gzip the payload
%define _binary_payload w9.gzdio
# ec2-get-credentials
Requires: bash curl coreutils grep
# + ec2-update-tools
Requires: util-linux rpm gpg2
# + suse-ec2-update-repos
Requires: sed findutils glibc
# + suse-ec2-configure (technicall these could be Recommends for running AMIs)
Requires: gawk zypper build-key
# + the amazon initscript
Requires: aaa_base mkinitrd openssh
# + suse-ec2-install-tesla needs /sbin/lspci
Requires: pciutils
# These are only needed by ec2-handle-userdata
Recommends: tar unzip bzip2 gzip
Recommends: sces-client
%if 0%{suse_version}
Prereq: %insserv_prereq %fillup_prereq
%endif
Provides: ec2-ami-basics = 1.3-45455
Obsoletes: suse-ec2-tools
%description
These tools allow openSUSE and SLE to run on Amazon EC2.
One of the requirements of EC2 is to inject the keyfil into the image
via API call, this mechanism is provided in this package.
Authors:
--------
Peter Bowen <pzb@novell.com>
Marcus Schaefer <ms@novell.com>
Amazon EC2 Team
%prep
%setup
%build
%install
%makeinstall
%if 0%{suse_version}
mkdir -p "$RPM_BUILD_ROOT%{_sbindir}"
ln -sf /etc/init.d/%{service} $RPM_BUILD_ROOT%{_sbindir}/rc%{service}
ln -sf /etc/init.d/%{service_late} $RPM_BUILD_ROOT%{_sbindir}/rc%{service_late}
mkdir -p "$RPM_BUILD_ROOT/var/adm/fillup-templates"
mv "$RPM_BUILD_ROOT/etc/sysconfig/%{service}" "$RPM_BUILD_ROOT/var/adm/fillup-templates/sysconfig.%{service}"
%endif
%clean
rm -rf $RPM_BUILD_ROOT
%post
if [ -x /sbin/mkinitrd_setup ]; then
/sbin/mkinitrd_setup
fi
%if 0%{suse_version}
%fillup_and_insserv -n %{service}
%fillup_and_insserv -f %{service_late}
%else
/sbin/chkconfig --add %{service}
/sbin/chkconfig --add %{service_late}
%endif
# in order to comply with Amazon documentation
ln -sf /usr/sbin/ec2-update-tools /usr/local/sbin/update-tools.sh
ln -sf /usr/sbin/ec2-get-credentials /usr/local/sbin/get-credentials.sh
%preun
%if 0%{suse_version}
%stop_on_removal
%endif
%postun
%if 0%{suse_version}
%insserv_cleanup
%endif
if [ -x /sbin/mkinitrd_setup ]; then
/sbin/mkinitrd_setup
fi
# cleanup only on removal
if [ $1 = 0 ]; then
rm -f /usr/local/sbin/update-tools.sh /usr/local/sbin/get-credentials.sh
fi
%files
%defattr(-,root,root)
%doc LICENSE AMAZON-LICENSE
%config /etc/profile.d/ec2.sh
%{_sysconfdir}/ec2
%{_sysconfdir}/profile.d/*
%{_initrddir}/*
%if 0%{suse_version} < 1100
%dir /lib/mkinitrd
%dir /lib/mkinitrd/scripts
%endif
/lib/mkinitrd/scripts/*
%{_sbindir}/*
%{_datadir}/suse-ec2
%if 0%{suse_version}
/var/adm/fillup-templates/sysconfig.%{service}
%else
%config(noreplace) %{_sysconfdir}/sysconfig/%{service}
%endif
%changelog