Skip to content

Commit b3b6bfe

Browse files
committed
Fix sshKeyDir unbound variable
This closes #376
1 parent 55b239c commit b3b6bfe

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/nixos-anywhere.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ postKexecSshPort=22
2828
buildOnRemote=n
2929
envPassword=
3030

31+
sshKeyDir=$(mktemp -d)
32+
trap 'rm -rf "$sshKeyDir"' EXIT
33+
mkdir -p "$sshKeyDir"
34+
3135
declare -A diskEncryptionKeys
3236
declare -a nixCopyOptions
3337
declare -a sshArgs
@@ -302,9 +306,6 @@ runVmTest() {
302306

303307
uploadSshKey() {
304308
# we generate a temporary ssh keypair that we can use during nixos-anywhere
305-
sshKeyDir=$(mktemp -d)
306-
trap 'rm -rf "$sshKeyDir"' EXIT
307-
mkdir -p "$sshKeyDir"
308309
# ssh-copy-id requires this directory
309310
mkdir -p "$HOME/.ssh/"
310311
ssh-keygen -t ed25519 -f "$sshKeyDir"/nixos-anywhere -P "" -C "nixos-anywhere" >/dev/null

0 commit comments

Comments
 (0)