distro/rhel85: bootloaderInstStage() function

Returns a single stage that installs the bootloader.

Signed-off-by: Achilleas Koutsou <achilleas@koutsou.net>
This commit is contained in:
Achilleas Koutsou 2021-08-06 01:42:29 +02:00 committed by Ondřej Budai
parent 38e88daea6
commit 22faa79880

View file

@ -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 {