Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions public_key/run.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,13 @@ function do_install {
set -e
cachengo-cli updateInstallStatus $APPID "Installing"
# Remove user@host to add our own identifier
key="$( cut -d ' ' -f 2 <<< "$PUBLIC_KEY" )"
key="$( cut -d ' ' -f 1,2 <<< "$PUBLIC_KEY" )"
if [ $(wc -w <<< "$key") -lt 2 ]; then
echo "Missing SSH Key Type"
exit 1
fi
sed -i -e '$a\' /home/$TARGET_USER/.ssh/authorized_keys
echo "ssh-rsa $key $APPID" >> /home/$TARGET_USER/.ssh/authorized_keys
echo "$key $APPID" >> /home/$TARGET_USER/.ssh/authorized_keys
cachengo-cli updateInstallStatus $APPID "Installed"
}

Expand Down