Skip to content

Commit

Permalink
manifest,osbuild: exclude /sysroot from selinux labeling
Browse files Browse the repository at this point in the history
This enusre that the buildroot container is setup without selinux
warnings.
  • Loading branch information
mvo5 committed Mar 19, 2024
1 parent 29cc921 commit ee150f4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
9 changes: 2 additions & 7 deletions pkg/manifest/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,13 +235,7 @@ func (p *BuildrootFromContainer) serialize() osbuild.Pipeline {
pipeline.Runner = p.runner.String()

image := osbuild.NewContainersInputForSingleSource(p.containerSpecs[0])
options := &osbuild.ContainerDeployOptions{
// XXX: this cannot be used when "bootc install to-filesystem"
// is used. The issue is that this also contains the metadata
// that bootc install uses to install the filesystem
//Exclude: []string{"/sysroot"},
}

options := &osbuild.ContainerDeployOptions{}
stage, err := osbuild.NewContainerDeployStage(image, options)
if err != nil {
panic(err)
Expand All @@ -250,6 +244,7 @@ func (p *BuildrootFromContainer) serialize() osbuild.Pipeline {
pipeline.AddStage(osbuild.NewSELinuxStage(
&osbuild.SELinuxStageOptions{
FileContexts: "etc/selinux/targeted/contexts/files/file_contexts",
ExcludePaths: []string{"/sysroot"},
Labels: p.getSELinuxLabels(),
},
))
Expand Down
1 change: 1 addition & 0 deletions pkg/osbuild/selinux_stage.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ package osbuild
// the filesystem labels to apply to the image.
type SELinuxStageOptions struct {
FileContexts string `json:"file_contexts"`
ExcludePaths []string `json:"exclude_paths"`
Labels map[string]string `json:"labels,omitempty"`
ForceAutorelabel *bool `json:"force_autorelabel,omitempty"`
}
Expand Down

0 comments on commit ee150f4

Please sign in to comment.