Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

osbuild: only mount the required mountpoints for bootc install (COMPOSER-2301) #846

Merged
merged 1 commit into from
Aug 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion pkg/osbuild/bootc_install_to_filesystem_stage.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"

"github.com/osbuild/images/pkg/platform"
"golang.org/x/exp/slices"
achilleas-k marked this conversation as resolved.
Show resolved Hide resolved
)

type BootcInstallToFilesystemOptions struct {
Expand Down Expand Up @@ -35,11 +36,22 @@ func NewBootcInstallToFilesystemStage(options *BootcInstallToFilesystemOptions,
return nil, fmt.Errorf("expected exactly one container input but got: %v (%v)", len(inputs.Images.References), inputs.Images.References)
}

// Don't mount any custom mountpoints.
// Only mount the minimum required mounts for bootc:
// /, /boot, and /boot/efi, if they are already defined.
requiredMountpoints := []string{"/", "/boot", "/boot/efi"}
reqMounts := make([]Mount, 0, len(mounts))
for _, mount := range mounts {
if slices.Contains(requiredMountpoints, mount.Target) {
reqMounts = append(reqMounts, mount)
}
}

return &Stage{
Type: "org.osbuild.bootc.install-to-filesystem",
Options: options,
Inputs: inputs,
Devices: devices,
Mounts: mounts,
Mounts: reqMounts,
}, nil
}
Loading