diff --git a/internal/pipeline/build.go b/internal/pipeline/build.go index 24b649846..263d3dce4 100644 --- a/internal/pipeline/build.go +++ b/internal/pipeline/build.go @@ -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 } diff --git a/internal/pipeline/os.go b/internal/pipeline/os.go index 02d600b42..7cf4ef17b 100644 --- a/internal/pipeline/os.go +++ b/internal/pipeline/os.go @@ -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{ diff --git a/internal/pipeline/stage_options.go b/internal/pipeline/stage_options.go deleted file mode 100644 index c90ac9e9f..000000000 --- a/internal/pipeline/stage_options.go +++ /dev/null @@ -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 -}