Skip to content

Commit d5cb547

Browse files
committed
image: update for latest images API changes
The image.NewAnaconda*() functions take the platform/filename now.
1 parent 75782d2 commit d5cb547

File tree

1 file changed

+22
-26
lines changed

1 file changed

+22
-26
lines changed

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

Lines changed: 22 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import (
1717
"github.com/osbuild/images/pkg/customizations/anaconda"
1818
"github.com/osbuild/images/pkg/customizations/kickstart"
1919
"github.com/osbuild/images/pkg/disk"
20-
"github.com/osbuild/images/pkg/disk/partition"
2120
"github.com/osbuild/images/pkg/image"
2221
"github.com/osbuild/images/pkg/manifest"
2322
"github.com/osbuild/images/pkg/osbuild"
@@ -95,11 +94,32 @@ func manifestForISO(c *ManifestConfig, rng *rand.Rand) (*manifest.Manifest, erro
9594
Local: true,
9695
}
9796

97+
platform := &platform.Data{
98+
Arch: c.Architecture,
99+
ImageFormat: platform.FORMAT_ISO,
100+
UEFIVendor: c.SourceInfo.UEFIVendor,
101+
}
102+
switch c.Architecture {
103+
case arch.ARCH_X86_64:
104+
platform.BIOSPlatform = "i386-pc"
105+
case arch.ARCH_AARCH64:
106+
// aarch64 always uses UEFI, so let's enforce the vendor
107+
if c.SourceInfo.UEFIVendor == "" {
108+
return nil, fmt.Errorf("UEFI vendor must be set for aarch64 ISO")
109+
}
110+
case arch.ARCH_S390X:
111+
platform.ZiplSupport = true
112+
case arch.ARCH_PPC64LE:
113+
platform.BIOSPlatform = "powerpc-ieee1275"
114+
}
98115
// The ref is not needed and will be removed from the ctor later
99116
// in time
100-
img := image.NewAnacondaContainerInstaller(containerSource, "")
117+
img := image.NewAnacondaContainerInstaller(platform, "install.iso", containerSource, "")
101118
img.ContainerRemoveSignatures = true
102119
img.RootfsCompression = "zstd"
120+
if c.Architecture == arch.ARCH_X86_64 {
121+
img.InstallerCustomizations.ISOBoot = manifest.Grub2ISOBoot
122+
}
103123

104124
img.Product = c.SourceInfo.OSRelease.Name
105125
img.OSVersion = c.SourceInfo.OSRelease.VersionID
@@ -149,32 +169,8 @@ func manifestForISO(c *ManifestConfig, rng *rand.Rand) (*manifest.Manifest, erro
149169
}
150170
img.InstallerCustomizations.UseRHELLoraxTemplates = needsRHELLoraxTemplates(c.SourceInfo.OSRelease)
151171

152-
img.Platform = &platform.Data{
153-
Arch: c.Architecture,
154-
ImageFormat: platform.FORMAT_ISO,
155-
UEFIVendor: c.SourceInfo.UEFIVendor,
156-
}
157-
switch c.Architecture {
158-
case arch.ARCH_X86_64:
159-
img.Platform.(*platform.Data).BIOSPlatform = "i386-pc"
160-
img.InstallerCustomizations.ISOBoot = manifest.Grub2ISOBoot
161-
case arch.ARCH_AARCH64:
162-
// aarch64 always uses UEFI, so let's enforce the vendor
163-
if c.SourceInfo.UEFIVendor == "" {
164-
return nil, fmt.Errorf("UEFI vendor must be set for aarch64 ISO")
165-
}
166-
case arch.ARCH_S390X:
167-
img.Platform.(*platform.Data).ZiplSupport = true
168-
case arch.ARCH_PPC64LE:
169-
img.Platform.(*platform.Data).BIOSPlatform = "powerpc-ieee1275"
170-
case arch.ARCH_RISCV64:
171-
// nothing special needed
172-
default:
173-
return nil, fmt.Errorf("unsupported architecture %v", c.Architecture)
174-
}
175172
// see https://github.com/osbuild/bootc-image-builder/issues/733
176173
img.InstallerCustomizations.ISORootfsType = manifest.SquashfsRootfs
177-
img.Filename = "install.iso"
178174

179175
installRootfsType, err := disk.NewFSType(c.RootFSType)
180176
if err != nil {

0 commit comments

Comments
 (0)