This commit is contained in:
2026-04-22 19:56:37 +02:00
parent e375813045
commit 8b6ff74a58

View File

@@ -46,6 +46,7 @@ wait_for_ssh_key() {
local preferred_path="$1"
local ssh_dir="$HOME_DIR/.ssh"
local detected_key=""
local reply=""
mkdir -p "$ssh_dir"
chmod 700 "$ssh_dir"
@@ -61,10 +62,12 @@ wait_for_ssh_key() {
fi
info "Waiting for an SSH key to appear in $ssh_dir"
printf 'Create the key in another terminal; this script will keep watching.\n'
printf 'Create the key in another terminal, then press Enter here to continue.\n'
printf 'Expected path: %s (with matching .pub file)\n' "$preferred_path"
while true; do
read -r -p "Press Enter once you have generated the SSH key... " reply
if [[ -f "$preferred_path" && -f "$preferred_path.pub" ]]; then
printf '%s' "$preferred_path"
return 0
@@ -75,11 +78,7 @@ wait_for_ssh_key() {
return 0
fi
if command_exists inotifywait; then
inotifywait -q -e create -e close_write -e moved_to "$ssh_dir" >/dev/null 2>&1 || sleep 2
else
sleep 2
fi
warn "No key was found. Please press Enter when you have created the key."
done
}