diff --git a/scripts/create-proxmox-resource.sh b/scripts/create-proxmox-resource.sh index d992cb5..6d303df 100755 --- a/scripts/create-proxmox-resource.sh +++ b/scripts/create-proxmox-resource.sh @@ -544,18 +544,29 @@ ensure_remote_repo() { ssh "$ssh_target" "git clone '${origin_url}' '${remote_repo_dir}'" fi - # Checked (and bootstrapped if missing) every run, not just right after a - # fresh clone -- confirmed live: a first bootstrap can clone the repo - # successfully and still leave the node without a working `nix` (e.g. the - # node had no `sudo`, which the Nix installer's root path depends on -- - # see the fix in scripts/codex-setup.sh), and a later run with the repo - # already present would otherwise never retry it. Sources - # scripts/lib/nix-bootstrap.sh's ensure_nix_profile the same way the - # build commands below do -- a single-user Nix install typically only - # gets sourced into login shells, and ssh's non-interactive command - # execution is neither, so a freshly-installed `nix` still wouldn't be on - # PATH here without it. - if ssh "$ssh_target" "cd '${remote_repo_dir}' && . scripts/lib/nix-bootstrap.sh && ensure_nix_profile && command -v nix" >/dev/null 2>&1; then + # Trivial check, run every time (not just right after a fresh clone) -- + # confirmed live: a first bootstrap can clone the repo successfully and + # still leave the node without a working `nix` (e.g. the node had no + # `sudo`, which the Nix installer's root path depends on -- see the fix + # in scripts/codex-setup.sh), and a later run with the repo already + # present would otherwise never retry it. Sources + # scripts/lib/nix-bootstrap.sh's ensure_nix_profile first -- a + # single-user Nix install typically only gets sourced into login shells, + # and ssh's non-interactive command execution is neither, so a + # freshly-installed `nix` still wouldn't be on PATH here without it. + # + # Just `nix` today -- the only thing the remote build commands below + # actually invoke -- but a list (not a single hardcoded check) so a + # future remote step needing another tool can add itself here instead of + # growing a parallel check. + local remote_required_cmds=(nix) + local tooling_check_cmd="cd '${remote_repo_dir}' && . scripts/lib/nix-bootstrap.sh && ensure_nix_profile" + local cmd + for cmd in "${remote_required_cmds[@]}"; do + tooling_check_cmd="${tooling_check_cmd} && command -v ${cmd}" + done + + if ssh "$ssh_target" "$tooling_check_cmd" >/dev/null 2>&1; then echo "Build tooling already present on ${node}." else echo "==> Bootstrapping build tooling on ${node} (scripts/codex-setup.sh)..."