summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDiego Elio Pettenò <flameeyes@gentoo.org>2010-11-27 00:31:57 +0000
committerDiego Elio Pettenò <flameeyes@gentoo.org>2010-11-27 00:31:57 +0000
commitc8f37a7ff249a0334a78c302e406c6e9dd44c864 (patch)
tree369af41f028fad7fc65d20f16184e7071c5e3903 /app-admin
parentAutomated update of use.local.desc (diff)
downloadhistorical-c8f37a7ff249a0334a78c302e406c6e9dd44c864.tar.gz
historical-c8f37a7ff249a0334a78c302e406c6e9dd44c864.tar.bz2
historical-c8f37a7ff249a0334a78c302e406c6e9dd44c864.zip
Initial import of the init script for Amazon EC2 metadata.
Package-Manager: portage-2.2.0_alpha5/cvs/Linux x86_64
Diffstat (limited to 'app-admin')
-rw-r--r--app-admin/amazon-ec2-init/ChangeLog10
-rw-r--r--app-admin/amazon-ec2-init/Manifest14
-rw-r--r--app-admin/amazon-ec2-init/amazon-ec2-init-20101127.ebuild30
-rw-r--r--app-admin/amazon-ec2-init/files/amazon-ec2.init35
-rw-r--r--app-admin/amazon-ec2-init/metadata.xml8
5 files changed, 97 insertions, 0 deletions
diff --git a/app-admin/amazon-ec2-init/ChangeLog b/app-admin/amazon-ec2-init/ChangeLog
new file mode 100644
index 000000000000..79eda7458fef
--- /dev/null
+++ b/app-admin/amazon-ec2-init/ChangeLog
@@ -0,0 +1,10 @@
+# ChangeLog for app-admin/amazon-ec2-init
+# Copyright 1999-2010 Gentoo Foundation; Distributed under the GPL v2
+# $Header: /var/cvsroot/gentoo-x86/app-admin/amazon-ec2-init/ChangeLog,v 1.1 2010/11/27 00:31:57 flameeyes Exp $
+
+*amazon-ec2-init-20101127 (27 Nov 2010)
+
+ 27 Nov 2010; Diego E. Pettenò <flameeyes@gentoo.org> +files/amazon-ec2.init,
+ +amazon-ec2-init-20101127.ebuild, +metadata.xml:
+ Initial import of the init script for Amazon EC2 metadata.
+
diff --git a/app-admin/amazon-ec2-init/Manifest b/app-admin/amazon-ec2-init/Manifest
new file mode 100644
index 000000000000..38bb0dda6149
--- /dev/null
+++ b/app-admin/amazon-ec2-init/Manifest
@@ -0,0 +1,14 @@
+-----BEGIN PGP SIGNED MESSAGE-----
+Hash: SHA1
+
+AUX amazon-ec2.init 1197 RMD160 164d260566bd0fa2caea3b87bcd7744c8efa772d SHA1 e99174f0c24a3e165297dcb046f27cb8646f7a22 SHA256 cb7782c97407cb51254140f9612ba3a999095a22a70a9a601d37fbf17d035849
+EBUILD amazon-ec2-init-20101127.ebuild 851 RMD160 e8885ee4b0e012abb151fa0014d79a4f2bcf1d0e SHA1 2ef74cfd78492436cbafc885438908660ecb3140 SHA256 ac5aeaa5177adbd52c95f46101f06131fc91775f33e5183311d12c7d94d96fd7
+MISC ChangeLog 460 RMD160 8b702798f2e90537c3645fd340b69eb5a706fab7 SHA1 d8cd38c37b9bb3d3c40e903aeef03876bcddc2f7 SHA256 83a5ca21ad04f702e54a35a193b073b555933230ac7e4b5c176a86b870ae4942
+MISC metadata.xml 233 RMD160 da5a1d3b7836dcebb5fec29696b5bfb583fe346c SHA1 1c7142c677598358888a6cfc6f6f65df2e8b6901 SHA256 4d1294dc1b2a6f96aa637a0b8d340bc67191103af0f15197d07fc62446b4a709
+-----BEGIN PGP SIGNATURE-----
+Version: GnuPG v2.0.16 (GNU/Linux)
+
+iEYEARECAAYFAkzwUVcACgkQAiZjviIA2Xhg5ACg5arjzfk38uLH9oqQbXxDT6GV
+/b4AoJ62AXAoZ3H/SWj1pEpfqqb/0KJK
+=bWuF
+-----END PGP SIGNATURE-----
diff --git a/app-admin/amazon-ec2-init/amazon-ec2-init-20101127.ebuild b/app-admin/amazon-ec2-init/amazon-ec2-init-20101127.ebuild
new file mode 100644
index 000000000000..9246c92e72e9
--- /dev/null
+++ b/app-admin/amazon-ec2-init/amazon-ec2-init-20101127.ebuild
@@ -0,0 +1,30 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/app-admin/amazon-ec2-init/amazon-ec2-init-20101127.ebuild,v 1.1 2010/11/27 00:31:57 flameeyes Exp $
+
+EAPI="2"
+
+DESCRIPTION="Init script to setup Amazon EC2 instance parameters."
+HOMEPAGE="http://www.gentoo.org/"
+SRC_URI=""
+
+# Amazon only provides x86 and amd64 Linux Xen guests, possibly FreeBSD,
+# so just don't go adding further keywords.
+KEYWORDS="-* ~amd64 ~x86"
+
+LICENSE="GPL-2"
+SLOT="0"
+IUSE=""
+
+RDEPEND="net-misc/wget"
+DEPEND=""
+
+src_install() {
+ newinitd "${FILESDIR}/amazon-ec2.init" || die
+}
+
+pkg_postinst() {
+ elog "Remember to add amazon-ec2 init script to your boot runlevel"
+ elog "otherwise it won't bring up the correct interfaces and won't."
+ elog "start before the hostname has been set."
+}
diff --git a/app-admin/amazon-ec2-init/files/amazon-ec2.init b/app-admin/amazon-ec2-init/files/amazon-ec2.init
new file mode 100644
index 000000000000..7aa512a30821
--- /dev/null
+++ b/app-admin/amazon-ec2-init/files/amazon-ec2.init
@@ -0,0 +1,35 @@
+#!/sbin/runscript
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/app-admin/amazon-ec2-init/files/amazon-ec2.init,v 1.1 2010/11/27 00:31:57 flameeyes Exp $
+
+depend() {
+ before hostname
+ need net.eth0
+}
+
+start() {
+ einfo "Fetching metadata from EC2 servers"
+
+ ebegin " hostname"
+ local hostname=$(wget -t 2 -T 5 -q -O - http://169.254.169.254/latest/meta-data/local-hostname)
+ echo "hostname=${hostname}" >> /etc/conf.d/hostname
+ eend $?
+
+ ebegin " SSH keys"
+
+ mkdir -p /root/.ssh
+
+ local keys=$(wget -t 2 -T 5 -q -O - http://169.254.169.254/latest/meta-data/public-keys/ | cut -d = -f 1 | xargs echo)
+ [ -n "${keys}" ] && \
+ wget -t 2 -T 5 -q -O - $(for key in $keys; do echo "http://169.254.169.254/latest/meta-data/public-keys/$key/openssh-key"; done) \
+ >> /root/.ssh/authorized_keys \
+ 2>/dev/null
+
+ if [ -f /root/.ssh/authorized_keys ]; then
+ chown root:root /root/.ssh/authorized_keys
+ chmod 0600 /root/.ssh/authorized_keys
+ fi
+
+ eend $?
+}
diff --git a/app-admin/amazon-ec2-init/metadata.xml b/app-admin/amazon-ec2-init/metadata.xml
new file mode 100644
index 000000000000..2d083ce3bc66
--- /dev/null
+++ b/app-admin/amazon-ec2-init/metadata.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>no-herd</herd>
+ <maintainer>
+ <email>flameeyes@gentoo.org</email>
+ </maintainer>
+</pkgmetadata>