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.
This commit is contained in:
parent
137910b14c
commit
0fcbfb7d9e
17 changed files with 813 additions and 0 deletions
3
misc/ec2-ami-tools/DESCR
Normal file
3
misc/ec2-ami-tools/DESCR
Normal file
|
@ -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.
|
84
misc/ec2-ami-tools/Makefile
Normal file
84
misc/ec2-ami-tools/Makefile
Normal file
|
@ -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
|
||||
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"
|
108
misc/ec2-ami-tools/PLIST
Normal file
108
misc/ec2-ami-tools/PLIST
Normal file
|
@ -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
|
2
misc/ec2-ami-tools/TODO
Normal file
2
misc/ec2-ami-tools/TODO
Normal file
|
@ -0,0 +1,2 @@
|
|||
- write the Ruby modules to build the AMIs. See solaris and linux examples.
|
||||
Should be fairly trivial.
|
6
misc/ec2-ami-tools/distinfo
Normal file
6
misc/ec2-ami-tools/distinfo
Normal file
|
@ -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
|
55
misc/ec2-ami-tools/files/netbsd.rb
Normal file
55
misc/ec2-ami-tools/files/netbsd.rb
Normal file
|
@ -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>
|
||||
# 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
|
50
misc/ec2-ami-tools/files/netbsd/architecture.rb
Normal file
50
misc/ec2-ami-tools/files/netbsd/architecture.rb
Normal file
|
@ -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>
|
||||
# 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.
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# NetBSD machine architectures as seen by EC2
|
||||
|
||||
require 'ec2/platform/base/architecture'
|
||||
require 'ec2/platform/netbsd/uname'
|
||||
|
||||
module EC2
|
||||
module Platform
|
||||
module NetBSD
|
||||
class Architecture < EC2::Platform::Base::Architecture
|
||||
|
||||
def self.bundling
|
||||
processor = Uname.processor
|
||||
|
||||
return Architecture::I386 if processor == "i386"
|
||||
return Architecture::X86_64 if processor == "x86_64"
|
||||
return Architecture::UNKNOWN
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
58
misc/ec2-ami-tools/files/netbsd/constants.rb
Normal file
58
misc/ec2-ami-tools/files/netbsd/constants.rb
Normal file
|
@ -0,0 +1,58 @@
|
|||
# $NetBSD: constants.rb,v 1.1.1.1 2011/01/31 20:56:14 jym Exp $
|
||||
#
|
||||
# Copyright (c) 2011 Jean-Yves Migeon <jym@NetBSD.org>
|
||||
# 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.
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# NetBSD overrides for EC2 AMI tools
|
||||
|
||||
require 'ec2/platform/base/constants'
|
||||
|
||||
module EC2
|
||||
module Platform
|
||||
module NetBSD
|
||||
module Constants
|
||||
|
||||
module Bundling
|
||||
include EC2::Platform::Base::Constants::Bundling
|
||||
|
||||
# Set EC2_HOME environment variable -- value is controlled
|
||||
# by pkgsrc's Makefiles of the EC2 API tools package
|
||||
EC2_HOME = '@EC2_HOME@'
|
||||
EC2_X509_CERT = File.join(EC2_HOME.to_s, '/etc/ec2/amitools/cert-ec2.pem')
|
||||
EC2_MAPPING_FILE = File.join(EC2_HOME.to_s, '/etc/ec2/amitools/mappings.csv')
|
||||
end
|
||||
|
||||
module Utility
|
||||
include EC2::Platform::Base::Constants::Utility
|
||||
|
||||
TAR = 'gtar'
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
45
misc/ec2-ami-tools/files/netbsd/fstab.rb
Normal file
45
misc/ec2-ami-tools/files/netbsd/fstab.rb
Normal file
|
@ -0,0 +1,45 @@
|
|||
# $NetBSD: fstab.rb,v 1.1.1.1 2011/01/31 20:56:14 jym Exp $
|
||||
#
|
||||
# Copyright (c) 2011 Jean-Yves Migeon <jym@NetBSD.org>
|
||||
# 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.
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
module EC2
|
||||
module Platform
|
||||
module NetBSD
|
||||
class Fstab
|
||||
DEFAULT = <<EOF
|
||||
# NetBSD /etc/fstab
|
||||
# See /usr/share/examples/fstab/ for more examples.
|
||||
/dev/xbd1a / ffs rw,log 1 1
|
||||
/dev/xbd0 /grub ext2 rw 2 2
|
||||
kernfs /kern kernfs rw
|
||||
ptyfs /dev/pts ptyfs rw
|
||||
procfs /proc procfs rw
|
||||
EOF
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
34
misc/ec2-ami-tools/files/netbsd/identity.rb
Normal file
34
misc/ec2-ami-tools/files/netbsd/identity.rb
Normal file
|
@ -0,0 +1,34 @@
|
|||
# $NetBSD: identity.rb,v 1.1.1.1 2011/01/31 20:56:14 jym Exp $
|
||||
#
|
||||
# Copyright (c) 2011 Jean-Yves Migeon <jym@NetBSD.org>
|
||||
# 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.
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
module EC2
|
||||
module Platform
|
||||
module NetBSD; end
|
||||
EC2::Platform::PEER = EC2::Platform::NetBSD unless defined? EC2::Platform::PEER
|
||||
end
|
||||
end
|
97
misc/ec2-ami-tools/files/netbsd/image.rb
Normal file
97
misc/ec2-ami-tools/files/netbsd/image.rb
Normal file
|
@ -0,0 +1,97 @@
|
|||
# $NetBSD: image.rb,v 1.1.1.1 2011/01/31 20:56:14 jym Exp $
|
||||
#
|
||||
# Copyright (c) 2011 Jean-Yves Migeon <jym@NetBSD.org>
|
||||
# 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 'fileutils'
|
||||
require 'ec2/platform/netbsd/mtab'
|
||||
require 'ec2/platform/netbsd/fstab'
|
||||
require 'ec2/platform/netbsd/constants'
|
||||
|
||||
module EC2
|
||||
module Platform
|
||||
module NetBSD
|
||||
|
||||
# Implements all the required commands to generate a NetBSD image
|
||||
# file. Note that the tools used here are specific to NetBSD; so
|
||||
# you have to use a NetBSD environment to create the file, or build
|
||||
# the tools from a NetBSD src tree (./build.sh -T TOOLDIR tools) and
|
||||
# add TOOLDIR to PATH.
|
||||
class Image
|
||||
|
||||
EXCLUDES = ['/kern', '/proc']
|
||||
|
||||
def initialize(volume, img_filename, img_size, exclude_dirs,
|
||||
fstab = nil, debug = false)
|
||||
|
||||
@volume = volume
|
||||
@img_filename = img_filename
|
||||
@img_size = img_size # in MiB
|
||||
@exclude_dirs = exclude_dirs
|
||||
@debug = debug
|
||||
@fstab = (fstab.nil? ? EC2::Platform::NetBSD::Fstab::DEFAULT : fstab)
|
||||
|
||||
end
|
||||
|
||||
# Make the image file.
|
||||
# Just use the tree generated via a ./build.sh release &&
|
||||
# ./build.sh install=/path/to/volume run from a NetBSD src tree.
|
||||
# build.sh nearly takes care of everything, but for more advanced
|
||||
# customization, the user should edit the files directly within
|
||||
# the generated tree.
|
||||
def make
|
||||
puts "Generating image file #{@img_filename} from path #{@volume}"
|
||||
|
||||
if not @exclude_dirs.nil?
|
||||
puts "WARNING: Excluding directories operation is not supported."
|
||||
puts "The following directories will NOT be excluded from " \
|
||||
"image file:"
|
||||
@exclude_dirs.each { |dir| puts("#{dir}\t") }
|
||||
end
|
||||
|
||||
### TODO Update fstab, etc... (do the extreme
|
||||
### minimum here, the script should not alter the install tree too
|
||||
### heavily)
|
||||
|
||||
execute("makefs -s '#{@img_size}m' -B le -o density=32k " \
|
||||
"'#{@img_filename}' '#{@volume}'")
|
||||
|
||||
puts "Image #{@img_filename} successfully created."
|
||||
end
|
||||
|
||||
def execute(cmd)
|
||||
if @debug
|
||||
puts "Executing command: '#{cmd}'"
|
||||
end
|
||||
|
||||
raise FatalError.new("Command '#{cmd}' failed") unless system(cmd)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
83
misc/ec2-ami-tools/files/netbsd/mtab.rb
Normal file
83
misc/ec2-ami-tools/files/netbsd/mtab.rb
Normal file
|
@ -0,0 +1,83 @@
|
|||
# $NetBSD: mtab.rb,v 1.1.1.1 2011/01/31 20:56:14 jym Exp $
|
||||
#
|
||||
# Copyright (c) 2011 Jean-Yves Migeon <jym@NetBSD.org>
|
||||
# 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.
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
module EC2
|
||||
module Platform
|
||||
module NetBSD
|
||||
|
||||
# Under NetBSD, local file-systems are indicated with a "local"
|
||||
# mount option.
|
||||
# Sadly, tools are written in such a way that we cannot use this
|
||||
# information directly without using ugly hacks. So we rely on a list
|
||||
# of file-systems that could only be locally mounted.
|
||||
LOCAL_FS_TYPES = ['cd9660', 'ext2fs', 'ffs', 'kernfs', 'lfs',
|
||||
'mfs', 'msdos', 'ntfs', 'null', 'procfs', 'tmpfs', 'udf']
|
||||
|
||||
class Mtab
|
||||
|
||||
attr_reader :entries
|
||||
|
||||
def initialize()
|
||||
@entries = Hash.new
|
||||
|
||||
`mount`.each_line {|line|
|
||||
entry = Entry.new(line)
|
||||
@entries[entry.mpoint] = entry
|
||||
}
|
||||
end
|
||||
|
||||
# NetBSD does not use mnttab to track mounts. Parse this info
|
||||
# from mount(8) output instead.
|
||||
def self.load
|
||||
return self.new()
|
||||
end
|
||||
|
||||
class Entry
|
||||
|
||||
attr_reader :device, :mpoint, :fstype, :options, :value
|
||||
|
||||
# Format is <dev> on <mount point> type <fstype> (<options>)
|
||||
REGEXP = /^(\S+) on (.+) type (\S+) \(([^)]+)\)$/
|
||||
|
||||
def initialize(value)
|
||||
@value = value.strip # complete line
|
||||
|
||||
if (m = REGEXP.match(@value))
|
||||
caps = m.captures
|
||||
@device = caps[0] # device mounted
|
||||
@mpoint = caps[1] # mount point
|
||||
@fstype = caps[2] # fs type
|
||||
@options = caps[3] # mount options (comma separated)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
37
misc/ec2-ami-tools/files/netbsd/pipeline.rb
Normal file
37
misc/ec2-ami-tools/files/netbsd/pipeline.rb
Normal file
|
@ -0,0 +1,37 @@
|
|||
# $NetBSD: pipeline.rb,v 1.1.1.1 2011/01/31 20:56:14 jym Exp $
|
||||
#
|
||||
# Copyright (c) 2011 Jean-Yves Migeon <jym@NetBSD.org>
|
||||
# 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/linux/pipeline'
|
||||
|
||||
module EC2
|
||||
module Platform
|
||||
module NetBSD
|
||||
class Pipeline < EC2::Platform::Linux::Pipeline; end
|
||||
end
|
||||
end
|
||||
end
|
37
misc/ec2-ami-tools/files/netbsd/rsync.rb
Normal file
37
misc/ec2-ami-tools/files/netbsd/rsync.rb
Normal file
|
@ -0,0 +1,37 @@
|
|||
# $NetBSD: rsync.rb,v 1.1.1.1 2011/01/31 20:56:14 jym Exp $
|
||||
#
|
||||
# Copyright (c) 2011 Jean-Yves Migeon <jym@NetBSD.org>
|
||||
# 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/linux/rsync'
|
||||
|
||||
module EC2
|
||||
module Platform
|
||||
module NetBSD
|
||||
class Rsync < EC2::Platform::Linux::Rsync; end
|
||||
end
|
||||
end
|
||||
end
|
56
misc/ec2-ami-tools/files/netbsd/tar.rb
Normal file
56
misc/ec2-ami-tools/files/netbsd/tar.rb
Normal file
|
@ -0,0 +1,56 @@
|
|||
# $NetBSD: tar.rb,v 1.1.1.1 2011/01/31 20:56:14 jym Exp $
|
||||
#
|
||||
# Copyright (c) 2011 Jean-Yves Migeon <jym@NetBSD.org>
|
||||
# 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/linux/tar'
|
||||
|
||||
module EC2
|
||||
module Platform
|
||||
module NetBSD
|
||||
class Tar < EC2::Platform::Linux::Tar
|
||||
|
||||
class Command < EC2::Platform::Linux::Tar::Command
|
||||
def initialize(e = EC2::Platform::NetBSD::Constants::Utility::TAR)
|
||||
super e
|
||||
end
|
||||
end
|
||||
|
||||
class Version < EC2::Platform::Linux::Tar::Version
|
||||
def self.current
|
||||
Version.new
|
||||
end
|
||||
def default
|
||||
s = `#{Command.new.version.expand}`.strip
|
||||
return ($? == 0) ? s : nil
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
44
misc/ec2-ami-tools/files/netbsd/uname.rb
Normal file
44
misc/ec2-ami-tools/files/netbsd/uname.rb
Normal file
|
@ -0,0 +1,44 @@
|
|||
# $NetBSD: uname.rb,v 1.1.1.1 2011/01/31 20:56:14 jym Exp $
|
||||
#
|
||||
# Copyright (c) 2011 Jean-Yves Migeon <jym@NetBSD.org>
|
||||
# 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/linux/uname'
|
||||
|
||||
module EC2
|
||||
module Platform
|
||||
module NetBSD
|
||||
class Uname < EC2::Platform::Linux::Uname
|
||||
|
||||
# override method: platform and machine are the same for NetBSD
|
||||
def self.platform
|
||||
@@uname.platform ||= `uname -m`.strip
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
14
misc/ec2-ami-tools/patches/patch-aa
Normal file
14
misc/ec2-ami-tools/patches/patch-aa
Normal file
|
@ -0,0 +1,14 @@
|
|||
$NetBSD: patch-aa,v 1.1.1.1 2011/01/31 20:56:14 jym Exp $
|
||||
Avoid using full path for bash.
|
||||
|
||||
--- lib/ec2/platform/base/pipeline.rb.orig 2010-09-27 04:37:10.000000000 +0000
|
||||
+++ lib/ec2/platform/base/pipeline.rb
|
||||
@@ -115,7 +115,7 @@ module EC2
|
||||
@results = []
|
||||
create_tempfiles
|
||||
escaped_command = command.gsub("'","'\"'\"'")
|
||||
- invocation = "/bin/bash -c '#{escaped_command}'"
|
||||
+ invocation = "bash -c '#{escaped_command}'"
|
||||
|
||||
# Execute the pipeline invocation
|
||||
STDERR.puts("Pipeline.execute: command = [#{invocation}]") if verbose
|
Loading…
Reference in a new issue