aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal/rosa/etc.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/rosa/etc.go')
-rw-r--r--internal/rosa/etc.go47
1 files changed, 23 insertions, 24 deletions
diff --git a/internal/rosa/etc.go b/internal/rosa/etc.go
index 4ffebdba..ce43bf07 100644
--- a/internal/rosa/etc.go
+++ b/internal/rosa/etc.go
@@ -15,8 +15,13 @@ import (
// [Toolchain]. This silences test suites expecting certain standard files to be
// available in /etc.
type cureEtc struct {
- // Optional via newIANAEtc.
- iana pkg.Artifact
+ // Whether to exclude ianaEtc.
+ minimal bool
+}
+
+// NewEtc returns a [pkg.Artifact] containing deterministic elements of /etc.
+func NewEtc(minimal bool) pkg.Artifact {
+ return cureEtc{minimal}
}
// Cure writes hardcoded configuration to files under etc.
@@ -45,8 +50,8 @@ nobody:x:65534:
}
}
- if a.iana != nil {
- iana, _ := t.GetArtifact(a.iana)
+ if !a.minimal {
+ iana, _ := t.GetArtifact(ianaEtc)
buf := make([]byte, syscall.Getpagesize()<<3)
for _, name := range []string{
@@ -90,7 +95,7 @@ func (cureEtc) Kind() pkg.Kind { return kindEtc }
// Params writes whether iana-etc is populated.
func (a cureEtc) Params(ctx *pkg.IContext) {
- if a.iana != nil {
+ if !a.minimal {
ctx.WriteUint32(1)
} else {
ctx.WriteUint32(0)
@@ -100,8 +105,8 @@ func (a cureEtc) Params(ctx *pkg.IContext) {
func init() {
pkg.Register(kindEtc, func(r *pkg.IRReader) pkg.Artifact {
a := cureEtc{}
- if r.ReadUint32() != 0 {
- a.iana = r.Next()
+ if r.ReadUint32() == 0 {
+ a.minimal = true
}
if _, ok := r.Finalise(); ok {
panic(pkg.ErrUnexpectedChecksum)
@@ -115,34 +120,28 @@ func (cureEtc) IsExclusive() bool { return false }
// Dependencies returns a slice containing the backing iana-etc release.
func (a cureEtc) Dependencies() []pkg.Artifact {
- if a.iana != nil {
- return []pkg.Artifact{a.iana}
+ if !a.minimal {
+ return []pkg.Artifact{ianaEtc}
}
return nil
}
// String returns a hardcoded reporting name.
func (a cureEtc) String() string {
- if a.iana == nil {
+ if a.minimal {
return "cure-etc-minimal"
}
return "cure-etc"
}
-// newIANAEtc returns an unpacked iana-etc release.
-func newIANAEtc() pkg.Artifact {
- const (
- version = "20251215"
- checksum = "kvKz0gW_rGG5QaNK9ZWmWu1IEgYAdmhj_wR7DYrh3axDfIql_clGRHmelP7525NJ"
- )
- return newFromGitHubRelease(
- "Mic92/iana-etc",
- version,
- "iana-etc-"+version+".tar.gz",
- checksum,
- pkg.Gzip,
- )
-}
+// ianaEtc is an unpacked iana-etc release.
+var ianaEtc = newFromGitHubRelease(
+ "Mic92/iana-etc",
+ "20251215",
+ "iana-etc-20251215.tar.gz",
+ "kvKz0gW_rGG5QaNK9ZWmWu1IEgYAdmhj_wR7DYrh3axDfIql_clGRHmelP7525NJ",
+ pkg.Gzip,
+)
var (
resolvconfPath pkg.ExecPath