A bit of cleanup
diff --git a/cloudlab-init.sh b/cloudlab-init.sh
index 9e23c4f..7df5f68 100755
--- a/cloudlab-init.sh
+++ b/cloudlab-init.sh
@@ -8,21 +8,21 @@
AUTH="padmin@vicci.org:letmein"
CORD=0
IMAGE="xos"
+KEYFILE="~/.ssh/id_rsa"
# Create public key if none present
-cat /dev/zero | ssh-keygen -q -N ""
-PUBKEY=$( cat ~/.ssh/id_rsa.pub )
+[ -e $KEYFILE ] || cat /dev/zero | ssh-keygen -q -N ""
# Install Docker
-wget -qO- https://get.docker.com/ | sh
+which docker > /dev/null || wget -qO- https://get.docker.com/ | sh
sudo usermod -aG docker $(whoami)
sudo apt-get install httpie
if [ "$CORD" -ne 0 ]
then
- cp ~/.ssh/id_rsa.pub xos/observers/vcpe/vcpe_public_key
- cp ~/.ssh/id_rsa xos/observers/vcpe/vcpe_private_key
+ cp $KEYFILE.pub xos/observers/vcpe/vcpe_public_key
+ cp $KEYFILE xos/observers/vcpe/vcpe_private_key
fi
sudo docker build -t xos .
@@ -45,6 +45,7 @@
# Copy public key
# BUG: Shouldn't have to set the 'enacted' field...
+PUBKEY=$( cat $KEYFILE.pub )
http --auth $AUTH PATCH $XOS/xos/users/1/ public_key="$PUBKEY" enacted=$( date "+%Y-%m-%dT%T")
# Set up controller