Skip to content

Commit 0a929da

Browse files
Mic92mergify[bot]
authored andcommitted
only fetch pubkey in case we want to build on remote
This is a bit faster and also helps to mitigated cases where additionally options that are not respected by ssh-keyscan (i.e. JumpHost) are used
1 parent 12d5c4d commit 0a929da

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/nixos-anywhere.sh

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -407,11 +407,13 @@ for path in "${!disk_encryption_keys[@]}"; do
407407
ssh_ "umask 077; cat > $path" <"${disk_encryption_keys[$path]}"
408408
done
409409

410-
pubkey=$(ssh-keyscan -p "$ssh_port" -t ed25519 "$ssh_host" 2>/dev/null || {
411-
echo "ERROR: failed to retrieve host public key for ${ssh_connection}" >&2
412-
exit 1
413-
})
414-
pubkey=$(echo "$pubkey" | sed -e 's/^[^ ]* //' | base64 -w0)
410+
if [[ ${build_on_remote-n} == "y" ]]; then
411+
pubkey=$(ssh-keyscan -p "$ssh_port" -t ed25519 "$ssh_host" 2>/dev/null || {
412+
echo "ERROR: failed to retrieve host public key for ${ssh_connection}" >&2
413+
exit 1
414+
})
415+
pubkey=$(echo "$pubkey" | sed -e 's/^[^ ]* //' | base64 -w0)
416+
fi
415417

416418
if [[ -z ${disko_script-} ]] && [[ ${build_on_remote-n} == "y" ]]; then
417419
step Building disko script

0 commit comments

Comments
 (0)