26 lines
580 B
Bash
26 lines
580 B
Bash
|
#!/bin/sh
|
||
|
|
||
|
set -e
|
||
|
|
||
|
if [ ! -d ~/.ssh ]; then
|
||
|
mkdir -p ~/.ssh
|
||
|
chmod 700 ~/.ssh
|
||
|
fi
|
||
|
|
||
|
if [ -n "$SSH_KEY" ]; then
|
||
|
SSH_KEY_ID="$HOME/.ssh/id_ed25519"
|
||
|
echo $SSH_KEY > $SSH_KEY_ID
|
||
|
|
||
|
chmod 600 $SSH_KEY_ID
|
||
|
|
||
|
# Append the required to the ssh config file.
|
||
|
# Switch out the hostname for different hosts.
|
||
|
# The line count is 5
|
||
|
echo "\nHost ci.i.kjuulh.io\n"\
|
||
|
" IdentityFile ${SSH_KEY_ID}\n"\
|
||
|
" IdentitiesOnly yes\n"\
|
||
|
" UserKnownHostsFile=/dev/null\n"\
|
||
|
" StrictHostKeyChecking no"\
|
||
|
>> $HOME/.ssh/config
|
||
|
fi
|