diff options
| author | Ophestra <cat@gensokyo.uk> | 2026-01-27 20:54:11 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2026-01-27 20:54:11 +0900 |
| commit | fbe93fc7716782e42f53cd1be042cf293472039d (patch) | |
| tree | 070b1d684e7ccf321faa6c70e31cdad16da42a9e | |
| parent | 968d8dbaf14fa0e7965a8a525d74a2d8d6a20c50 (diff) | |
internal/rosa/busybox: cross-platform binary
The initial binary seed is arch-specific.
Signed-off-by: Ophestra <cat@gensokyo.uk>
| -rw-r--r-- | internal/rosa/busybox.go | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/internal/rosa/busybox.go b/internal/rosa/busybox.go index df4bfd4f..7e87a122 100644 --- a/internal/rosa/busybox.go +++ b/internal/rosa/busybox.go @@ -5,6 +5,7 @@ import ( "io" "net/http" "os" + "runtime" "slices" "strings" "time" @@ -78,10 +79,23 @@ func (a busyboxBin) Cure(t *pkg.TContext) (err error) { // newBusyboxBin returns a [pkg.Artifact] containing a busybox installation from // the https://busybox.net/downloads/binaries/ binary release. func newBusyboxBin() pkg.Artifact { - const ( - version = "1.35.0" + var version, url, checksum string + switch runtime.GOARCH { + case "amd64": + version = "1.35.0" + url = "https://busybox.net/downloads/binaries/" + + version + "-" + linuxArch() + "-linux-musl/busybox" checksum = "L7OBIsPu9enNHn7FqpBT1kOg_mCLNmetSeNMA3i4Y60Z5jTgnlX3qX3zcQtLx5AB" - ) + case "arm64": + version = "1.31.0" + url = "https://busybox.net/downloads/binaries/" + + version + "-defconfig-multiarch-musl/busybox-armv8l" + checksum = "npJjBO7iwhjW6Kx2aXeSxf8kXhVgTCDChOZTTsI8ZfFfa3tbsklxRiidZQdrVERg" + + default: + panic("unsupported target " + runtime.GOARCH) + } + return pkg.NewExec( "busybox-bin-"+version, nil, pkg.ExecTimeoutMax, false, fhs.AbsRoot, []string{ @@ -96,9 +110,7 @@ func newBusyboxBin() pkg.Artifact { &http.Client{Transport: &http.Transport{ // busybox website is really slow to respond TLSHandshakeTimeout: 2 * time.Minute, - }}, - "https://busybox.net/downloads/binaries/"+ - version+"-"+linuxArch()+"-linux-musl/busybox", + }}, url, mustDecode(checksum), )}), ) |
