Skip to content

Commit c281050

Browse files
committed
legacy_iso: update lorax handling for images PR#1886
With the merge of osbuild/images#1886 the handling of the lorax templates changed. Ideally we would follow images here closer and use the distro YAML loader to load the metadata from images:data/distrodefs. But as a quick fix this just duplicates the logic we had before.
1 parent b315a23 commit c281050

File tree

1 file changed

+30
-3
lines changed

1 file changed

+30
-3
lines changed

bib/cmd/bootc-image-builder/legacy_iso.go

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -233,8 +233,34 @@ func labelForISO(os *osinfo.OSRelease, arch *arch.Arch) string {
233233
}
234234
}
235235

236-
func needsRHELLoraxTemplates(si osinfo.OSRelease) bool {
237-
return si.ID == "rhel" || slices.Contains(si.IDLike, "rhel") || si.VersionID == "eln"
236+
// from:https://github.com/osbuild/images/blob/v0.201.0/data/distrodefs/rhel-10/imagetypes.yaml#L169
237+
var loraxRhelTemplates = []string{
238+
"80-rhel/runtime-postinstall.tmpl",
239+
"80-rhel/runtime-cleanup.tmpl",
240+
}
241+
242+
// from:https://github.com/osbuild/images/blob/v0.201.0/data/distrodefs/fedora/imagetypes.yaml#L408
243+
var loraxFedoraTemplates = []string{
244+
"99-generic/runtime-postinstall.tmpl",
245+
"99-generic/runtime-cleanup.tmpl",
246+
}
247+
248+
func loraxTemplates(si osinfo.OSRelease) []string {
249+
switch {
250+
case si.ID == "rhel" || slices.Contains(si.IDLike, "rhel") || si.VersionID == "eln":
251+
return loraxRhelTemplates
252+
default:
253+
return loraxFedoraTemplates
254+
}
255+
}
256+
257+
func loraxTemplatePackage(si osinfo.OSRelease) string {
258+
switch {
259+
case si.ID == "rhel" || slices.Contains(si.IDLike, "rhel") || si.VersionID == "eln":
260+
return "lorax-templates-rhel"
261+
default:
262+
return "lorax-templates-generic"
263+
}
238264
}
239265

240266
func manifestForISO(c *ManifestConfig, rng *rand.Rand) (*manifest.Manifest, error) {
@@ -332,7 +358,8 @@ func manifestForISO(c *ManifestConfig, rng *rand.Rand) (*manifest.Manifest, erro
332358
img.Kickstart.OSTree = &kickstart.OSTree{
333359
OSName: "default",
334360
}
335-
img.InstallerCustomizations.UseRHELLoraxTemplates = needsRHELLoraxTemplates(c.SourceInfo.OSRelease)
361+
img.InstallerCustomizations.LoraxTemplates = loraxTemplates(c.SourceInfo.OSRelease)
362+
img.InstallerCustomizations.LoraxTemplatePackage = loraxTemplatePackage(c.SourceInfo.OSRelease)
336363

337364
// see https://github.com/osbuild/bootc-image-builder/issues/733
338365
img.InstallerCustomizations.ISORootfsType = manifest.SquashfsRootfs

0 commit comments

Comments
 (0)