Skip to content

Commit f19bc79

Browse files
committed
vm: remove obsolete binfmt downloader
Signed-off-by: Abiola Ibrahim <[email protected]>
1 parent e3f0b39 commit f19bc79

File tree

1 file changed

+4
-36
lines changed

1 file changed

+4
-36
lines changed

core/core.go

+4-36
Original file line numberDiff line numberDiff line change
@@ -10,28 +10,16 @@ import (
1010

1111
"github.com/abiosoft/colima/cli"
1212
"github.com/abiosoft/colima/environment"
13-
"github.com/abiosoft/colima/util/downloader"
1413
"github.com/coreos/go-semver/semver"
1514
)
1615

17-
const (
18-
version = "v0.7.6" // version of colima-core to use.
19-
limaVersion = "v0.18.0" // minimum Lima version supported
20-
baseURL = "https://github.com/abiosoft/colima-core/releases/download/" + version + "/"
21-
)
16+
const limaVersion = "v0.18.0" // minimum Lima version supported
2217

2318
type (
2419
hostActions = environment.HostActions
2520
guestActions = environment.GuestActions
2621
)
2722

28-
func downloadSha(url string) *downloader.SHA {
29-
return &downloader.SHA{
30-
Size: 512,
31-
URL: url + ".sha512sum",
32-
}
33-
}
34-
3523
// SetupBinfmt downloads and install binfmt
3624
func SetupBinfmt(host hostActions, guest guestActions, arch environment.Arch) error {
3725
qemuArch := environment.AARCH64
@@ -46,29 +34,9 @@ func SetupBinfmt(host hostActions, guest guestActions, arch environment.Arch) er
4634
return nil
4735
}
4836

49-
// ignore download and extract if previously installed
50-
if err := guest.RunQuiet("command", "-v", "binfmt"); err == nil {
51-
return install()
52-
}
53-
54-
// download
55-
url := baseURL + "binfmt-" + arch.Value().GoArch() + ".tar.gz"
56-
dest := "/tmp/binfmt.tar.gz"
57-
if err := downloader.DownloadToGuest(host, guest, downloader.Request{
58-
URL: url,
59-
SHA: downloadSha(url),
60-
}, dest); err != nil {
61-
return fmt.Errorf("error downloading binfmt: %w", err)
62-
}
63-
64-
// extract
65-
if err := guest.Run("sh", "-c",
66-
strings.NewReplacer(
67-
"{file}", dest,
68-
"{qemu_arch}", string(qemuArch),
69-
).Replace(`cd /tmp && tar xfz {file} && sudo chown root:root binfmt qemu-{qemu_arch} && sudo mv binfmt qemu-{qemu_arch} /usr/bin`),
70-
); err != nil {
71-
return fmt.Errorf("error extracting binfmt: %w", err)
37+
// validate binfmt
38+
if err := guest.RunQuiet("command", "-v", "binfmt"); err != nil {
39+
return fmt.Errorf("binfmt not found: %w", err)
7240
}
7341

7442
return install()

0 commit comments

Comments
 (0)