V0.1.5
This commit is contained in:
11
part1.sh
11
part1.sh
@@ -46,6 +46,7 @@ wait_for_ssh_key() {
|
|||||||
local preferred_path="$1"
|
local preferred_path="$1"
|
||||||
local ssh_dir="$HOME_DIR/.ssh"
|
local ssh_dir="$HOME_DIR/.ssh"
|
||||||
local detected_key=""
|
local detected_key=""
|
||||||
|
local reply=""
|
||||||
|
|
||||||
mkdir -p "$ssh_dir"
|
mkdir -p "$ssh_dir"
|
||||||
chmod 700 "$ssh_dir"
|
chmod 700 "$ssh_dir"
|
||||||
@@ -61,10 +62,12 @@ wait_for_ssh_key() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
info "Waiting for an SSH key to appear in $ssh_dir"
|
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"
|
printf 'Expected path: %s (with matching .pub file)\n' "$preferred_path"
|
||||||
|
|
||||||
while true; do
|
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
|
if [[ -f "$preferred_path" && -f "$preferred_path.pub" ]]; then
|
||||||
printf '%s' "$preferred_path"
|
printf '%s' "$preferred_path"
|
||||||
return 0
|
return 0
|
||||||
@@ -75,11 +78,7 @@ wait_for_ssh_key() {
|
|||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if command_exists inotifywait; then
|
warn "No key was found. Please press Enter when you have created the key."
|
||||||
inotifywait -q -e create -e close_write -e moved_to "$ssh_dir" >/dev/null 2>&1 || sleep 2
|
|
||||||
else
|
|
||||||
sleep 2
|
|
||||||
fi
|
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user