diff --git a/internal/distro/rhel8/edge.go b/internal/distro/rhel8/edge.go index 586c647b5..2bfb4ea7b 100644 --- a/internal/distro/rhel8/edge.go +++ b/internal/distro/rhel8/edge.go @@ -65,21 +65,19 @@ func edgeOCIImgType(rd distribution) imageType { } func edgeRawImgType() imageType { it := imageType{ - name: "edge-raw-image", - nameAliases: []string{"rhel-edge-raw-image"}, - filename: "image.raw.xz", - mimeType: "application/xz", - packageSets: map[string]packageSetFunc{ - buildPkgsKey: edgeRawImageBuildPackageSet, - }, + name: "edge-raw-image", + nameAliases: []string{"rhel-edge-raw-image"}, + filename: "image.raw.xz", + mimeType: "application/xz", + packageSets: nil, defaultSize: 10 * common.GibiByte, rpmOstree: true, bootable: true, bootISO: false, - pipelines: edgeRawImagePipelines, + image: edgeRawImage, buildPipelines: []string{"build"}, - payloadPipelines: []string{"image-tree", "image", "archive"}, - exports: []string{"archive"}, + payloadPipelines: []string{"image-tree", "image", "xz"}, + exports: []string{"xz"}, basePartitionTables: edgeBasePartitionTables, } return it @@ -163,12 +161,6 @@ func edgeBuildPackageSet(t *imageType) rpmmd.PackageSet { }) } -func edgeRawImageBuildPackageSet(t *imageType) rpmmd.PackageSet { - return edgeBuildPackageSet(t).Append(edgeEncryptionBuildPackageSet(t)).Append( - bootPackageSet(t), - ) -} - // edge commit OS package set func edgeCommitPackageSet(t *imageType) rpmmd.PackageSet { ps := rpmmd.PackageSet{ diff --git a/internal/distro/rhel8/images.go b/internal/distro/rhel8/images.go index 8d6299a47..018916146 100644 --- a/internal/distro/rhel8/images.go +++ b/internal/distro/rhel8/images.go @@ -9,6 +9,7 @@ import ( "github.com/osbuild/osbuild-composer/internal/image" "github.com/osbuild/osbuild-composer/internal/manifest" "github.com/osbuild/osbuild-composer/internal/osbuild" + "github.com/osbuild/osbuild-composer/internal/ostree" "github.com/osbuild/osbuild-composer/internal/platform" "github.com/osbuild/osbuild-composer/internal/rpmmd" "github.com/osbuild/osbuild-composer/internal/users" @@ -217,3 +218,51 @@ func tarImage(workload workload.Workload, return img, nil } + +func edgeRawImage(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) { + + commit := ostree.CommitSpec{ + Ref: options.OSTree.ImageRef, + URL: options.OSTree.URL, + ContentURL: options.OSTree.ContentURL, + Checksum: options.OSTree.FetchChecksum, + } + img := image.NewOSTreeRawImage(commit) + + img.Users = users.UsersFromBP(customizations.GetUsers()) + img.Groups = users.GroupsFromBP(customizations.GetGroups()) + + // "rw" kernel option is required when /sysroot is mounted read-only to + // keep stateful parts of the filesystem writeable (/var/ and /etc) + img.KernelOptionsAppend = []string{"modprobe.blacklist=vc4", "rw"} + // TODO: move to image config + img.Keyboard = "us" + img.Locale = "C.UTF-8" + img.SysrootReadOnly = true + + img.Platform = t.platform + img.Workload = workload + img.Remote = ostree.Remote{ + Name: "rhel-edge", + URL: options.OSTree.URL, + ContentURL: options.OSTree.ContentURL, + } + img.OSName = "redhat" + + // TODO: move generation into LiveImage + pt, err := t.getPartitionTable(customizations.GetFilesystems(), options, rng) + if err != nil { + return nil, err + } + img.PartitionTable = pt + + img.Filename = t.Filename() + + return img, nil +} diff --git a/internal/distro/rhel8/pipelines.go b/internal/distro/rhel8/pipelines.go index 21e4d0397..549de1f36 100644 --- a/internal/distro/rhel8/pipelines.go +++ b/internal/distro/rhel8/pipelines.go @@ -159,23 +159,6 @@ func edgeImagePipelines(t *imageType, customizations *blueprint.Customizations, return pipelines, xzPipeline.Name, nil } -func edgeRawImagePipelines(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())) - - imgName := t.filename - - // create the raw image - imagePipelines, _, err := edgeImagePipelines(t, customizations, imgName, options, rng) - if err != nil { - return nil, err - } - - pipelines = append(pipelines, imagePipelines...) - - return pipelines, nil -} - func buildPipeline(repos []rpmmd.RepoConfig, buildPackageSpecs []rpmmd.PackageSpec, runner string) *osbuild.Pipeline { p := new(osbuild.Pipeline) p.Name = "build"