deploy-docs: improve tempdir handling for ssh key

This commit is contained in:
Jörg Thalheim
2024-10-22 17:33:04 +02:00
committed by Mic92
parent ff7a19a890
commit 76cdd4cc93

View File

@@ -22,11 +22,13 @@ writeShellScriptBin "deploy-docs" ''
# DO NOT PRINT THE SSH KEY TO THE LOGS #
# #
#########################################
set +x
if [ -n "''${SSH_HOMEPAGE_KEY:-}" ]; then
echo "$SSH_HOMEPAGE_KEY" > ./ssh_key
chmod 600 ./ssh_key
sshExtraArgs="-i ./ssh_key"
tmpdir=$(mktemp -d)
trap "rm -rf $tmpdir" EXIT
if [ -n "$SSH_HOMEPAGE_KEY" ]; then
echo "$SSH_HOMEPAGE_KEY" > "$tmpdir/ssh_key"
chmod 600 "$tmpdir/ssh_key"
sshExtraArgs="-i $tmpdir/ssh_key"
else
sshExtraArgs=
fi
@@ -37,7 +39,6 @@ writeShellScriptBin "deploy-docs" ''
# #
###########################
rsync \
-e "ssh -o StrictHostKeyChecking=no $sshExtraArgs" \
-a ${docs}/ \