#!/usr/bin/env bash # verify-remote-ssh.sh — wrapper that scp's lib.sh + verify-remote.sh # to the R720 then runs verify-remote.sh there. Saves the operator # from having to clone the repo on the R720. # # Reads R720_HOST + R720_USER from .env or environment. set -Eeuo pipefail SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" . "$SCRIPT_DIR/lib.sh" trap_errors [[ -f "$SCRIPT_DIR/.env" ]] && . "$SCRIPT_DIR/.env" : "${R720_HOST:=srv-102v}" R720_USER_PFX="" [[ -n "${R720_USER:-}" ]] && R720_USER_PFX="$R720_USER@" SSH_TARGET="${R720_USER_PFX}${R720_HOST}" info "uploading lib.sh + verify-remote.sh to $SSH_TARGET:/tmp/" scp -q "$SCRIPT_DIR/lib.sh" "$SCRIPT_DIR/verify-remote.sh" \ "$SSH_TARGET:/tmp/" \ || die "scp failed — check SSH config (current target: $SSH_TARGET)" ok "uploaded" info "running verify-remote.sh as root" # `sudo bash` so the state file at /var/lib/talas/bootstrap.state is # accessible. If your account has incus group access without sudo, # drop the `sudo`. ssh -t "$SSH_TARGET" "sudo bash /tmp/verify-remote.sh" \ || warn "verify-remote.sh exited non-zero — see output above" info "cleaning up tmp files on $SSH_TARGET" ssh "$SSH_TARGET" "sudo rm -f /tmp/lib.sh /tmp/verify-remote.sh" || true ok "done"