mirror of
https://github.com/flatcar/scripts.git
synced 2025-08-19 13:31:28 +02:00
fix(coreos-base/oem-ami): Simplify ssh key install
Use the new update-ssh-keys script to make the script a lot simpler. :)
This commit is contained in:
parent
14454b0cec
commit
42dc93dc92
@ -1,21 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
/usr/bin/block-until-url http://169.254.169.254/
|
|
||||||
|
|
||||||
USER_DIR="/home/core"
|
|
||||||
|
|
||||||
if [ ! -d ${USER_DIR}/.ssh ] ; then
|
|
||||||
mkdir -p ${USER_DIR}/.ssh
|
|
||||||
chmod 700 ${USER_DIR}/.ssh
|
|
||||||
fi
|
|
||||||
curl -s http://169.254.169.254/latest/meta-data/public-keys/0/openssh-key > /tmp/my-key
|
|
||||||
if [ $? -eq 0 ] ; then
|
|
||||||
cat /tmp/my-key >> ${USER_DIR}/.ssh/authorized_keys
|
|
||||||
chmod 700 ${USER_DIR}/.ssh/authorized_keys
|
|
||||||
rm /tmp/my-key
|
|
||||||
else
|
|
||||||
echo unable to download key
|
|
||||||
rm /tmp/my-key
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
chown -R core: $USER_DIR/.ssh
|
|
8
sdk_container/src/third_party/coreos-overlay/coreos-base/oem-ami/files/run
vendored
Executable file
8
sdk_container/src/third_party/coreos-overlay/coreos-base/oem-ami/files/run
vendored
Executable file
@ -0,0 +1,8 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
KEY_URL="http://169.254.169.254/latest/meta-data/public-keys/0/openssh-key"
|
||||||
|
|
||||||
|
block-until-url "$KEY_URL"
|
||||||
|
curl --fail -s "$KEY_URL" | update-ssh-keys -a ec2
|
@ -1,3 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
/usr/share/oem/usr/bin/install-ec2-key.sh
|
|
@ -16,10 +16,8 @@ IUSE=""
|
|||||||
S="${WORKDIR}"
|
S="${WORKDIR}"
|
||||||
|
|
||||||
src_install() {
|
src_install() {
|
||||||
dobin "${FILESDIR}"/install-ec2-key.sh
|
|
||||||
|
|
||||||
exeinto "/"
|
exeinto "/"
|
||||||
doexe ${FILESDIR}/run.sh
|
doexe ${FILESDIR}/run
|
||||||
|
|
||||||
insinto "/"
|
insinto "/"
|
||||||
doins ${FILESDIR}/oem-release
|
doins ${FILESDIR}/oem-release
|
||||||
|
Loading…
x
Reference in New Issue
Block a user