From 233b776127e0a50d83d2c4e62c6b160fe9fdeca4 Mon Sep 17 00:00:00 2001 From: Paul Whalen Date: Nov 30 2018 22:49:05 +0000 Subject: fix iot root ssh key copy --- diff --git a/arm-image-installer b/arm-image-installer index 45393c0..ed3a9a3 100755 --- a/arm-image-installer +++ b/arm-image-installer @@ -430,14 +430,19 @@ else fi fi +if [ "$(echo $IMAGE | grep -i iot)" != "" ]; then + IOT_IMAGE="1" + OSTREE_ROOT_HOME="/tmp/root/ostree/deploy/fedora-iot/var/roothome" + OSTREE_PREFIX="/tmp/root/ostree/deploy/fedora-iot/deploy/*/" +fi + # determine uboot and write to disk if [ "$TARGET" = "" ]; then echo "= No U-boot will be written." TARGET="Mystery Board" -elif [ "$(echo $IMAGE | grep -i iot)" != "" ]; then - PREFIX=/tmp/root/ostree/deploy/fedora-iot/deploy/*/ +elif [ "$IOT_IMAGE" = "1" ]; then # dd doesnt support wildcards, echo to expand - PREFIX=$(echo $PREFIX) + PREFIX=$(echo $OSTREE_PREFIX) . "${BOARDDIR}/${TARGET}" else PREFIX=/tmp/root @@ -464,11 +469,16 @@ fi # Add ssh key to the image if [ "$SSH_KEY" != "" ]; then if [ -f $SSH_KEY ]; then - # /ostree/deploy/fedora-iot/var/roothome echo "= Adding SSH key to authorized keys." - mkdir /tmp/root/root/.ssh/ &> /dev/null - cat $SSH_KEY >> /tmp/root/root/.ssh/authorized_keys - chmod -R u=rwX,o=,g= /tmp/root/root/.ssh/ + if [ $IOT_IMAGE = 1 ]; then + mkdir $OSTREE_ROOT_HOME/.ssh/ &> /dev/null + cat $SSH_KEY >> $OSTREE_ROOT_HOME/.ssh/authorized_keys + chmod -R u=rwX,o=,g= $OSTREE_ROOT_HOME/.ssh/ + else + mkdir /tmp/root/root/.ssh/ &> /dev/null + cat $SSH_KEY >> /tmp/root/root/.ssh/authorized_keys + chmod -R u=rwX,o=,g= /tmp/root/root/.ssh/ + fi else echo "= SSH key $SSH_KEY : Not Found!" echo "= WARNING: No SSH Key Added."