From 522da8f2e7f74fee3f11fe66c3d757129da47476 Mon Sep 17 00:00:00 2001 From: yetone Date: Thu, 8 Oct 2026 09:01:23 +0800 Subject: [PATCH] provider: Grok and Devin install in the Docker image again: a vendor's shell one-liner needs curl, which the image (bash and busybox wget since 7bfe3137) doesn't have, so the native installer runs there MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ghcr.io/yetone/magpie:latest has /bin/bash and /bin/wget but no curl, so shellInstallerRuns said yes and `curl … | bash` failed. TestShellInstallerNeedsCurl fails on the old check. --- internal/provider/install.go | 19 +++++++++---------- internal/provider/install_test.go | 20 ++++++++++++++++++++ 2 files changed, 29 insertions(+), 10 deletions(-) diff --git a/internal/provider/install.go b/internal/provider/install.go index f622217e9..0bdfad9cb 100644 --- a/internal/provider/install.go +++ b/internal/provider/install.go @@ -145,19 +145,18 @@ func runUntilInstalled(ctx context.Context, cmd *exec.Cmd, c agentCLI) ([]byte, } // shellInstallerRuns is whether a vendor's `curl … | bash` can run here: -// bash, and curl or wget for it to download with. magpie's Docker image -// (distroless) has none of them, and the install failed there with "exec: -// bash: not found". A var so tests can say there is none. +// bash, and curl, which every one-liner (and the scripts behind them) +// downloads with. magpie's Docker image had none of them, and the install +// failed there with "exec: bash: not found". Since 7bfe3137 it has bash and +// busybox's wget but still no curl, and the one-liner failed there too. A +// var so tests can say there is none. var shellInstallerRuns = func() bool { - if _, err := exec.LookPath("bash"); err != nil { - return false - } - for _, d := range []string{"curl", "wget"} { - if _, err := exec.LookPath(d); err == nil { - return true + for _, p := range []string{"bash", "curl"} { + if _, err := exec.LookPath(p); err != nil { + return false } } - return false + return true } // installCLI installs c with its vendor's installer and makes sure magpie diff --git a/internal/provider/install_test.go b/internal/provider/install_test.go index d6e9c99e8..4330c7796 100644 --- a/internal/provider/install_test.go +++ b/internal/provider/install_test.go @@ -186,3 +186,23 @@ func waitPast(t *testing.T, id, state string) SignInState { t.Fatalf("still %s", state) return SignInState{} } + +// magpie's Docker image has bash and busybox's wget but no curl, which every +// vendor's one-liner downloads with: there the native installer is used +func TestShellInstallerNeedsCurl(t *testing.T) { + if runtime.GOOS == "windows" { + t.Skip("the shell installer is for macOS and Linux") + } + bin := t.TempDir() + for _, p := range []string{"bash", "wget"} { + testenv.Program(t, filepath.Join(bin, p), "#!/bin/sh\n") + } + t.Setenv("PATH", bin) + if shellInstallerRuns() { + t.Fatal("the shell installer runs with bash and wget, without curl") + } + testenv.Program(t, filepath.Join(bin, "curl"), "#!/bin/sh\n") + if !shellInstallerRuns() { + t.Fatal("the shell installer doesn't run with bash and curl") + } +}