pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/misc/ec2-ami-tools Import misc/ec2-ami-tools.



details:   https://anonhg.NetBSD.org/pkgsrc/rev/6b9495062171
branches:  trunk
changeset: 584850:6b9495062171
user:      jym <jym%pkgsrc.org@localhost>
date:      Mon Jan 31 20:56:13 2011 +0000

description:
Import misc/ec2-ami-tools.

The Amazon EC2 AMI Tools are command-line utilities to help bundle
an Amazon Machine Image (AMI), create an AMI from an existing machine
or installed volume, and upload a bundled AMI to Amazon S3.

You can use these to create and upload a NetBSD AMI to EC2. Bundling
and using NetBSD AMIs will be part of a wiki article, as there are some
limitations that I need to fix before making it official.
It has nothing to do with this pkg though, so in case someone wants to
play with AWS, there is no reason to hold it back.

Ruby modules are written so that they can be used on any platform
supported by Amazon (some Linuces and Solaris), I just re-used the
framework to make it work with NetBSD.

diffstat:

 misc/ec2-ami-tools/DESCR                        |    3 +
 misc/ec2-ami-tools/Makefile                     |   84 ++++++++++++++++++
 misc/ec2-ami-tools/PLIST                        |  108 ++++++++++++++++++++++++
 misc/ec2-ami-tools/TODO                         |    2 +
 misc/ec2-ami-tools/distinfo                     |    6 +
 misc/ec2-ami-tools/files/netbsd.rb              |   55 ++++++++++++
 misc/ec2-ami-tools/files/netbsd/architecture.rb |   50 +++++++++++
 misc/ec2-ami-tools/files/netbsd/constants.rb    |   58 ++++++++++++
 misc/ec2-ami-tools/files/netbsd/fstab.rb        |   45 ++++++++++
 misc/ec2-ami-tools/files/netbsd/identity.rb     |   34 +++++++
 misc/ec2-ami-tools/files/netbsd/image.rb        |   97 +++++++++++++++++++++
 misc/ec2-ami-tools/files/netbsd/mtab.rb         |   83 ++++++++++++++++++
 misc/ec2-ami-tools/files/netbsd/pipeline.rb     |   37 ++++++++
 misc/ec2-ami-tools/files/netbsd/rsync.rb        |   37 ++++++++
 misc/ec2-ami-tools/files/netbsd/tar.rb          |   56 ++++++++++++
 misc/ec2-ami-tools/files/netbsd/uname.rb        |   44 +++++++++
 misc/ec2-ami-tools/patches/patch-aa             |   14 +++
 17 files changed, 813 insertions(+), 0 deletions(-)

diffs (truncated from 881 to 300 lines):

diff -r 0bd805f3da08 -r 6b9495062171 misc/ec2-ami-tools/DESCR
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/misc/ec2-ami-tools/DESCR  Mon Jan 31 20:56:13 2011 +0000
@@ -0,0 +1,3 @@
+The Amazon EC2 AMI Tools are command-line utilities to help bundle
+an Amazon Machine Image (AMI), create an AMI from an existing machine
+or installed volume, and upload a bundled AMI to Amazon S3.
diff -r 0bd805f3da08 -r 6b9495062171 misc/ec2-ami-tools/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/misc/ec2-ami-tools/Makefile       Mon Jan 31 20:56:13 2011 +0000
@@ -0,0 +1,84 @@
+# $NetBSD: Makefile,v 1.1.1.1 2011/01/31 20:56:13 jym Exp $
+#
+
+PKGNAME=       ec2-ami-tools-1.3.57676
+DISTNAME=      ec2-ami-tools-1.3-57676
+
+.include "../../misc/ec2-api-tools/Makefile.common"
+
+CATEGORIES=    misc
+MASTER_SITES=  http://s3.amazonaws.com/ec2-downloads/
+EXTRACT_SUFX=  .zip
+
+MAINTAINER=    jym%NetBSD.org@localhost
+HOMEPAGE=      http://aws.amazon.com/developertools/368
+COMMENT=       Amazon EC2 AMI Tools (bundle, create, upload AMIs to S3)
+LICENSE=       amazon-software-license
+
+PKG_DESTDIR_SUPPORT=   user-destdir
+
+USE_TOOLS=     bash:run gtar:run gzip:run openssl:run pax tee:run
+
+DEPENDS+=      curl-[0-9]*:../../www/curl
+DEPENDS+=      rsync-[0-9]*:../../net/rsync
+DEPENDS+=      ruby${RUBY_VER}-base>=1.8.2:../../lang/ruby${RUBY_VER}-base
+
+NO_BUILD=      yes
+
+.include "../../mk/bsd.prefs.mk"
+
+REPLACE_INTERPRETER+=  bash
+REPLACE.bash.old=      /bin/bash
+REPLACE.bash.new=      /bin/sh
+REPLACE_FILES.bash=    bin/*
+
+SUBST_CLASSES+=                ec2-home
+SUBST_STAGE.ec2-home=  pre-configure
+SUBST_FILES.ec2-home=  bin/*
+SUBST_SED.ec2-home+=   -e 's|\$${EC2_HOME.*}|${EC2_HOME}}|g'
+SUBST_MESSAGE.ec2-home=        Setting EC2_HOME default path for scripts.
+
+SUBST_CLASSES+=                ruby
+SUBST_STAGE.ruby=      pre-configure
+SUBST_FILES.ruby=      bin/*
+SUBST_SED.ruby+=       -e 's|^ruby |${RUBY_NAME} |g'
+SUBST_MESSAGE.ruby=    Fixing ruby interpreter name.
+
+SUBST_CLASSES+=                ec2-rb
+SUBST_STAGE.ec2-rb=    pre-configure
+SUBST_FILES.ec2-rb+=   lib/ec2/common/curl.rb
+SUBST_FILES.ec2-rb+=   lib/ec2/platform/netbsd/constants.rb
+SUBST_VARS.ec2-rb+=    EC2_HOME
+SUBST_MESSAGE.ec2-rb=  Setting EC2_HOME constant for EC2 Ruby modules.
+
+PLIST_SUBST+=          EC2_DIR=${EC2_DIR:Q}
+
+INSTALLATION_DIRS+=    bin ${EC2_DIR}
+INSTALLATION_DIRS+=    ${EC2_DIR}/etc ${EC2_DIR}/bin ${EC2_DIR}/lib
+
+post-extract:
+       # Create and copy the NetBSD Ruby modules
+       ${MKDIR} ${WRKSRC}/lib/ec2/platform/netbsd/
+       ${CP} ${FILESDIR}/netbsd.rb ${WRKSRC}/lib/ec2/platform/
+       ${CP} ${FILESDIR}/netbsd/*.rb ${WRKSRC}/lib/ec2/platform/netbsd/
+
+       find ${WRKSRC}/lib ${WRKSRC}/etc -type d -exec \
+               ${CHMOD} ${PKGDIRMODE} {} \;
+       find ${WRKSRC}/lib ${WRKSRC}/etc -type f -exec \
+               ${CHMOD} ${NONBINMODE} {} \;
+
+do-install:
+       ${FIND} ${WRKSRC} -name \*.orig -type f -print | ${XARGS} ${RM} -f
+
+       cd ${WRKSRC}/etc && pax -rwpam . ${DESTDIR}${EC2_HOME}/etc
+       cd ${WRKSRC}/lib && pax -rwpam . ${DESTDIR}${EC2_HOME}/lib
+
+       cd ${WRKSRC}/bin && for f in *; do                      \
+               ${INSTALL_SCRIPT} $$f ${DESTDIR}${EC2_HOME}/bin;\
+               ${LN} -sf ${DESTDIR}${EC2_HOME}/bin/$$f         \
+                       ${DESTDIR}${PREFIX}/bin;                \
+       done
+
+.include "../../lang/ruby/replace.mk"
+.include "../../lang/ruby/rubyversion.mk"
+.include "../../mk/bsd.pkg.mk"
diff -r 0bd805f3da08 -r 6b9495062171 misc/ec2-ami-tools/PLIST
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/misc/ec2-ami-tools/PLIST  Mon Jan 31 20:56:13 2011 +0000
@@ -0,0 +1,108 @@
+@comment $NetBSD: PLIST,v 1.1.1.1 2011/01/31 20:56:13 jym Exp $
+bin/ec2-ami-tools-version
+bin/ec2-bundle-image
+bin/ec2-bundle-vol
+bin/ec2-delete-bundle
+bin/ec2-download-bundle
+bin/ec2-migrate-bundle
+bin/ec2-migrate-manifest
+bin/ec2-unbundle
+bin/ec2-upload-bundle
+${EC2_DIR}/bin/ec2-ami-tools-version
+${EC2_DIR}/bin/ec2-bundle-image
+${EC2_DIR}/bin/ec2-bundle-vol
+${EC2_DIR}/bin/ec2-delete-bundle
+${EC2_DIR}/bin/ec2-download-bundle
+${EC2_DIR}/bin/ec2-migrate-bundle
+${EC2_DIR}/bin/ec2-migrate-manifest
+${EC2_DIR}/bin/ec2-unbundle
+${EC2_DIR}/bin/ec2-upload-bundle
+${EC2_DIR}/etc/ec2/amitools/cert-ec2.pem
+${EC2_DIR}/etc/ec2/amitools/mappings.csv
+${EC2_DIR}/lib/ec2/amitools/bundle.rb
+${EC2_DIR}/lib/ec2/amitools/bundle_base.rb
+${EC2_DIR}/lib/ec2/amitools/bundleimage.rb
+${EC2_DIR}/lib/ec2/amitools/bundleimageparameters.rb
+${EC2_DIR}/lib/ec2/amitools/bundlemachineparameters.rb
+${EC2_DIR}/lib/ec2/amitools/bundleparameters.rb
+${EC2_DIR}/lib/ec2/amitools/bundlevol.rb
+${EC2_DIR}/lib/ec2/amitools/bundlevolparameters.rb
+${EC2_DIR}/lib/ec2/amitools/crypto.rb
+${EC2_DIR}/lib/ec2/amitools/decryptmanifest.rb
+${EC2_DIR}/lib/ec2/amitools/defaults.rb
+${EC2_DIR}/lib/ec2/amitools/deletebundle.rb
+${EC2_DIR}/lib/ec2/amitools/deletebundleparameters.rb
+${EC2_DIR}/lib/ec2/amitools/downloadbundle.rb
+${EC2_DIR}/lib/ec2/amitools/downloadbundleparameters.rb
+${EC2_DIR}/lib/ec2/amitools/exception.rb
+${EC2_DIR}/lib/ec2/amitools/fileutil.rb
+${EC2_DIR}/lib/ec2/amitools/format.rb
+${EC2_DIR}/lib/ec2/amitools/instance-data.rb
+${EC2_DIR}/lib/ec2/amitools/manifest_wrapper.rb
+${EC2_DIR}/lib/ec2/amitools/manifestv20070829.rb
+${EC2_DIR}/lib/ec2/amitools/manifestv20071010.rb
+${EC2_DIR}/lib/ec2/amitools/manifestv3.rb
+${EC2_DIR}/lib/ec2/amitools/mapids.rb
+${EC2_DIR}/lib/ec2/amitools/migratebundle.rb
+${EC2_DIR}/lib/ec2/amitools/migratebundleparameters.rb
+${EC2_DIR}/lib/ec2/amitools/migratemanifest.rb
+${EC2_DIR}/lib/ec2/amitools/migratemanifestparameters.rb
+${EC2_DIR}/lib/ec2/amitools/minimalec2.rb
+${EC2_DIR}/lib/ec2/amitools/parameter_exceptions.rb
+${EC2_DIR}/lib/ec2/amitools/parameters_base.rb
+${EC2_DIR}/lib/ec2/amitools/s3toolparameters.rb
+${EC2_DIR}/lib/ec2/amitools/showversion.rb
+${EC2_DIR}/lib/ec2/amitools/syschecks.rb
+${EC2_DIR}/lib/ec2/amitools/tool_base.rb
+${EC2_DIR}/lib/ec2/amitools/unbundle.rb
+${EC2_DIR}/lib/ec2/amitools/unbundleparameters.rb
+${EC2_DIR}/lib/ec2/amitools/uploadbundle.rb
+${EC2_DIR}/lib/ec2/amitools/uploadbundleparameters.rb
+${EC2_DIR}/lib/ec2/amitools/util.rb
+${EC2_DIR}/lib/ec2/amitools/version.rb
+${EC2_DIR}/lib/ec2/amitools/xmlbuilder.rb
+${EC2_DIR}/lib/ec2/amitools/xmlutil.rb
+${EC2_DIR}/lib/ec2/common/curl.rb
+${EC2_DIR}/lib/ec2/common/http.rb
+${EC2_DIR}/lib/ec2/common/s3support.rb
+${EC2_DIR}/lib/ec2/oem/LICENSE.txt
+${EC2_DIR}/lib/ec2/oem/open4.rb
+${EC2_DIR}/lib/ec2/platform.rb
+${EC2_DIR}/lib/ec2/platform/base.rb
+${EC2_DIR}/lib/ec2/platform/base/architecture.rb
+${EC2_DIR}/lib/ec2/platform/base/constants.rb
+${EC2_DIR}/lib/ec2/platform/base/pipeline.rb
+${EC2_DIR}/lib/ec2/platform/current.rb
+${EC2_DIR}/lib/ec2/platform/linux.rb
+${EC2_DIR}/lib/ec2/platform/linux/architecture.rb
+${EC2_DIR}/lib/ec2/platform/linux/constants.rb
+${EC2_DIR}/lib/ec2/platform/linux/fstab.rb
+${EC2_DIR}/lib/ec2/platform/linux/identity.rb
+${EC2_DIR}/lib/ec2/platform/linux/image.rb
+${EC2_DIR}/lib/ec2/platform/linux/mtab.rb
+${EC2_DIR}/lib/ec2/platform/linux/pipeline.rb
+${EC2_DIR}/lib/ec2/platform/linux/rsync.rb
+${EC2_DIR}/lib/ec2/platform/linux/tar.rb
+${EC2_DIR}/lib/ec2/platform/linux/uname.rb
+${EC2_DIR}/lib/ec2/platform/netbsd.rb
+${EC2_DIR}/lib/ec2/platform/netbsd/architecture.rb
+${EC2_DIR}/lib/ec2/platform/netbsd/constants.rb
+${EC2_DIR}/lib/ec2/platform/netbsd/fstab.rb
+${EC2_DIR}/lib/ec2/platform/netbsd/identity.rb
+${EC2_DIR}/lib/ec2/platform/netbsd/image.rb
+${EC2_DIR}/lib/ec2/platform/netbsd/mtab.rb
+${EC2_DIR}/lib/ec2/platform/netbsd/pipeline.rb
+${EC2_DIR}/lib/ec2/platform/netbsd/rsync.rb
+${EC2_DIR}/lib/ec2/platform/netbsd/tar.rb
+${EC2_DIR}/lib/ec2/platform/netbsd/uname.rb
+${EC2_DIR}/lib/ec2/platform/solaris.rb
+${EC2_DIR}/lib/ec2/platform/solaris/architecture.rb
+${EC2_DIR}/lib/ec2/platform/solaris/constants.rb
+${EC2_DIR}/lib/ec2/platform/solaris/fstab.rb
+${EC2_DIR}/lib/ec2/platform/solaris/identity.rb
+${EC2_DIR}/lib/ec2/platform/solaris/image.rb
+${EC2_DIR}/lib/ec2/platform/solaris/mtab.rb
+${EC2_DIR}/lib/ec2/platform/solaris/pipeline.rb
+${EC2_DIR}/lib/ec2/platform/solaris/rsync.rb
+${EC2_DIR}/lib/ec2/platform/solaris/tar.rb
+${EC2_DIR}/lib/ec2/platform/solaris/uname.rb
diff -r 0bd805f3da08 -r 6b9495062171 misc/ec2-ami-tools/TODO
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/misc/ec2-ami-tools/TODO   Mon Jan 31 20:56:13 2011 +0000
@@ -0,0 +1,2 @@
+- write the Ruby modules to build the AMIs. See solaris and linux examples.
+  Should be fairly trivial.
diff -r 0bd805f3da08 -r 6b9495062171 misc/ec2-ami-tools/distinfo
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/misc/ec2-ami-tools/distinfo       Mon Jan 31 20:56:13 2011 +0000
@@ -0,0 +1,6 @@
+$NetBSD: distinfo,v 1.1.1.1 2011/01/31 20:56:14 jym Exp $
+
+SHA1 (ec2-ami-tools-1.3-57676.zip) = 195406a962ee022927833186a84f0c5502b47354
+RMD160 (ec2-ami-tools-1.3-57676.zip) = 64f662c8c7b7607abe9700a03682062bebb8a361
+Size (ec2-ami-tools-1.3-57676.zip) = 137908 bytes
+SHA1 (patch-aa) = 4b6b7013032cc7c5db1a91dd6c2ed70e98d73659
diff -r 0bd805f3da08 -r 6b9495062171 misc/ec2-ami-tools/files/netbsd.rb
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/misc/ec2-ami-tools/files/netbsd.rb        Mon Jan 31 20:56:13 2011 +0000
@@ -0,0 +1,55 @@
+# $NetBSD: netbsd.rb,v 1.1.1.1 2011/01/31 20:56:14 jym Exp $
+#
+# Copyright (c) 2011 Jean-Yves Migeon <jym%NetBSD.org@localhost>
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+#------------------------------------------------------------------------------
+
+require 'ec2/platform/base'
+require 'ec2/platform/netbsd/architecture'
+require 'ec2/platform/netbsd/constants'
+require 'ec2/platform/netbsd/fstab'
+require 'ec2/platform/netbsd/identity'
+require 'ec2/platform/netbsd/image'
+require 'ec2/platform/netbsd/mtab'
+require 'ec2/platform/netbsd/pipeline'
+require 'ec2/platform/netbsd/rsync'
+require 'ec2/platform/netbsd/tar'
+require 'ec2/platform/netbsd/uname'
+
+module EC2
+  module Platform
+    module NetBSD
+      class System < EC2::Platform::Base::System
+        
+        BUNDLING_ARCHITECTURE = EC2::Platform::NetBSD::Architecture.bundling
+
+        def self.superuser?
+          return `id -u`.strip == '0'
+        end
+
+      end
+    end
+  end
+end
diff -r 0bd805f3da08 -r 6b9495062171 misc/ec2-ami-tools/files/netbsd/architecture.rb
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/misc/ec2-ami-tools/files/netbsd/architecture.rb   Mon Jan 31 20:56:13 2011 +0000
@@ -0,0 +1,50 @@
+# $NetBSD: architecture.rb,v 1.1.1.1 2011/01/31 20:56:14 jym Exp $
+#
+# Copyright (c) 2011 Jean-Yves Migeon <jym%NetBSD.org@localhost>
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+#



Home | Main Index | Thread Index | Old Index