Skip the key step when SSH already works, and read the install path live on both sides

This commit is contained in:
Gmer4Lfe
2026-08-17 07:04:46 -04:00
parent 7e7d845f61
commit d8e3c09b57
4 changed files with 60 additions and 33 deletions
+19
View File
@@ -315,14 +315,33 @@ if [[ "$AM_MIRROR" == true ]]; then
echo " Mirror sets up SSH keys, then notifies Owner to run Phase 2."
echo ""
# Tested before attempted, the same guard the owner's phase 1 has had all along.
#
# The key step is a TERMINAL step by design — ssh_setup.sh runs ssh-copy-id, which prompts for
# the owner's root password on a first install. Once the operator has done that in a terminal,
# pressing ▶ Onboard ran the whole thing again: another ssh-copy-id, this time from the WebGUI
# with no TTY to answer the prompt, which fails and aborts the run at Step 1 — so the button
# whose entire job is Step 2 could never reach it.
#
# Working SSH is the actual precondition, not "have we run the setup script". If it already
# works there is nothing to install, whichever route installed it.
OWNER_IP_PRE=$(resolve_tailscale_ip "$OWNER" 2>/dev/null || true)
if [[ "$SKIP_SSH" == true ]]; then
warn "Skipping SSH setup (--skip-ssh)"
elif [[ -n "$OWNER_IP_PRE" ]] && timeout "$SSH_TIMEOUT" ssh -i "$SSH_KEY" \
-o ConnectTimeout="$SSH_TIMEOUT" -o BatchMode=yes -o StrictHostKeyChecking=no \
root@"$OWNER_IP_PRE" exit 0 2>/dev/null; then
echo "SSH to $OWNER already works ✅ — key already installed, skipping setup"
elif bash "$SCRIPT_DIR/ssh_setup.sh" "${EXTRA_FLAGS[@]}"; then
echo "SSH key ready ✅"
else
error "SSH key setup failed"
error "Install the key from a terminal on this host — ssh-copy-id needs $OWNER's password,"
error "and a WebGUI button has no way to answer that prompt:"
error " bash $SCRIPTS_ROOT/Partnership/partnership_onboard.sh --phase1-only"
exit 1
fi
unset OWNER_IP_PRE
# Stop after the key when asked. ssh_setup.sh runs ssh-copy-id, which prompts for the
# owner's root password on a first install — answerable in a terminal, never from the