manifest: move kernel option handling outside EFIBootTree

The kernel arguments for the EFIBootTree depend on the type of ISO we're
building, the payload, and the location of the kickstart file if any.
Instead of setting multiple fields on the object, most of which would be
mutually exclusive, set the kernel arguments from the image manifest
generator function which has all the information.
This commit is contained in:
Achilleas Koutsou 2022-11-25 21:04:14 +01:00 committed by Tom Gundersen
parent fae824d574
commit edce65eabd
3 changed files with 8 additions and 13 deletions

View file

@ -113,10 +113,15 @@ func (img *ImageInstaller) InstantiateManifest(m *manifest.Manifest,
bootTreePipeline.Platform = img.Platform
bootTreePipeline.UEFIVendor = img.Platform.GetUEFIVendor()
bootTreePipeline.ISOLabel = isoLabel
bootTreePipeline.KernelOpts = img.AdditionalKernelOpts
kernelOpts := make([]string, 0)
if img.ISORootKickstart {
bootTreePipeline.KSPath = kspath
kernelOpts = append(kernelOpts, fmt.Sprintf("inst.ks=hd:LABEL=%s:%s", isoLabel, kspath))
} else {
kernelOpts = append(kernelOpts, fmt.Sprintf("inst.stage2=hd:LABEL=%s", isoLabel))
}
kernelOpts = append(kernelOpts, img.AdditionalKernelOpts...)
bootTreePipeline.KernelOpts = kernelOpts
osPipeline := manifest.NewOS(m, buildPipeline, img.Platform, repos)
osPipeline.OSCustomizations = img.OSCustomizations

View file

@ -89,8 +89,8 @@ func (img *OSTreeInstaller) InstantiateManifest(m *manifest.Manifest,
bootTreePipeline := manifest.NewEFIBootTree(m, buildPipeline, img.Product, img.OSVersion)
bootTreePipeline.Platform = img.Platform
bootTreePipeline.UEFIVendor = img.Platform.GetUEFIVendor()
bootTreePipeline.KSPath = kspath
bootTreePipeline.ISOLabel = isoLabel
bootTreePipeline.KernelOpts = []string{fmt.Sprintf("inst.ks=hd:LABEL=%s:%s", isoLabel, kspath)}
isoTreePipeline := manifest.NewAnacondaISOTree(m,
buildPipeline,

View file

@ -1,8 +1,6 @@
package manifest
import (
"fmt"
"github.com/osbuild/osbuild-composer/internal/distro"
"github.com/osbuild/osbuild-composer/internal/osbuild"
"github.com/osbuild/osbuild-composer/internal/platform"
@ -18,7 +16,6 @@ type EFIBootTree struct {
UEFIVendor string
ISOLabel string
KSPath string
KernelOpts []string
}
@ -48,13 +45,6 @@ func (p *EFIBootTree) serialize() osbuild.Pipeline {
}
kernelOpts := []string{}
if p.KSPath != "" {
kernelOpts = append(kernelOpts, fmt.Sprintf("inst.ks=hd:LABEL=%s:%s", p.ISOLabel, p.KSPath))
} else {
kernelOpts = append(kernelOpts, fmt.Sprintf("inst.stage2=hd:LABEL=%s", p.ISOLabel))
}
if len(p.KernelOpts) > 0 {
kernelOpts = append(kernelOpts, p.KernelOpts...)
}