aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal/rosa/stage0.go
blob: eff0c5a8305221ef24a8e66fa92d80099937102d (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
package rosa

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

// Stage0 is the handle of the stage0 distribution tarball built on the
// toolchain of stage [Std].
var Stage0 = H("rosa-stage0")

func init() {
	meta := Metadata{
		Name:        "rosa-stage0",
		Description: "Rosa OS stage0 toolchain tarball for bootstrap",
		Version:     Unversioned,
	}
	native.MustRegister(meta.Name, func(t Toolchain) (*Metadata, pkg.Artifact) {
		return &meta, t.New("rosa-stage0", 0, t.Append(nil,
			H("bzip2"),
		), nil, nil, `
umask 377
tar \
	-vjc \
	-C /stage0 \
	-f /work/stage0-`+t.triple()+`.tar.bz2 \
	.
`, pkg.Path(fhs.AbsRoot.Append("stage0"), false, t.Append(nil,
			LLVM,
			Mksh,
			toyboxEarly,
		)...))
	})
}

// HasStage0 returns whether a stage0 distribution is available.
func (s *S) HasStage0() (ok bool) {
	func() {
		defer func() { ok = recover() == nil }()
		s.New(stageEarly).MustLoad(stage0Dist)
	}()
	return
}