aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal/rosa/rosa.go
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2026-07-01 14:25:30 +0900
committerOphestra <cat@gensokyo.uk>2026-07-01 15:03:26 +0900
commit3975dd3e0f6d446241841cdf5c011d4f5f77b5eb (patch)
tree80818b60350262b18966138057cb47127ba8694d /internal/rosa/rosa.go
parent3ab7116b29750824c7d77b7dd43f20db88aac7db (diff)
internal/rosa: create /bin symlinks via helper
This centralises the workaround for surprisingly common buggy scripts with nonstandard hardcoded paths. Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal/rosa/rosa.go')
-rw-r--r--internal/rosa/rosa.go24
1 files changed, 24 insertions, 0 deletions
diff --git a/internal/rosa/rosa.go b/internal/rosa/rosa.go
index ebb814dc..7c23736c 100644
--- a/internal/rosa/rosa.go
+++ b/internal/rosa/rosa.go
@@ -414,6 +414,10 @@ type PackageAttr struct {
// Passed to [Toolchain.NewPatchedSource].
Patches []KV
+ // Programs to make available in /bin/.
+ Bin []string
+ // Whether to replace /usr/bin/ with a symlink to /bin/.
+ PopulateUsrBin bool
// Unregistered extras.
Extra []pkg.Artifact
@@ -544,6 +548,26 @@ cd '/usr/src/` + name + `/'
})
}
+ bin := attr.Bin
+ if attr.PopulateUsrBin {
+ scriptEarly += `
+chmod +w /usr/ /usr/bin/
+rm -rf /usr/bin/
+ln -s ../bin /usr/`
+ bin = append(bin, "env")
+ }
+
+ if t.stage != stageGentoo && len(bin) > 0 {
+ scriptEarly += "\nchmod +w /bin/" +
+ "\n(set -o braceexpand && ln -sf ../system/bin/"
+ if len(bin) > 1 {
+ scriptEarly += "{'" + strings.Join(bin, "','") + "'}"
+ } else {
+ scriptEarly += "'" + bin[0] + "'"
+ }
+ scriptEarly += " /bin/)\n"
+ }
+
return t.New(
rn,
attr.Flag,