diff options
Diffstat (limited to 'internal/rosa/rosa.go')
| -rw-r--r-- | internal/rosa/rosa.go | 39 |
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) + } +} |
