Merge pull request #269 from marineam/gce

add(coreos-base/oem-gce): Add support for ssh keys on GCE
This commit is contained in:
Michael Marineau 2013-12-02 22:14:37 -08:00
commit 48310fc354
3 changed files with 47 additions and 0 deletions

View File

@ -0,0 +1,22 @@
#!/bin/bash
set -e
URL_PREFIX="http://metadata/computeMetadata/v1beta1/"
update_keys() {
local id="$1"
local url="${URL_PREFIX}${id}/attributes/sshKeys"
# The key may have a username: prerix which must be stripped
local keys=$(curl --fail -s "$url" | sed -re 's/^\w*://')
if [[ -n "$keys" ]]; then
update-ssh-keys -a "gce-$id" <<<"$keys"
fi
}
block-until-url "$URL_PREFIX"
# Generally sshKeys is only defined per-project
# but might as well support per-instance too.
update_keys project
update_keys instance

View File

@ -0,0 +1,24 @@
# Copyright (c) 2013 CoreOS, Inc.. All rights reserved.
# Distributed under the terms of the GNU General Public License v2
EAPI=5
DESCRIPTION="OEM suite for Google Compute Engine images"
HOMEPAGE=""
SRC_URI=""
LICENSE="Apache-2.0"
SLOT="0"
KEYWORDS="amd64"
IUSE=""
# no source directory
S="${WORKDIR}"
src_install() {
exeinto "/"
doexe ${FILESDIR}/run
insinto "/"
doins ${FILESDIR}/oem-release
}