From aec3ef416178ac0f591669c86853e99f026bd8c0 Mon Sep 17 00:00:00 2001 From: Achilleas Koutsou Date: Fri, 23 Sep 2022 15:28:01 +0200 Subject: [PATCH] image: update ostree installer to use new pipelines Fedora iot-installer now uses the new ostree installer pipelines that no longer use the bootiso.mono stage. --- internal/distro/fedora/distro.go | 2 +- internal/image/ostree_installer.go | 40 +++++++++++++++++++++++++++--- 2 files changed, 37 insertions(+), 5 deletions(-) diff --git a/internal/distro/fedora/distro.go b/internal/distro/fedora/distro.go index dd7f44ff0..ac89a2949 100644 --- a/internal/distro/fedora/distro.go +++ b/internal/distro/fedora/distro.go @@ -126,7 +126,7 @@ var ( bootISO: true, image: iotInstallerImage, buildPipelines: []string{"build"}, - payloadPipelines: []string{"anaconda-tree", "bootiso-tree", "bootiso"}, + payloadPipelines: []string{"anaconda-tree", "rootfs-image", "efiboot-tree", "bootiso-tree"}, exports: []string{"bootiso"}, } diff --git a/internal/image/ostree_installer.go b/internal/image/ostree_installer.go index 823360cc3..7dffd217d 100644 --- a/internal/image/ostree_installer.go +++ b/internal/image/ostree_installer.go @@ -1,9 +1,12 @@ package image import ( + "fmt" "math/rand" "github.com/osbuild/osbuild-composer/internal/artifact" + "github.com/osbuild/osbuild-composer/internal/common" + "github.com/osbuild/osbuild-composer/internal/disk" "github.com/osbuild/osbuild-composer/internal/manifest" "github.com/osbuild/osbuild-composer/internal/platform" "github.com/osbuild/osbuild-composer/internal/rpmmd" @@ -48,7 +51,8 @@ func (img *OSTreeInstaller) InstantiateManifest(m *manifest.Manifest, anacondaPipeline := manifest.NewAnaconda(m, buildPipeline, img.Platform, - repos, "kernel", + repos, + "kernel", img.Product, img.OSVersion) anacondaPipeline.ExtraPackages = img.ExtraBasePackages.Include @@ -58,15 +62,43 @@ func (img *OSTreeInstaller) InstantiateManifest(m *manifest.Manifest, anacondaPipeline.Biosdevname = (img.Platform.GetArch() == platform.ARCH_X86_64) anacondaPipeline.Checkpoint() + rootfsPartitionTable := &disk.PartitionTable{ + Size: 20 * common.MebiByte, + Partitions: []disk.Partition{ + { + Start: 0, + Size: 20 * common.MebiByte, + Payload: &disk.Filesystem{ + Type: "vfat", + Mountpoint: "/", + UUID: disk.NewVolIDFromRand(rng), + }, + }, + }, + } + + // TODO: replace isoLabelTmpl with more high-level properties + isoLabel := fmt.Sprintf(img.ISOLabelTempl, img.Platform.GetArch()) + + rootfsImagePipeline := manifest.NewISORootfsImg(m, buildPipeline, anacondaPipeline) + rootfsImagePipeline.Size = 4 * common.GibiByte + + bootTreePipeline := manifest.NewEFIBootTree(m, buildPipeline, anacondaPipeline) + bootTreePipeline.Platform = img.Platform + bootTreePipeline.UEFIVendor = img.Platform.GetUEFIVendor() + bootTreePipeline.KSPath = "/ostree.ks" + bootTreePipeline.ISOLabel = isoLabel + isoTreePipeline := manifest.NewISOTree(m, buildPipeline, anacondaPipeline, - nil, - nil, + rootfsImagePipeline, + bootTreePipeline, img.OSTreeCommit, img.OSTreeURL, img.OSTreeRef, - "") + isoLabel) + isoTreePipeline.PartitionTable = rootfsPartitionTable isoTreePipeline.Release = img.Release isoTreePipeline.OSName = img.OSName isoTreePipeline.Users = img.Users