diff options
Diffstat (limited to 'cmd/mbf/cache.go')
| -rw-r--r-- | cmd/mbf/cache.go | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/cmd/mbf/cache.go b/cmd/mbf/cache.go index 0452a3e1..b683326f 100644 --- a/cmd/mbf/cache.go +++ b/cmd/mbf/cache.go @@ -2,6 +2,7 @@ package main import ( "context" + "net/http" "os" "path/filepath" "testing" @@ -9,6 +10,7 @@ import ( "hakurei.app/check" "hakurei.app/container" "hakurei.app/internal/pkg" + "hakurei.app/internal/rosa" "hakurei.app/message" ) @@ -30,7 +32,7 @@ type cache struct { // Loaded artifact of [rosa.QEMU]. qemu pkg.Artifact - base string + base, mirror string } // open opens the underlying [pkg.Cache]. @@ -86,6 +88,21 @@ func (cache *cache) open() (err error) { } done <- struct{}{} + if cache.mirror != "" { + var pub []byte + pub, err = os.ReadFile(base.Append("ed25519.pub").String()) + if err != nil { + cache.c.Close() + return + } + var r rosa.Remote + if r, err = rosa.NewRemote(cache.mirror, pub, http.DefaultClient); err != nil { + cache.c.Close() + return err + } + cache.c.SetExternal(r) + } + if cache.qemu != nil { var pathname *check.Absolute pathname, _, err = cache.c.Cure(cache.qemu) |
