From 31cbb56629454ce5474b4de6853f4566cd61e965 Mon Sep 17 00:00:00 2001 From: admin Date: Mon, 3 Aug 2026 10:40:14 +0000 Subject: [PATCH] fix: curl or wget fallback for AIO download, preflight tweak --- internal/native/native.go | 8 +++++++- internal/preflight/preflight.go | 7 +++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/internal/native/native.go b/internal/native/native.go index 20dc6b2..d3473cf 100644 --- a/internal/native/native.go +++ b/internal/native/native.go @@ -47,7 +47,13 @@ func InstallNode(node state.Node, apiToken, apiHost, labels, mode string) error // 3. Download AIO once if _, err := os.Stat(installerPath); os.IsNotExist(err) { fmt.Printf("[%s] Downloading installer...\n", node.Name) - cmd := exec.Command("curl", "-fsSL", "-o", installerPath, installerURL()) + url := installerURL() + var cmd *exec.Cmd + if _, err := exec.LookPath("curl"); err == nil { + cmd = exec.Command("curl", "-fsSL", "-o", installerPath, url) + } else { + cmd = exec.Command("wget", "-q", "-O", installerPath, url) + } if out, err := cmd.CombinedOutput(); err != nil { return fmt.Errorf("download: %w\n%s", err, string(out)) } diff --git a/internal/preflight/preflight.go b/internal/preflight/preflight.go index ca63a8a..811288b 100644 --- a/internal/preflight/preflight.go +++ b/internal/preflight/preflight.go @@ -77,8 +77,11 @@ func Run() Result { id, ver := shared.OSInfo() r.Checks = append(r.Checks, Check{Name: "os", Passed: true, Detail: id + " " + ver}) - // 5. Required commands - requiredCmds := []string{"curl", "systemctl", "sed", "mkdir", "rm"} + // 5. Required commands (curl or wget) + hasDownloader := shared.CommandExists("curl") || shared.CommandExists("wget") + r.Checks = append(r.Checks, Check{Name: "downloader", Passed: hasDownloader}) + if !hasDownloader { r.Passed = false } + requiredCmds := []string{"systemctl", "sed", "mkdir", "rm"} for _, cmd := range requiredCmds { ok := shared.CommandExists(cmd) r.Checks = append(r.Checks, Check{Name: "cmd:" + cmd, Passed: ok})