aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal/rosa/rosa.go
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2026-01-19 00:00:13 +0900
committerOphestra <cat@gensokyo.uk>2026-01-19 00:07:56 +0900
commit8d06c0235bf01d40d1455fac44519d9cf6983806 (patch)
treed6517c0b850a58926a12928c73e11cea603c6d01 /internal/rosa/rosa.go
parent4155adc16a7afbec5ca1c23a07ef850f92ab4008 (diff)
internal/rosa: busybox binary artifact
This installs a statically linked busybox binary distribution for decompressing the gentoo stage3 tarball, since there is no native xz implementation. Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal/rosa/rosa.go')
-rw-r--r--internal/rosa/rosa.go39
1 files changed, 39 insertions, 0 deletions
diff --git a/internal/rosa/rosa.go b/internal/rosa/rosa.go
index 7ddf4143..cec415aa 100644
--- a/internal/rosa/rosa.go
+++ b/internal/rosa/rosa.go
@@ -2,10 +2,49 @@
package rosa
import (
+ "log"
+ "runtime"
+
+ "hakurei.app/container/fhs"
"hakurei.app/internal/pkg"
)
const (
// kindEtc is the kind of [pkg.Artifact] of cureEtc.
kindEtc = iota + pkg.KindCustomOffset
+
+ // kindBusyboxBin is the kind of [pkg.Artifact] of busyboxBin.
+ kindBusyboxBin
)
+
+// mustDecode is like [pkg.MustDecode], but replaces the zero value and prints
+// a warning.
+func mustDecode(s string) pkg.Checksum {
+ var fallback = pkg.Checksum{}
+ if s == "" {
+ log.Println(
+ "falling back to",
+ pkg.Encode(fallback),
+ "for unpopulated checksum",
+ )
+ return fallback
+ }
+ return pkg.MustDecode(s)
+}
+
+var (
+ // AbsSystem is the Rosa OS installation prefix.
+ AbsSystem = fhs.AbsRoot.Append("system")
+)
+
+// linuxArch returns the architecture name used by linux corresponding to
+// [runtime.GOARCH].
+func linuxArch() string {
+ switch runtime.GOARCH {
+ case "amd64":
+ return "x86_64"
+
+ default:
+ panic("unsupported target " + runtime.GOARCH)
+ }
+}