diff --git a/internal/distro/rhel8/bare_metal.go b/internal/distro/rhel8/bare_metal.go index d1fc54d2d..04511b139 100644 --- a/internal/distro/rhel8/bare_metal.go +++ b/internal/distro/rhel8/bare_metal.go @@ -13,19 +13,15 @@ func imageInstaller() imageType { filename: "installer.iso", mimeType: "application/x-iso9660-image", packageSets: map[string]packageSetFunc{ - buildPkgsKey: anacondaBuildPackageSet, osPkgsKey: bareMetalPackageSet, installerPkgsKey: anacondaPackageSet, }, - packageSetChains: map[string][]string{ - osPkgsKey: {osPkgsKey, blueprintPkgsKey}, - }, rpmOstree: false, bootISO: true, bootable: true, - pipelines: imageInstallerPipelines, + image: imageInstallerImage, buildPipelines: []string{"build"}, - payloadPipelines: []string{"os", "anaconda-tree", "bootiso-tree", "bootiso"}, + payloadPipelines: []string{"anaconda-tree", "rootfs-image", "efiboot-tree", "os", "bootiso-tree", "bootiso"}, exports: []string{"bootiso"}, } } diff --git a/internal/distro/rhel8/images.go b/internal/distro/rhel8/images.go index 18d021739..4bf1daefa 100644 --- a/internal/distro/rhel8/images.go +++ b/internal/distro/rhel8/images.go @@ -1,6 +1,7 @@ package rhel8 import ( + "fmt" "math/rand" "github.com/osbuild/osbuild-composer/internal/blueprint" @@ -201,6 +202,44 @@ func liveImage(workload workload.Workload, return img, nil } +func imageInstallerImage(workload workload.Workload, + t *imageType, + customizations *blueprint.Customizations, + options distro.ImageOptions, + packageSets map[string]rpmmd.PackageSet, + containers []container.Spec, + rng *rand.Rand) (image.ImageKind, error) { + + img := image.NewImageInstaller() + + img.Platform = t.platform + img.Workload = workload + img.OSCustomizations = osCustomizations(t, packageSets[osPkgsKey], options, containers, customizations) + img.ExtraBasePackages = packageSets[installerPkgsKey] + img.Users = users.UsersFromBP(customizations.GetUsers()) + img.Groups = users.GroupsFromBP(customizations.GetGroups()) + + img.AdditionalDracutModules = []string{"prefixdevname", "prefixdevname-tools"} + img.AdditionalAnacondaModules = []string{"org.fedoraproject.Anaconda.Modules.Users"} + + img.SquashfsCompression = "xz" + + // put the kickstart file in the root of the iso + img.ISORootKickstart = true + + d := t.arch.distro + + img.ISOLabelTempl = d.isolabelTmpl + img.Product = d.product + img.OSName = "redhat" + img.OSVersion = d.osVersion + img.Release = fmt.Sprintf("%s %s", d.product, d.osVersion) + + img.Filename = t.Filename() + + return img, nil +} + func tarImage(workload workload.Workload, t *imageType, customizations *blueprint.Customizations, diff --git a/internal/distro/rhel8/pipelines.go b/internal/distro/rhel8/pipelines.go index ca8e7a9cf..97809cb4b 100644 --- a/internal/distro/rhel8/pipelines.go +++ b/internal/distro/rhel8/pipelines.go @@ -56,46 +56,6 @@ func edgeInstallerPipelines(t *imageType, customizations *blueprint.Customizatio return pipelines, nil } -func imageInstallerPipelines(t *imageType, customizations *blueprint.Customizations, options distro.ImageOptions, repos []rpmmd.RepoConfig, packageSetSpecs map[string][]rpmmd.PackageSpec, containers []container.Spec, rng *rand.Rand) ([]osbuild.Pipeline, error) { - pipelines := make([]osbuild.Pipeline, 0) - pipelines = append(pipelines, *buildPipeline(repos, packageSetSpecs[buildPkgsKey], t.arch.distro.runner.String())) - - treePipeline, err := osPipeline(t, repos, packageSetSpecs[osPkgsKey], containers, customizations, options, nil) - if err != nil { - return nil, err - } - pipelines = append(pipelines, *treePipeline) - - var kernelPkg *rpmmd.PackageSpec - installerPackages := packageSetSpecs[installerPkgsKey] - for _, pkg := range installerPackages { - if pkg.Name == "kernel" { - // Implicit memory alasing doesn't couse any bug in this case - /* #nosec G601 */ - kernelPkg = &pkg - break - } - } - if kernelPkg == nil { - return nil, fmt.Errorf("kernel package not found in installer package set") - } - kernelVer := fmt.Sprintf("%s-%s.%s", kernelPkg.Version, kernelPkg.Release, kernelPkg.Arch) - - tarPath := "/liveimg.tar" - tarPayloadStages := []*osbuild.Stage{osbuild.NewTarStage(&osbuild.TarStageOptions{Filename: tarPath}, treePipeline.Name)} - kickstartOptions, err := osbuild.NewKickstartStageOptions(kspath, makeISORootPath(tarPath), users.UsersFromBP(customizations.GetUsers()), users.GroupsFromBP(customizations.GetGroups()), "", "", "rhel") - if err != nil { - return nil, err - } - archName := t.Arch().Name() - d := t.arch.distro - pipelines = append(pipelines, *anacondaTreePipeline(repos, installerPackages, kernelVer, archName, d.product, d.osVersion, "BaseOS", true)) - isolabel := fmt.Sprintf(d.isolabelTmpl, archName) - pipelines = append(pipelines, *bootISOTreePipeline(kernelVer, archName, d.vendor, d.product, d.osVersion, isolabel, kickstartOptions, tarPayloadStages)) - pipelines = append(pipelines, *bootISOPipeline(t.Filename(), d.isolabelTmpl, t.Arch().Name(), t.Arch().Name() == "x86_64")) - return pipelines, nil -} - func edgeCorePipelines(t *imageType, customizations *blueprint.Customizations, options distro.ImageOptions, repos []rpmmd.RepoConfig, packageSetSpecs map[string][]rpmmd.PackageSpec, containers []container.Spec) ([]osbuild.Pipeline, error) { pipelines := make([]osbuild.Pipeline, 0) pipelines = append(pipelines, *buildPipeline(repos, packageSetSpecs[buildPkgsKey], t.arch.distro.runner.String()))