From 8185e5ed396d11d528004c62f587649d9c3875a1 Mon Sep 17 00:00:00 2001 From: Benedikt Ritter Date: Thu, 29 Aug 2024 15:03:17 +0200 Subject: [PATCH] scripts (setup-vm): Tweak error handling and logging --- scripts/setup-vm.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/setup-vm.sh b/scripts/setup-vm.sh index 133d8fc..7928e9f 100755 --- a/scripts/setup-vm.sh +++ b/scripts/setup-vm.sh @@ -1,7 +1,7 @@ #!/usr/bin/env nix-shell #! nix-shell -i bash --pure #! nix-shell -p nixos-anywhere -I nixos-anywhere=https://github.com/nix-community/nixos-anywhere -set -e +set -euo pipefail # Source (with modifications): https://github.com/nix-community/nixos-anywhere/blob/46dc28f4f89b747084c7dd6d273b1278142220ce/docs/howtos/secrets.md @@ -29,7 +29,9 @@ trap cleanup EXIT install -d -m755 "$temp/etc/ssh" # copy private ket to the temporary directory -cp "$HOME/.ssh/ssh_${host}_ed25519_key" "$temp/etc/ssh/ssh_host_ed25519_key" +hostKey="$HOME/.ssh/ssh_${host}_ed25519_key" +echo "Sending $hostKey to $host:/etc/ssh/ssh_host_ed25519_key" +cp "$hostKey" "$temp/etc/ssh/ssh_host_ed25519_key" # Set the correct permissions so sshd will accept the key chmod 600 "$temp/etc/ssh/ssh_host_ed25519_key"