aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal/rosa/stage0.go
blob: 21c8d3ed1a5ab37413d40cc551012949e24c65c4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package rosa

import (
	"sync"

	"hakurei.app/fhs"
	"hakurei.app/internal/pkg"
)

func (t Toolchain) newStage0() (pkg.Artifact, string) {
	return t.New("rosa-stage0", 0, t.AppendPresets(nil,
		Bzip2,
	), nil, nil, `
umask 377
tar \
	-vjc \
	-C /stage0 \
	-f /work/stage0-`+triplet()+`.tar.bz2 \
	.
`, pkg.Path(fhs.AbsRoot.Append("stage0"), false, t.AppendPresets(nil,
		LLVM,
		Mksh,
		toyboxEarly,
	)...)), Unversioned
}
func init() {
	artifactsM[Stage0] = Metadata{
		f: Toolchain.newStage0,

		Name:        "rosa-stage0",
		Description: "Rosa OS stage0 toolchain tarball for bootstrap",
	}
}

var (
	// stage0 stores the tarball unpack artifact.
	stage0 pkg.Artifact
	// stage0Once is for lazy initialisation of stage0.
	stage0Once sync.Once
)

// NewStage0 returns a stage0 distribution created from curing [Stage0].
func NewStage0() pkg.Artifact {
	stage0Once.Do(func() {
		stage0 = newTar(
			"https://hakurei.app/seed/20260504/"+
				"stage0-"+triplet()+".tar.bz2",
			perArch[string]{
				"amd64": "IQjFDkiAVLo1XzflgMMiLP3gnVY2hhDMTzl-QqJDCQhcLQ3lLtRzjI5WCxGyW_lk",
				"arm64": "6fmwl2Umx2QssKQvxxb1JOGkAjzfA_MXKku0jVdGjYGb35OvwEVA5NYtd0HIy3yH",
			}.unwrap(),
			pkg.TarBzip2,
		)
	})
	return stage0
}