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:
Michael Marineau 2013-08-12 19:13:40 -04:00
parent 14454b0cec
commit 42dc93dc92
5 changed files with 9 additions and 27 deletions

View File

@ -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

View 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

View File

@ -1,3 +0,0 @@
#!/bin/bash
/usr/share/oem/usr/bin/install-ec2-key.sh

View File

@ -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