From 645cd94efc970b7ecacefc29fe78153608ade11d Mon Sep 17 00:00:00 2001 From: Ophestra Date: Thu, 26 Nov 2026 20:43:16 +0900 Subject: internal/rosa: remove /usr/src There is only one primary source directory per package, so naming the directory after the package makes little sense, and introduces many complications and ugliness of having to refer to their own name. This change also moves extras to /extra, preserving the relative pathnames. Signed-off-by: Ophestra --- internal/rosa/etc.go | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'internal/rosa/etc.go') diff --git a/internal/rosa/etc.go b/internal/rosa/etc.go index 83c4ac4a..25ded51a 100644 --- a/internal/rosa/etc.go +++ b/internal/rosa/etc.go @@ -19,6 +19,11 @@ type cureEtc struct { minimal bool } +var _ pkg.RevisionArtifact = cureEtc{} + +// Revision satisfies [pkg.RevisionArtifact] for source directory replacement. +func (cureEtc) Revision() uint64 { return 0 } + // NewEtc returns a [pkg.Artifact] containing deterministic elements of /etc. func NewEtc(minimal bool) pkg.Artifact { return cureEtc{minimal} @@ -26,6 +31,13 @@ func NewEtc(minimal bool) pkg.Artifact { // Cure writes hardcoded configuration to files under etc. func (a cureEtc) Cure(t *pkg.FContext) (err error) { + if err = os.MkdirAll(t.GetWorkDir().Append( + prefixR, + "cure", + ).String(), 0700); err != nil { + return + } + etc := t.GetWorkDir().Append("etc") if err = os.MkdirAll(etc.String(), 0700); err != nil { return @@ -33,7 +45,7 @@ func (a cureEtc) Cure(t *pkg.FContext) (err error) { for _, f := range []KV{ {"hosts", "127.0.0.1 localhost cure cure-net\n"}, {"passwd", `root:x:0:0:System administrator:/proc/nonexistent:/bin/sh -cure:x:1023:1023:Cure:/usr/src:/bin/sh +cure:x:1023:1023:Cure:` + Prefix + `/cure:/bin/sh nobody:x:65534:65534:Overflow user:/proc/nonexistent:` + Prefix + `/bin/false `}, {"group", `root:x:0: -- cgit v1.3.1