aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal/rosa/hakurei.go
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2026-02-23 15:16:51 +0900
committerOphestra <cat@gensokyo.uk>2026-02-23 17:56:16 +0900
commitae8c365c0f474b5c678701c95795677c20dc22b7 (patch)
tree5e0ecb0de21b2a203b39423adeba7f340d535c90 /internal/rosa/hakurei.go
parent485db515f7772178637cd630ca3ac2facd8e7f38 (diff)
internal/rosa/hakurei: optionally use embedded source
This builds hakurei in Rosa OS between releases. Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal/rosa/hakurei.go')
-rw-r--r--internal/rosa/hakurei.go50
1 files changed, 4 insertions, 46 deletions
diff --git a/internal/rosa/hakurei.go b/internal/rosa/hakurei.go
index be184302..02879176 100644
--- a/internal/rosa/hakurei.go
+++ b/internal/rosa/hakurei.go
@@ -1,15 +1,9 @@
package rosa
-import (
- "hakurei.app/internal/pkg"
-)
+import "hakurei.app/internal/pkg"
func (t Toolchain) newHakurei(suffix, script string) pkg.Artifact {
- const (
- version = "0.3.5"
- checksum = "6Tn38NLezRD2d3aGdFg5qFfqn8_KvC6HwMKwJMPvaHmVw8xRgxn8B0PObswl2mOk"
- )
- return t.New("hakurei"+suffix+"-"+version, 0, []pkg.Artifact{
+ return t.New("hakurei"+suffix+"-"+hakureiVersion, 0, []pkg.Artifact{
t.Load(Go),
t.Load(Gzip),
@@ -43,45 +37,9 @@ echo
chmod -R +w /usr/src/hakurei
cd /usr/src/hakurei
-HAKUREI_VERSION='v`+version+`'
+HAKUREI_VERSION='v`+hakureiVersion+`'
`+script, pkg.Path(AbsUsrSrc.Append("hakurei"), true, t.NewPatchedSource(
- "hakurei", version, pkg.NewHTTPGetTar(
- nil, "https://git.gensokyo.uk/security/hakurei/archive/"+
- "v"+version+".tar.gz",
- mustDecode(checksum),
- pkg.TarGzip,
- ), true, [2]string{"createTemp-error-injection", `diff --git a/container/dispatcher_test.go b/container/dispatcher_test.go
-index 5de37fc..fe0c4db 100644
---- a/container/dispatcher_test.go
-+++ b/container/dispatcher_test.go
-@@ -238,8 +238,11 @@ func sliceAddr[S any](s []S) *[]S { return &s }
-
- func newCheckedFile(t *testing.T, name, wantData string, closeErr error) osFile {
- f := &checkedOsFile{t: t, name: name, want: wantData, closeErr: closeErr}
-- // check happens in Close, and cleanup is not guaranteed to run, so relying on it for sloppy implementations will cause sporadic test results
-- f.cleanup = runtime.AddCleanup(f, func(name string) { f.t.Fatalf("checkedOsFile %s became unreachable without a call to Close", name) }, f.name)
-+ // check happens in Close, and cleanup is not guaranteed to run, so relying
-+ // on it for sloppy implementations will cause sporadic test results
-+ f.cleanup = runtime.AddCleanup(f, func(name string) {
-+ panic("checkedOsFile " + name + " became unreachable without a call to Close")
-+ }, name)
- return f
- }
-
-diff --git a/container/initplace_test.go b/container/initplace_test.go
-index afeddbe..1c2f20b 100644
---- a/container/initplace_test.go
-+++ b/container/initplace_test.go
-@@ -21,7 +21,7 @@ func TestTmpfileOp(t *testing.T) {
- Path: samplePath,
- Data: sampleData,
- }, nil, nil, []stub.Call{
-- call("createTemp", stub.ExpectArgs{"/", "tmp.*"}, newCheckedFile(t, "tmp.32768", sampleDataString, nil), stub.UniqueError(5)),
-+ call("createTemp", stub.ExpectArgs{"/", "tmp.*"}, (*checkedOsFile)(nil), stub.UniqueError(5)),
- }, stub.UniqueError(5)},
-
- {"Write", &Params{ParentPerm: 0700}, &TmpfileOp{
-`},
+ "hakurei", hakureiVersion, hakureiSource, true, hakureiPatches...,
)), pkg.Path(AbsUsrSrc.Append("hostname", "main.go"), false, pkg.NewFile(
"hostname.go",
[]byte(`