mirror of
https://github.com/flatcar/scripts.git
synced 2025-08-16 01:16:59 +02:00
add(coreos-base/oem-gce): Add support for ssh keys on GCE
This commit is contained in:
parent
640c2e354e
commit
4032ba5ede
1
sdk_container/src/third_party/coreos-overlay/coreos-base/oem-gce/files/oem-release
vendored
Normal file
1
sdk_container/src/third_party/coreos-overlay/coreos-base/oem-gce/files/oem-release
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
gce
|
23
sdk_container/src/third_party/coreos-overlay/coreos-base/oem-gce/files/run
vendored
Executable file
23
sdk_container/src/third_party/coreos-overlay/coreos-base/oem-gce/files/run
vendored
Executable file
@ -0,0 +1,23 @@
|
|||||||
|
#!/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
|
||||||
|
echo "$keys"
|
||||||
|
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
|
24
sdk_container/src/third_party/coreos-overlay/coreos-base/oem-gce/oem-gce-0.0.1.ebuild
vendored
Normal file
24
sdk_container/src/third_party/coreos-overlay/coreos-base/oem-gce/oem-gce-0.0.1.ebuild
vendored
Normal 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
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user