pipeline: drop stage_options.go

This was barely used. Making it explicit seemed more readable.
This commit is contained in:
Tom Gundersen 2022-06-26 19:58:51 +01:00
parent f60092033b
commit e5ef7933ac
3 changed files with 10 additions and 22 deletions

View file

@ -25,7 +25,13 @@ func (p BuildPipeline) Serialize() osbuild2.Pipeline {
pipeline := p.Pipeline.Serialize()
pipeline.AddStage(osbuild2.NewRPMStage(osbuild2.NewRPMStageOptions(p.repos), osbuild2.NewRpmStageSourceFilesInputs(p.packageSpecs)))
pipeline.AddStage(osbuild2.NewSELinuxStage(selinuxStageOptions(true)))
pipeline.AddStage(osbuild2.NewSELinuxStage(&osbuild2.SELinuxStageOptions{
FileContexts: "etc/selinux/targeted/contexts/files/file_contexts",
Labels: map[string]string{
"/usr/bin/cp": "system_u:object_r:install_exec_t:s0",
},
},
))
return pipeline
}

View file

@ -264,7 +264,9 @@ func (p OSPipeline) Serialize() osbuild2.Pipeline {
pipeline.AddStage(bootloader)
}
pipeline.AddStage(osbuild2.NewSELinuxStage(selinuxStageOptions(false)))
pipeline.AddStage(osbuild2.NewSELinuxStage(&osbuild2.SELinuxStageOptions{
FileContexts: "etc/selinux/targeted/contexts/files/file_contexts",
}))
if p.osTree {
pipeline.AddStage(osbuild2.NewOSTreePrepTreeStage(&osbuild2.OSTreePrepTreeStageOptions{

View file

@ -1,20 +0,0 @@
package pipeline
import (
"github.com/osbuild/osbuild-composer/internal/osbuild2"
)
// selinuxStageOptions returns the options for the org.osbuild.selinux stage.
// Setting the argument to 'true' relabels the '/usr/bin/cp'
// binariy with 'install_exec_t'. This should be set in the build root.
func selinuxStageOptions(labelcp bool) *osbuild2.SELinuxStageOptions {
options := &osbuild2.SELinuxStageOptions{
FileContexts: "etc/selinux/targeted/contexts/files/file_contexts",
}
if labelcp {
options.Labels = map[string]string{
"/usr/bin/cp": "system_u:object_r:install_exec_t:s0",
}
}
return options
}