@@ -58,14 +58,14 @@ hasCurl=
58
58
hasSetsid=
59
59
hasNixOSFacter=
60
60
61
- sshKeyDir =$( mktemp -d)
62
- trap ' rm -rf "$sshKeyDir "' EXIT
63
- mkdir -p " $sshKeyDir "
61
+ tempDir =$( mktemp -d)
62
+ trap ' rm -rf "$tempDir "' EXIT
63
+ mkdir -p " $tempDir "
64
64
65
65
declare -A diskEncryptionKeys=()
66
66
declare -A extraFilesOwnership=()
67
67
declare -a nixCopyOptions=()
68
- declare -a sshArgs=(" -o" " IdentitiesOnly=yes" " -i" " $sshKeyDir /nixos-anywhere" " -o" " UserKnownHostsFile=/dev/null" " -o" " StrictHostKeyChecking=no" )
68
+ declare -a sshArgs=(" -o" " IdentitiesOnly=yes" " -i" " $tempDir /nixos-anywhere" " -o" " UserKnownHostsFile=/dev/null" " -o" " StrictHostKeyChecking=no" )
69
69
70
70
showUsage () {
71
71
cat << USAGE
@@ -467,18 +467,18 @@ uploadSshKey() {
467
467
# ssh-copy-id requires this directory
468
468
local sshCopyHome=" $HOME "
469
469
if ! mkdir -p " $HOME /.ssh/" 2> /dev/null; then
470
- # Fallback: create a temporary home directory for ssh-copy-id in sshKeyDir
471
- sshCopyHome=" $sshKeyDir /ssh-home"
470
+ # Fallback: create a temporary home directory for ssh-copy-id in tempDir
471
+ sshCopyHome=" $tempDir /ssh-home"
472
472
mkdir -p " $sshCopyHome /.ssh"
473
473
echo " Warning: Could not create $HOME /.ssh, using temporary directory: $sshCopyHome "
474
474
fi
475
-
475
+
476
476
if [[ -n ${sshPrivateKeyFile} ]]; then
477
- cp " $sshPrivateKeyFile " " $sshKeyDir /nixos-anywhere"
478
- ssh-keygen -y -f " $sshKeyDir /nixos-anywhere" > " $sshKeyDir /nixos-anywhere.pub"
477
+ cp " $sshPrivateKeyFile " " $tempDir /nixos-anywhere"
478
+ ssh-keygen -y -f " $tempDir /nixos-anywhere" > " $tempDir /nixos-anywhere.pub"
479
479
else
480
480
# we generate a temporary ssh keypair that we can use during nixos-anywhere
481
- ssh-keygen -t ed25519 -f " $sshKeyDir " /nixos-anywhere -P " " -C " nixos-anywhere" > /dev/null
481
+ ssh-keygen -t ed25519 -f " $tempDir " /nixos-anywhere -P " " -C " nixos-anywhere" > /dev/null
482
482
fi
483
483
484
484
step Uploading install SSH keys
@@ -709,7 +709,7 @@ runDisko() {
709
709
# If we don't use ssh-ng here, we get `error: operation 'getFSAccessor' is not supported by store`
710
710
diskoScript=$(
711
711
nixBuild " ${flake} #${flakeAttr} .system.build.${diskoAttr} " \
712
- --eval-store auto --store " ssh-ng://$sshConnection ?ssh-key=$sshKeyDir %2Fnixos-anywhere&$sshStoreSettings "
712
+ --eval-store auto --store " ssh-ng://$sshConnection ?ssh-key=$tempDir %2Fnixos-anywhere&$sshStoreSettings "
713
713
)
714
714
fi
715
715
@@ -731,7 +731,7 @@ nixosInstall() {
731
731
# If we don't use ssh-ng here, we get `error: operation 'getFSAccessor' is not supported by store`
732
732
nixosSystem=$(
733
733
nixBuild " ${flake} #${flakeAttr} .system.build.toplevel" \
734
- --eval-store auto --store " ssh-ng://$sshConnection ?ssh-key=$sshKeyDir %2Fnixos-anywhere&remote-store=local%3Froot=%2Fmnt&$sshStoreSettings "
734
+ --eval-store auto --store " ssh-ng://$sshConnection ?ssh-key=$tempDir %2Fnixos-anywhere&remote-store=local%3Froot=%2Fmnt&$sshStoreSettings "
735
735
)
736
736
fi
737
737
@@ -830,8 +830,8 @@ main() {
830
830
fi
831
831
832
832
if [[ -n ${SSH_PRIVATE_KEY} ]] && [[ -z ${sshPrivateKeyFile} ]]; then
833
- # $sshKeyDir is getting deleted on trap EXIT
834
- sshPrivateKeyFile=" $sshKeyDir /from-env"
833
+ # $tempDir is getting deleted on trap EXIT
834
+ sshPrivateKeyFile=" $tempDir /from-env"
835
835
(
836
836
umask 077
837
837
printf ' %s\n' " $SSH_PRIVATE_KEY " > " $sshPrivateKeyFile "
0 commit comments