From c1b8bd6b7afbb36ce0222afc7102cb82b2b192ab Mon Sep 17 00:00:00 2001 From: Josue David Hernandez Gutierrez Date: Wed, 30 Oct 2024 18:39:41 +0000 Subject: [PATCH 2/9] Add support for OL on osbuild-composer Signed-off-by: Josue David Hernandez Gutierrez --- .../osbuild/images/pkg/blueprint/customizations.go | 2 +- .../osbuild/images/pkg/distro/rhel/distribution.go | 11 +++++++++++ .../osbuild/images/pkg/distro/rhel/rhel10/ami.go | 2 +- .../osbuild/images/pkg/distro/rhel/rhel10/azure.go | 8 ++++---- .../images/pkg/distro/rhel/rhel10/bare_metal.go | 4 ++-- .../osbuild/images/pkg/distro/rhel/rhel10/distro.go | 10 +++++++--- .../osbuild/images/pkg/distro/rhel/rhel8/ami.go | 2 +- .../osbuild/images/pkg/distro/rhel/rhel8/azure.go | 8 ++++---- .../images/pkg/distro/rhel/rhel8/bare_metal.go | 2 +- .../osbuild/images/pkg/distro/rhel/rhel8/distro.go | 12 ++++++++---- .../osbuild/images/pkg/distro/rhel/rhel9/ami.go | 2 +- .../osbuild/images/pkg/distro/rhel/rhel9/azure.go | 8 ++++---- .../images/pkg/distro/rhel/rhel9/bare_metal.go | 4 ++-- .../osbuild/images/pkg/distro/rhel/rhel9/distro.go | 12 ++++++++---- .../images/pkg/image/anaconda_live_installer.go | 2 +- .../images/pkg/image/anaconda_ostree_installer.go | 2 +- .../images/pkg/image/anaconda_tar_installer.go | 2 +- .../images/pkg/image/ostree_simplified_installer.go | 2 +- 18 files changed, 59 insertions(+), 36 deletions(-) diff --git a/vendor/github.com/osbuild/images/pkg/blueprint/customizations.go b/vendor/github.com/osbuild/images/pkg/blueprint/customizations.go index bcb1f98..3293cb8 100644 --- a/vendor/github.com/osbuild/images/pkg/blueprint/customizations.go +++ b/vendor/github.com/osbuild/images/pkg/blueprint/customizations.go @@ -270,7 +270,7 @@ func (c *Customizations) GetKernel() *KernelCustomization { } if name == "" { - name = "kernel" + name = "kernel-uek" } return &KernelCustomization{ diff --git a/vendor/github.com/osbuild/images/pkg/distro/rhel/distribution.go b/vendor/github.com/osbuild/images/pkg/distro/rhel/distribution.go index 963aed0..40fcf8e 100644 --- a/vendor/github.com/osbuild/images/pkg/distro/rhel/distribution.go +++ b/vendor/github.com/osbuild/images/pkg/distro/rhel/distribution.go @@ -142,6 +142,17 @@ func NewDistribution(name string, major, minor int) (*Distribution, error) { ostreeRefTmpl: fmt.Sprintf("centos/%d/%%s/edge", major), runner: &runner.CentOS{Version: uint64(major)}, } + case "ol": + rd = &Distribution{ + name: fmt.Sprintf("ol-%d.%d", major, minor), + product: "Oracle Linux", + osVersion: fmt.Sprintf("%d.%d", major, minor), + releaseVersion: fmt.Sprintf("%d", major), + modulePlatformID: fmt.Sprintf("platform:el%d", major), + vendor: "redhat", + ostreeRefTmpl: fmt.Sprintf("ol/%d/%%s/edge", major), + runner: &runner.RHEL{Major: uint64(major), Minor: uint64(minor)}, + } default: return nil, fmt.Errorf("unknown distro name: %s", name) } diff --git a/vendor/github.com/osbuild/images/pkg/distro/rhel/rhel10/ami.go b/vendor/github.com/osbuild/images/pkg/distro/rhel/rhel10/ami.go index 2358791..7042251 100644 --- a/vendor/github.com/osbuild/images/pkg/distro/rhel/rhel10/ami.go +++ b/vendor/github.com/osbuild/images/pkg/distro/rhel/rhel10/ami.go @@ -204,7 +204,7 @@ func defaultEc2ImageConfig() *distro.ImageConfig { { Kernel: &osbuild.SysconfigKernelOptions{ UpdateDefault: true, - DefaultKernel: "kernel", + DefaultKernel: "kernel-uek", }, Network: &osbuild.SysconfigNetworkOptions{ Networking: true, diff --git a/vendor/github.com/osbuild/images/pkg/distro/rhel/rhel10/azure.go b/vendor/github.com/osbuild/images/pkg/distro/rhel/rhel10/azure.go index 7f10832..a25efae 100644 --- a/vendor/github.com/osbuild/images/pkg/distro/rhel/rhel10/azure.go +++ b/vendor/github.com/osbuild/images/pkg/distro/rhel/rhel10/azure.go @@ -97,9 +97,9 @@ func azureCommonPackageSet(t *rhel.ImageType) rpmmd.PackageSet { "dracut-config-generic", "efibootmgr", "hyperv-daemons", - "kernel-core", - "kernel-modules", - "kernel", + "kernel-uek-core", + "kernel-uek-modules", + "kernel-uek", "langpacks-en", "lvm2", "NetworkManager", @@ -418,7 +418,7 @@ func defaultAzureImageConfig(rd *rhel.Distribution) *distro.ImageConfig { { Kernel: &osbuild.SysconfigKernelOptions{ UpdateDefault: true, - DefaultKernel: "kernel-core", + DefaultKernel: "kernel-uek-core", }, Network: &osbuild.SysconfigNetworkOptions{ Networking: true, diff --git a/vendor/github.com/osbuild/images/pkg/distro/rhel/rhel10/bare_metal.go b/vendor/github.com/osbuild/images/pkg/distro/rhel/rhel10/bare_metal.go index 81b9a7e..dd39e1b 100644 --- a/vendor/github.com/osbuild/images/pkg/distro/rhel/rhel10/bare_metal.go +++ b/vendor/github.com/osbuild/images/pkg/distro/rhel/rhel10/bare_metal.go @@ -140,7 +140,7 @@ func installerPackageSet(t *rhel.ImageType) rpmmd.PackageSet { "iwl5150-firmware", "iwl6050-firmware", "iwl7260-firmware", - "kernel", + "kernel-uek", "less", "nfs-utils", "openssh-clients", @@ -246,7 +246,7 @@ func anacondaPackageSet(t *rhel.ImageType) rpmmd.PackageSet { "kbd", "kbd-misc", "kdump-anaconda-addon", - "kernel", + "kernel-uek", "less", "libblockdev-lvm-dbus", "libibverbs", diff --git a/vendor/github.com/osbuild/images/pkg/distro/rhel/rhel10/distro.go b/vendor/github.com/osbuild/images/pkg/distro/rhel/rhel10/distro.go index a5cd9b9..d11868a 100644 --- a/vendor/github.com/osbuild/images/pkg/distro/rhel/rhel10/distro.go +++ b/vendor/github.com/osbuild/images/pkg/distro/rhel/rhel10/distro.go @@ -40,10 +40,14 @@ var ( func distroISOLabelFunc(t *rhel.ImageType) string { const RHEL_ISO_LABEL = "RHEL-%s-%s-0-BaseOS-%s" const CS_ISO_LABEL = "CentOS-Stream-%s-BaseOS-%s" + const OL_ISO_LABEL = "OL-%s-%s-dvd-%s" if t.IsRHEL() { osVer := strings.Split(t.Arch().Distro().OsVersion(), ".") return fmt.Sprintf(RHEL_ISO_LABEL, osVer[0], osVer[1], t.Arch().Name()) + } else if t.Arch().Distro().Name() == "ol" { + osVer := strings.Split(t.Arch().Distro().OsVersion(), ".") + return fmt.Sprintf(RHEL_ISO_LABEL, osVer[0], osVer[1], t.Arch().Name()) } else { return fmt.Sprintf(CS_ISO_LABEL, t.Arch().Distro().Releasever(), t.Arch().Name()) } @@ -57,7 +61,7 @@ func defaultDistroImageConfig(d *rhel.Distribution) *distro.ImageConfig { { Kernel: &osbuild.SysconfigKernelOptions{ UpdateDefault: true, - DefaultKernel: "kernel", + DefaultKernel: "kernel-uek", }, Network: &osbuild.SysconfigNetworkOptions{ Networking: true, @@ -274,7 +278,7 @@ func ParseID(idStr string) (*distro.ID, error) { return nil, err } - if id.Name != "rhel" && id.Name != "centos" { + if id.Name != "rhel" && id.Name != "centos" && id.Name != "ol" { return nil, fmt.Errorf("invalid distro name: %s", id.Name) } @@ -288,7 +292,7 @@ func ParseID(idStr string) (*distro.ID, error) { } // RHEL uses minor version - if id.Name == "rhel" && id.MinorVersion == -1 { + if (id.Name == "rhel" || id.Name == "ol") && id.MinorVersion == -1 { return nil, fmt.Errorf("rhel requires minor version, but got: %d", id.MinorVersion) } diff --git a/vendor/github.com/osbuild/images/pkg/distro/rhel/rhel8/ami.go b/vendor/github.com/osbuild/images/pkg/distro/rhel/rhel8/ami.go index e4c7fba..a29f9ee 100644 --- a/vendor/github.com/osbuild/images/pkg/distro/rhel/rhel8/ami.go +++ b/vendor/github.com/osbuild/images/pkg/distro/rhel/rhel8/ami.go @@ -197,7 +197,7 @@ func baseEc2ImageConfig() *distro.ImageConfig { { Kernel: &osbuild.SysconfigKernelOptions{ UpdateDefault: true, - DefaultKernel: "kernel", + DefaultKernel: "kernel-uek", }, Network: &osbuild.SysconfigNetworkOptions{ Networking: true, diff --git a/vendor/github.com/osbuild/images/pkg/distro/rhel/rhel8/azure.go b/vendor/github.com/osbuild/images/pkg/distro/rhel/rhel8/azure.go index a596493..8c65876 100644 --- a/vendor/github.com/osbuild/images/pkg/distro/rhel/rhel8/azure.go +++ b/vendor/github.com/osbuild/images/pkg/distro/rhel/rhel8/azure.go @@ -155,9 +155,9 @@ func azureCommonPackageSet(t *rhel.ImageType) rpmmd.PackageSet { "efibootmgr", "gdisk", "hyperv-daemons", - "kernel", - "kernel-core", - "kernel-modules", + "kernel-uek", + "kernel-uek-core", + "kernel-uek-modules", "langpacks-en", "lvm2", "nvme-cli", @@ -517,7 +517,7 @@ var defaultAzureImageConfig = &distro.ImageConfig{ { Kernel: &osbuild.SysconfigKernelOptions{ UpdateDefault: true, - DefaultKernel: "kernel-core", + DefaultKernel: "kernel-uek-core", }, Network: &osbuild.SysconfigNetworkOptions{ Networking: true, diff --git a/vendor/github.com/osbuild/images/pkg/distro/rhel/rhel8/bare_metal.go b/vendor/github.com/osbuild/images/pkg/distro/rhel/rhel8/bare_metal.go index 0d5fbe0..ac371d8 100644 --- a/vendor/github.com/osbuild/images/pkg/distro/rhel/rhel8/bare_metal.go +++ b/vendor/github.com/osbuild/images/pkg/distro/rhel/rhel8/bare_metal.go @@ -142,7 +142,7 @@ func installerPackageSet(t *rhel.ImageType) rpmmd.PackageSet { "iwl6000-firmware", "iwl6050-firmware", "iwl7260-firmware", - "kernel", + "kernel-uek", "less", "nfs-utils", "openssh-clients", diff --git a/vendor/github.com/osbuild/images/pkg/distro/rhel/rhel8/distro.go b/vendor/github.com/osbuild/images/pkg/distro/rhel/rhel8/distro.go index 4c4a1e3..6615063 100644 --- a/vendor/github.com/osbuild/images/pkg/distro/rhel/rhel8/distro.go +++ b/vendor/github.com/osbuild/images/pkg/distro/rhel/rhel8/distro.go @@ -44,7 +44,7 @@ func defaultDistroImageConfig(d *rhel.Distribution) *distro.ImageConfig { { Kernel: &osbuild.SysconfigKernelOptions{ UpdateDefault: true, - DefaultKernel: "kernel", + DefaultKernel: "kernel-uek", }, Network: &osbuild.SysconfigNetworkOptions{ Networking: true, @@ -60,10 +60,14 @@ func defaultDistroImageConfig(d *rhel.Distribution) *distro.ImageConfig { func distroISOLabelFunc(t *rhel.ImageType) string { const RHEL_ISO_LABEL = "RHEL-%s-%s-0-BaseOS-%s" const CS_ISO_LABEL = "CentOS-Stream-%s-%s-dvd" + const OL_ISO_LABEL = "OL-%s-%s-dvd-%s" if t.IsRHEL() { osVer := strings.Split(t.Arch().Distro().OsVersion(), ".") return fmt.Sprintf(RHEL_ISO_LABEL, osVer[0], osVer[1], t.Arch().Name()) + }else if t.Arch().Distro().Name() == "ol" { + osVer := strings.Split(t.Arch().Distro().OsVersion(), ".") + return fmt.Sprintf(RHEL_ISO_LABEL, osVer[0], osVer[1], t.Arch().Name()) } else { return fmt.Sprintf(CS_ISO_LABEL, t.Arch().Distro().Releasever(), t.Arch().Name()) } @@ -417,12 +421,12 @@ func ParseID(idStr string) (*distro.ID, error) { return nil, err } - if id.Name != "rhel" && id.Name != "centos" { + if id.Name != "rhel" && id.Name != "centos" && id.Name != "ol" { return nil, fmt.Errorf("invalid distro name: %s", id.Name) } // Backward compatibility layer for "rhel-84" or "rhel-810" - if id.Name == "rhel" && id.MinorVersion == -1 { + if (id.Name == "rhel" || id.Name == "ol") && id.MinorVersion == -1 { if id.MajorVersion/10 == 8 { // handle single digit minor version id.MinorVersion = id.MajorVersion % 10 @@ -444,7 +448,7 @@ func ParseID(idStr string) (*distro.ID, error) { } // RHEL uses minor version - if id.Name == "rhel" && id.MinorVersion == -1 { + if (id.Name == "rhel" || id.Name == "ol") && id.MinorVersion == -1 { return nil, fmt.Errorf("rhel requires minor version, but got: %d", id.MinorVersion) } diff --git a/vendor/github.com/osbuild/images/pkg/distro/rhel/rhel9/ami.go b/vendor/github.com/osbuild/images/pkg/distro/rhel/rhel9/ami.go index d4216ae..1604be8 100644 --- a/vendor/github.com/osbuild/images/pkg/distro/rhel/rhel9/ami.go +++ b/vendor/github.com/osbuild/images/pkg/distro/rhel/rhel9/ami.go @@ -53,7 +53,7 @@ func defaultEc2ImageConfig() *distro.ImageConfig { { Kernel: &osbuild.SysconfigKernelOptions{ UpdateDefault: true, - DefaultKernel: "kernel", + DefaultKernel: "kernel-uek", }, Network: &osbuild.SysconfigNetworkOptions{ Networking: true, diff --git a/vendor/github.com/osbuild/images/pkg/distro/rhel/rhel9/azure.go b/vendor/github.com/osbuild/images/pkg/distro/rhel/rhel9/azure.go index cb3831d..9db3db7 100644 --- a/vendor/github.com/osbuild/images/pkg/distro/rhel/rhel9/azure.go +++ b/vendor/github.com/osbuild/images/pkg/distro/rhel/rhel9/azure.go @@ -98,9 +98,9 @@ func azureCommonPackageSet(t *rhel.ImageType) rpmmd.PackageSet { "efibootmgr", "gdisk", "hyperv-daemons", - "kernel-core", - "kernel-modules", - "kernel", + "kernel-uek-core", + "kernel-uek-modules", + "kernel-uek", "langpacks-en", "lvm2", "NetworkManager", @@ -430,7 +430,7 @@ func defaultAzureImageConfig(rd *rhel.Distribution) *distro.ImageConfig { { Kernel: &osbuild.SysconfigKernelOptions{ UpdateDefault: true, - DefaultKernel: "kernel-core", + DefaultKernel: "kernel-uek-core", }, Network: &osbuild.SysconfigNetworkOptions{ Networking: true, diff --git a/vendor/github.com/osbuild/images/pkg/distro/rhel/rhel9/bare_metal.go b/vendor/github.com/osbuild/images/pkg/distro/rhel/rhel9/bare_metal.go index 22807f3..f98f4c5 100644 --- a/vendor/github.com/osbuild/images/pkg/distro/rhel/rhel9/bare_metal.go +++ b/vendor/github.com/osbuild/images/pkg/distro/rhel/rhel9/bare_metal.go @@ -147,7 +147,7 @@ func installerPackageSet(t *rhel.ImageType) rpmmd.PackageSet { "iwl5150-firmware", "iwl6050-firmware", "iwl7260-firmware", - "kernel", + "kernel-uek", "less", "nfs-utils", "openssh-clients", @@ -257,7 +257,7 @@ func anacondaPackageSet(t *rhel.ImageType) rpmmd.PackageSet { "kbd", "kbd-misc", "kdump-anaconda-addon", - "kernel", + "kernel-uek", "khmeros-base-fonts", "less", "libblockdev-lvm-dbus", diff --git a/vendor/github.com/osbuild/images/pkg/distro/rhel/rhel9/distro.go b/vendor/github.com/osbuild/images/pkg/distro/rhel/rhel9/distro.go index 0648813..0d06b1a 100644 --- a/vendor/github.com/osbuild/images/pkg/distro/rhel/rhel9/distro.go +++ b/vendor/github.com/osbuild/images/pkg/distro/rhel/rhel9/distro.go @@ -43,10 +43,14 @@ var ( func distroISOLabelFunc(t *rhel.ImageType) string { const RHEL_ISO_LABEL = "RHEL-%s-%s-0-BaseOS-%s" const CS_ISO_LABEL = "CentOS-Stream-%s-BaseOS-%s" + const OL_ISO_LABEL = "OL-%s-%s-dvd-%s" if t.IsRHEL() { osVer := strings.Split(t.Arch().Distro().OsVersion(), ".") return fmt.Sprintf(RHEL_ISO_LABEL, osVer[0], osVer[1], t.Arch().Name()) + }else if t.Arch().Distro().Name() == "ol" { + osVer := strings.Split(t.Arch().Distro().OsVersion(), ".") + return fmt.Sprintf(RHEL_ISO_LABEL, osVer[0], osVer[1], t.Arch().Name()) } else { return fmt.Sprintf(CS_ISO_LABEL, t.Arch().Distro().Releasever(), t.Arch().Name()) } @@ -60,7 +64,7 @@ func defaultDistroImageConfig(d *rhel.Distribution) *distro.ImageConfig { { Kernel: &osbuild.SysconfigKernelOptions{ UpdateDefault: true, - DefaultKernel: "kernel", + DefaultKernel: "kernel-uek", }, Network: &osbuild.SysconfigNetworkOptions{ Networking: true, @@ -370,12 +374,12 @@ func ParseID(idStr string) (*distro.ID, error) { return nil, err } - if id.Name != "rhel" && id.Name != "centos" { + if id.Name != "rhel" && id.Name != "centos" && id.Name != "ol" { return nil, fmt.Errorf("invalid distro name: %s", id.Name) } // Backward compatibility layer for "rhel-93" or "rhel-910" - if id.Name == "rhel" && id.MinorVersion == -1 { + if (id.Name == "rhel" || id.Name == "ol") && id.MinorVersion == -1 { if id.MajorVersion/10 == 9 { // handle single digit minor version id.MinorVersion = id.MajorVersion % 10 @@ -397,7 +401,7 @@ func ParseID(idStr string) (*distro.ID, error) { } // RHEL uses minor version - if id.Name == "rhel" && id.MinorVersion == -1 { + if (id.Name == "rhel" || id.Name == "ol") && id.MinorVersion == -1 { return nil, fmt.Errorf("rhel requires minor version, but got: %d", id.MinorVersion) } diff --git a/vendor/github.com/osbuild/images/pkg/image/anaconda_live_installer.go b/vendor/github.com/osbuild/images/pkg/image/anaconda_live_installer.go index 393030c..134ba58 100644 --- a/vendor/github.com/osbuild/images/pkg/image/anaconda_live_installer.go +++ b/vendor/github.com/osbuild/images/pkg/image/anaconda_live_installer.go @@ -53,7 +53,7 @@ func (img *AnacondaLiveInstaller) InstantiateManifest(m *manifest.Manifest, buildPipeline, img.Platform, repos, - "kernel", + "kernel-uek", img.Product, img.OSVersion, img.Preview, diff --git a/vendor/github.com/osbuild/images/pkg/image/anaconda_ostree_installer.go b/vendor/github.com/osbuild/images/pkg/image/anaconda_ostree_installer.go index 46f2142..adf327a 100644 --- a/vendor/github.com/osbuild/images/pkg/image/anaconda_ostree_installer.go +++ b/vendor/github.com/osbuild/images/pkg/image/anaconda_ostree_installer.go @@ -71,7 +71,7 @@ func (img *AnacondaOSTreeInstaller) InstantiateManifest(m *manifest.Manifest, buildPipeline, img.Platform, repos, - "kernel", + "kernel-uek", img.Product, img.OSVersion, img.Preview, diff --git a/vendor/github.com/osbuild/images/pkg/image/anaconda_tar_installer.go b/vendor/github.com/osbuild/images/pkg/image/anaconda_tar_installer.go index 5f3e330..236a695 100644 --- a/vendor/github.com/osbuild/images/pkg/image/anaconda_tar_installer.go +++ b/vendor/github.com/osbuild/images/pkg/image/anaconda_tar_installer.go @@ -114,7 +114,7 @@ func (img *AnacondaTarInstaller) InstantiateManifest(m *manifest.Manifest, buildPipeline, img.Platform, repos, - "kernel", + "kernel-uek", img.Product, img.OSVersion, img.Preview, diff --git a/vendor/github.com/osbuild/images/pkg/image/ostree_simplified_installer.go b/vendor/github.com/osbuild/images/pkg/image/ostree_simplified_installer.go index 253c8c1..451d2d0 100644 --- a/vendor/github.com/osbuild/images/pkg/image/ostree_simplified_installer.go +++ b/vendor/github.com/osbuild/images/pkg/image/ostree_simplified_installer.go @@ -86,7 +86,7 @@ func (img *OSTreeSimplifiedInstaller) InstantiateManifest(m *manifest.Manifest, buildPipeline, img.Platform, repos, - "kernel", + "kernel-uek", img.Product, img.OSVersion, ) -- 2.47.1