From 22faa798802ab5eef0489abf466dcb560134e2d7 Mon Sep 17 00:00:00 2001 From: Achilleas Koutsou Date: Fri, 6 Aug 2021 01:42:29 +0200 Subject: [PATCH] distro/rhel85: bootloaderInstStage() function Returns a single stage that installs the bootloader. Signed-off-by: Achilleas Koutsou --- internal/distro/rhel85/pipelines.go | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/internal/distro/rhel85/pipelines.go b/internal/distro/rhel85/pipelines.go index 25629776c..ebb75f247 100644 --- a/internal/distro/rhel85/pipelines.go +++ b/internal/distro/rhel85/pipelines.go @@ -43,7 +43,7 @@ func qcow2Pipelines(t *imageType, customizations *blueprint.Customizations, opti pipelines = append(pipelines, *treePipeline) diskfile := "disk.img" - imagePipeline := liveImagePipeline(treePipeline.Name, diskfile, &partitionTable, t.arch.legacy) + imagePipeline := liveImagePipeline(treePipeline.Name, diskfile, &partitionTable, t.arch) pipelines = append(pipelines, *imagePipeline) qemuPipeline := qemuPipeline(imagePipeline.Name, diskfile, t.filename, "qcow2", "0.10") @@ -68,7 +68,7 @@ func vhdPipelines(t *imageType, customizations *blueprint.Customizations, option pipelines = append(pipelines, *treePipeline) diskfile := "disk.img" - imagePipeline := liveImagePipeline(treePipeline.Name, diskfile, &partitionTable, t.arch.legacy) + imagePipeline := liveImagePipeline(treePipeline.Name, diskfile, &partitionTable, t.arch) pipelines = append(pipelines, *imagePipeline) if err != nil { return nil, err @@ -95,7 +95,7 @@ func vmdkPipelines(t *imageType, customizations *blueprint.Customizations, optio pipelines = append(pipelines, *treePipeline) diskfile := "disk.img" - imagePipeline := liveImagePipeline(treePipeline.Name, diskfile, &partitionTable, t.arch.legacy) + imagePipeline := liveImagePipeline(treePipeline.Name, diskfile, &partitionTable, t.arch) pipelines = append(pipelines, *imagePipeline) if err != nil { return nil, err @@ -122,7 +122,7 @@ func openstackPipelines(t *imageType, customizations *blueprint.Customizations, pipelines = append(pipelines, *treePipeline) diskfile := "disk.img" - imagePipeline := liveImagePipeline(treePipeline.Name, diskfile, &partitionTable, t.arch.legacy) + imagePipeline := liveImagePipeline(treePipeline.Name, diskfile, &partitionTable, t.arch) pipelines = append(pipelines, *imagePipeline) if err != nil { return nil, err @@ -393,7 +393,7 @@ func ec2CommonPipelines(t *imageType, customizations *blueprint.Customizations, treePipeline.AddStage(osbuild.NewSELinuxStage(selinuxStageOptions(false))) pipelines = append(pipelines, *treePipeline) - imagePipeline := liveImagePipeline(treePipeline.Name, diskfile, &partitionTable, t.arch.legacy) + imagePipeline := liveImagePipeline(treePipeline.Name, diskfile, &partitionTable, t.arch) pipelines = append(pipelines, *imagePipeline) return pipelines, nil } @@ -847,7 +847,7 @@ func bootISOPipeline(filename string, arch string) *osbuild.Pipeline { return p } -func liveImagePipeline(inputPipelineName string, outputFilename string, pt *disk.PartitionTable, platform string) *osbuild.Pipeline { +func liveImagePipeline(inputPipelineName string, outputFilename string, pt *disk.PartitionTable, arch *architecture) *osbuild.Pipeline { p := new(osbuild.Pipeline) p.Name = "image" p.Build = "name:build" @@ -865,11 +865,7 @@ func liveImagePipeline(inputPipelineName string, outputFilename string, pt *disk copyOptions, copyDevices, copyMounts := copyFSTreeOptions(inputName, inputPipelineName, pt, loopback) copyInputs := copyPipelineTreeInputs(inputName, inputPipelineName) p.AddStage(osbuild.NewCopyStage(copyOptions, copyInputs, copyDevices, copyMounts)) - - if platform != "" { - p.AddStage(osbuild.NewGrub2InstStage(grub2InstStageOptions(outputFilename, pt, platform))) - } - + p.AddStage(bootloaderInstStage(outputFilename, pt, arch)) return p } @@ -968,6 +964,15 @@ func bootloaderConfigStage(t *imageType, partitionTable disk.PartitionTable, ker return osbuild.NewGRUB2Stage(grub2StageOptions(partitionTable.RootPartition(), kernelOptions, kernel, kernelVer, uefi, legacy)) } +func bootloaderInstStage(filename string, pt *disk.PartitionTable, arch *architecture) *osbuild.Stage { + platform := arch.legacy + if platform != "" { + return osbuild.NewGrub2InstStage(grub2InstStageOptions(filename, pt, platform)) + } + + return nil +} + func kernelVerStr(pkgs []rpmmd.PackageSpec, kernelName, arch string) string { kernelPkg := new(rpmmd.PackageSpec) for _, pkg := range pkgs {