spcd/bootstrap.sh
2024-05-30 21:31:29 +02:00

21 lines
475 B
Bash
Executable file

#! /usr/bin/env bash
KEY_ALGORITHM='ed25519'
KEY_DIRECTORY='.ssh'
KEY_PATH="${KEY_DIRECTORY}/id_${KEY_ALGORITHM}"
KEY_PUBLIC='AAAAC3NzaC1lZDI1NTE5AAAAIPHCNcgHlQoiNTXfnUZYvHz9OZwYsmBCrSSV7a7Zche5'
SERVER="$(basename ${GITHUB_SERVER_URL})"
# ssh
cd \
|| exit
mkdir "${KEY_DIRECTORY}" \
|| exit
echo "${CD}" > "${KEY_PATH}" \
|| exit
unset CD
chmod '400' "${KEY_PATH}" \
|| exit
echo "${SERVER} ssh-${KEY_ALGORITHM} ${KEY_PUBLIC}" \
> "${KEY_DIRECTORY}/known_hosts" \
|| exit