backup-utils/test/bin/ghe-export-ssh-host-keys

19 строки
1.2 KiB
Bash
Executable File

#!/usr/bin/env bash
if [ "$GHE_GEN_FAKE_SSH_TAR" = "yes" ]; then
set -x
# Add a custom ssh key that will be used as part of the backup and fingerprint injection for the tests
cat <<EOF > "$GHE_REMOTE_DATA_USER_DIR/common/ssh_host_dsa_key.pub"
ssh-dss AAAAB3NzaC1kc3MAAACBAMv7O3YNWyAOj6Oa6QhG2qL67FSDoR96cYILilsQpn1j+f21uXOYBRdqauP+8XS2sPYZy6p/T3gJhCeC6ppQWY8n8Wjs/oS8j+nl5KX7JbIqzvSIb0tAKnMI67pqCHTHWx+LGvslgRALJuGxOo7Bp551bNN02Y2gfm2TlHOv6DarAAAAFQChqAK2KkHI+WNkFj54GwGYdX+GCQAAAIEApmXYiT7OYXfmiHzhJ/jfT1ZErPAOwqLbhLTeKL34DkAH9J/DImLAC0tlSyDXjlMzwPbmECdu6LNYh4OZq7vAN/mcM2+Sue1cuJRmkt5B1NYox4fRs3o9RO+DGOcbogUUUQu7OIM/o95zF6dFEfxIWnSsmYvl+Ync4fEgN6ZLjtMAAACBAMRYjDs0g1a9rocKzUQ7fazaXnSNHxZADQW6SIodt7ic1fq4OoO0yUoBf/DSOF8MC/XTSLn33awI9SrbQ5Kk0oGxmV1waoFkqW/MDlypC8sHG0/gxzeJICkwjh/1OVwF6+e0C/6bxtUwV/I+BeMtZ6U2tKy15FKp5Mod7bLBgiee test@backup-utils
EOF
tar -cf - -C "$GHE_REMOTE_DATA_USER_DIR/common" ssh_host_dsa_key.pub
set +x
else
ssh_tempdir="$(mktemp -d -t ssh-host-keys-XXXXXX)"
echo "fake ghe-export-ssh-host-keys data" > "$ssh_tempdir/ssh-host-keys"
tar -C "$ssh_tempdir" -cf - ssh-host-keys
mv "$ssh_tempdir/ssh-host-keys.tar" "tmp/ssh-host-keys.tar"
rm -rf "$ssh_tempdir"
fi