diff options
| author | Ophestra <cat@gensokyo.uk> | 2026-11-26 20:43:16 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2026-11-27 00:36:46 +0900 |
| commit | 645cd94efc970b7ecacefc29fe78153608ade11d (patch) | |
| tree | 37aa2d130777774d9750b170744ec6a17e8c61ca /internal/rosa/etc.go | |
| parent | fe25e7f1d85422c4eae8204c24a5057e15734eb5 (diff) | |
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 <cat@gensokyo.uk>
Diffstat (limited to 'internal/rosa/etc.go')
| -rw-r--r-- | internal/rosa/etc.go | 14 |
1 files changed, 13 insertions, 1 deletions
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: |
