distro/rhel8: gce-specific platform override

The gceX86 platform embeds the X86 platform and overrides the
GetPackages() method to exclude the grub2-pc package.

The gce image is built as UEFI only, does not include 'grub2-pc', but we
enable BIOS in the platform config for all the other side-effects: grub
config options and grub2.inst stage.

See the image type documentation for more information:
d12d9674d6/image-types/rhel8/google-gce.md (rhel-8-byosrhui--rhel-9-byos-image-differences-compared-to-googles-image)
This commit is contained in:
Achilleas Koutsou 2023-01-10 21:04:49 +01:00 committed by Tomáš Hozza
parent 91e2a62654
commit 8443464096
2 changed files with 31 additions and 5 deletions

View file

@ -281,11 +281,14 @@ func newDistro(name string, minor int) *distribution {
imageInstaller(),
)
gceX86Platform := &platform.X86{
BIOS: true,
UEFIVendor: rd.vendor,
BasePlatform: platform.BasePlatform{
ImageFormat: platform.FORMAT_GCE,
// TODO: review requirement for platform with overridden packages for GCE
gceX86Platform := &gceX86{
X86: platform.X86{
BIOS: true,
UEFIVendor: rd.vendor,
BasePlatform: platform.BasePlatform{
ImageFormat: platform.FORMAT_GCE,
},
},
}

View file

@ -4,6 +4,7 @@ import (
"github.com/osbuild/osbuild-composer/internal/common"
"github.com/osbuild/osbuild-composer/internal/distro"
"github.com/osbuild/osbuild-composer/internal/osbuild"
"github.com/osbuild/osbuild-composer/internal/platform"
"github.com/osbuild/osbuild-composer/internal/rpmmd"
)
@ -302,3 +303,25 @@ func gceRhuiPackageSet(t *imageType) rpmmd.PackageSet {
},
}.Append(gceCommonPackageSet(t))
}
// gceX86 embeds the X86 platform and overrides the GetPackages() method to
// exclude the grub2-pc package.
// See the image type documentation for more information:
// https://github.com/osbuild/osbuild-composer/blob/d12d9674d6293f2c374a66ba2c4fac102633d360/image-types/rhel8/google-gce.md#rhel-8-byosrhui--rhel-9-byos-image-differences-compared-to-googles-image
type gceX86 struct {
platform.X86
}
func (p *gceX86) GetPackages() []string {
packages := p.BasePlatform.FirmwarePackages
packages = append(packages,
"dracut-config-generic",
"dracut-config-generic",
"efibootmgr",
"grub2-efi-x64",
"shim-x64")
return packages
}