image-installer: move conditionals into distro
Try and keep `image/image_installer.go` as clean as possible and instead pass any customizations one layer up.
This commit is contained in:
parent
d4d100383e
commit
0e2f8bb115
2 changed files with 18 additions and 26 deletions
|
|
@ -187,6 +187,18 @@ func imageInstallerImage(workload workload.Workload,
|
|||
|
||||
img := image.NewImageInstaller()
|
||||
|
||||
// Enable anaconda-webui for Fedora > 38
|
||||
distro := t.Arch().Distro()
|
||||
if strings.HasPrefix(distro.Name(), "fedora") && !common.VersionLessThan(distro.Releasever(), "38") {
|
||||
img.AdditionalAnacondaModules = []string{
|
||||
"org.fedoraproject.Anaconda.Modules.Security",
|
||||
"org.fedoraproject.Anaconda.Modules.Users",
|
||||
"org.fedoraproject.Anaconda.Modules.Timezone",
|
||||
"org.fedoraproject.Anaconda.Modules.Localization",
|
||||
}
|
||||
img.AdditionalKernelOpts = []string{"inst.webui", "inst.webui.remote"}
|
||||
}
|
||||
|
||||
img.Platform = t.platform
|
||||
img.OSCustomizations = osCustomizations(t, packageSets[osPkgsKey], customizations)
|
||||
img.ExtraBasePackages = packageSets[installerPkgsKey]
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ package image
|
|||
import (
|
||||
"fmt"
|
||||
"math/rand"
|
||||
"strconv"
|
||||
|
||||
"github.com/osbuild/osbuild-composer/internal/artifact"
|
||||
"github.com/osbuild/osbuild-composer/internal/common"
|
||||
|
|
@ -36,6 +35,9 @@ type ImageInstaller struct {
|
|||
Release string
|
||||
|
||||
Filename string
|
||||
|
||||
AdditionalKernelOpts []string
|
||||
AdditionalAnacondaModules []string
|
||||
}
|
||||
|
||||
func NewImageInstaller() *ImageInstaller {
|
||||
|
|
@ -51,14 +53,6 @@ func (img *ImageInstaller) InstantiateManifest(m *manifest.Manifest,
|
|||
buildPipeline := manifest.NewBuild(m, runner, repos)
|
||||
buildPipeline.Checkpoint()
|
||||
|
||||
version, err := strconv.Atoi(img.OSVersion)
|
||||
|
||||
if err != nil {
|
||||
panic("cannot convert version to int: " + err.Error())
|
||||
}
|
||||
|
||||
useWebUi := img.OSName == "fedora" && version >= 38
|
||||
|
||||
anacondaPipeline := manifest.NewAnaconda(m,
|
||||
buildPipeline,
|
||||
img.Platform,
|
||||
|
|
@ -77,15 +71,7 @@ func (img *ImageInstaller) InstantiateManifest(m *manifest.Manifest,
|
|||
anacondaPipeline.Variant = img.Variant
|
||||
anacondaPipeline.Biosdevname = (img.Platform.GetArch() == platform.ARCH_X86_64)
|
||||
anacondaPipeline.InteractiveDefaults = interactiveDefaults
|
||||
|
||||
if useWebUi {
|
||||
anacondaPipeline.AdditionalModules = []string{
|
||||
"org.fedoraproject.Anaconda.Modules.Security",
|
||||
"org.fedoraproject.Anaconda.Modules.Users",
|
||||
"org.fedoraproject.Anaconda.Modules.Timezone",
|
||||
"org.fedoraproject.Anaconda.Modules.Localization",
|
||||
}
|
||||
}
|
||||
anacondaPipeline.AdditionalModules = img.AdditionalAnacondaModules
|
||||
|
||||
anacondaPipeline.Checkpoint()
|
||||
|
||||
|
|
@ -114,10 +100,7 @@ func (img *ImageInstaller) InstantiateManifest(m *manifest.Manifest,
|
|||
bootTreePipeline.Platform = img.Platform
|
||||
bootTreePipeline.UEFIVendor = img.Platform.GetUEFIVendor()
|
||||
bootTreePipeline.ISOLabel = isoLabel
|
||||
|
||||
if useWebUi {
|
||||
bootTreePipeline.KernelOpts = []string{"inst.webui", "inst.webui.remote"}
|
||||
}
|
||||
bootTreePipeline.KernelOpts = img.AdditionalKernelOpts
|
||||
|
||||
osPipeline := manifest.NewOS(m, buildPipeline, img.Platform, repos)
|
||||
osPipeline.OSCustomizations = img.OSCustomizations
|
||||
|
|
@ -137,10 +120,7 @@ func (img *ImageInstaller) InstantiateManifest(m *manifest.Manifest,
|
|||
isoTreePipeline.Groups = img.Groups
|
||||
|
||||
isoTreePipeline.OSPipeline = osPipeline
|
||||
|
||||
if useWebUi {
|
||||
isoTreePipeline.KernelOpts = []string{"inst.webui", "inst.webui.remote"}
|
||||
}
|
||||
isoTreePipeline.KernelOpts = img.AdditionalKernelOpts
|
||||
|
||||
isoPipeline := manifest.NewISO(m, buildPipeline, isoTreePipeline)
|
||||
isoPipeline.Filename = img.Filename
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue