aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal/rosa/rosa.go
diff options
context:
space:
mode:
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,