aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--internal/rosa/rosa.go12
-rw-r--r--internal/rosa/stage0.go20
2 files changed, 17 insertions, 15 deletions
diff --git a/internal/rosa/rosa.go b/internal/rosa/rosa.go
index 560f10d5..930a1896 100644
--- a/internal/rosa/rosa.go
+++ b/internal/rosa/rosa.go
@@ -69,6 +69,18 @@ func triplet() string {
return linuxArch() + "-rosa-linux-musl"
}
+// perArch is a value that differs per architecture.
+type perArch[T any] map[string]T
+
+// unwrap returns the value for the current architecture.
+func (p perArch[T]) unwrap() T {
+ v, ok := p[runtime.GOARCH]
+ if !ok {
+ panic("unsupported target " + runtime.GOARCH)
+ }
+ return v
+}
+
const (
// EnvTriplet holds the return value of triplet.
EnvTriplet = "ROSA_TRIPLE"
diff --git a/internal/rosa/stage0.go b/internal/rosa/stage0.go
index 606131b7..b1e217f5 100644
--- a/internal/rosa/stage0.go
+++ b/internal/rosa/stage0.go
@@ -1,7 +1,6 @@
package rosa
import (
- "runtime"
"sync"
"hakurei.app/internal/pkg"
@@ -61,23 +60,14 @@ var (
// NewStage0 returns a stage0 distribution created from curing [Stage0].
func NewStage0() pkg.Artifact {
stage0Once.Do(func() {
- var seed string
- switch runtime.GOARCH {
- case "amd64":
- seed = "tqM1Li15BJ-uFG8zU-XjgFxoN_kuzh1VxrSDVUVa0vGmo-NeWapSftH739sY8EAg"
- case "arm64":
- seed = "CJj3ZSnRyLmFHlWIQtTPQD9oikOZY4cD_mI3v_-LIYc2hhg-cq_CZFBLzQBAkFIn"
- case "riscv64":
- seed = "FcszJjcVWdKAnn-bt8qmUn5GUUTjv_xQjXOWkUpOplRkG3Ckob3StUoAi5KQ5-QF"
-
- default:
- panic("unsupported target " + runtime.GOARCH)
- }
-
stage0 = pkg.NewHTTPGetTar(
nil, "https://hakurei.app/seed/20260210/"+
"stage0-"+triplet()+".tar.bz2",
- mustDecode(seed),
+ mustDecode(perArch[string]{
+ "amd64": "tqM1Li15BJ-uFG8zU-XjgFxoN_kuzh1VxrSDVUVa0vGmo-NeWapSftH739sY8EAg",
+ "arm64": "CJj3ZSnRyLmFHlWIQtTPQD9oikOZY4cD_mI3v_-LIYc2hhg-cq_CZFBLzQBAkFIn",
+ "riscv64": "FcszJjcVWdKAnn-bt8qmUn5GUUTjv_xQjXOWkUpOplRkG3Ckob3StUoAi5KQ5-QF",
+ }.unwrap()),
pkg.TarBzip2,
)
})