recipes-images: add fragement to install sshkeys

Fixes: partly SYS#518
This commit is contained in:
Henning Heinold 2014-09-19 17:27:44 +02:00 committed by Henning
parent 7aba3280c5
commit d6aabdf6b9
1 changed files with 18 additions and 0 deletions

View File

@ -0,0 +1,18 @@
hostsshkeysfile = "${@d.getVar('SSH_KEYS_FILE', True) or ''}"
ROOTFS_POSTPROCESS_COMMAND += "copy_ssh_keys;"
copy_ssh_keys() {
if [ -n "${hostsshkeysfile}" ]; then
if [ -r "${hostsshkeysfile}" ]; then
echo "Installing sshkeys from ${hostsshkeysfile}"
mkdir -p ${IMAGE_ROOTFS}/home/root/.ssh/
cat ${hostsshkeysfile} >> ${IMAGE_ROOTFS}/home/root/.ssh/authorized_keys
chown root:root ${IMAGE_ROOTFS}/home/root/.ssh/authorized_keys
chmod 0600 ${IMAGE_ROOTFS}/home/root/.ssh/authorized_keys
else
echo "Could not install sshkeys from ${hostsshkeysfile}"
fi
fi
}