manifest: support specifying squashfs compression for ISOs

Add support for specifying the squashfs compression method for ISOTree
pipelines from the caller.
Build Fedora ISOs with lz4 compression and RHEL with xz.
This commit is contained in:
Achilleas Koutsou 2022-11-22 18:37:21 +01:00 committed by Christian Kellner
parent cb0280c8c9
commit 5d55ccf109
5 changed files with 33 additions and 3 deletions

View file

@ -224,6 +224,8 @@ func imageInstallerImage(workload workload.Workload,
img.Users = users.UsersFromBP(customizations.GetUsers())
img.Groups = users.GroupsFromBP(customizations.GetGroups())
img.SquashfsCompression = "lz4"
d := t.arch.distro
img.ISOLabelTempl = d.isolabelTmpl
@ -323,6 +325,8 @@ func iotInstallerImage(workload workload.Workload,
img.Users = users.UsersFromBP(customizations.GetUsers())
img.Groups = users.GroupsFromBP(customizations.GetGroups())
img.SquashfsCompression = "lz4"
img.ISOLabelTempl = d.isolabelTmpl
img.Product = d.product
img.Variant = "IoT"

View file

@ -270,6 +270,8 @@ func edgeInstallerImage(workload workload.Workload,
img.Users = users.UsersFromBP(customizations.GetUsers())
img.Groups = users.GroupsFromBP(customizations.GetGroups())
img.SquashfsCompression = "xz"
img.ISOLabelTempl = d.isolabelTmpl
img.Product = d.product
img.Variant = "edge"
@ -342,6 +344,8 @@ func imageInstallerImage(workload workload.Workload,
img.Users = users.UsersFromBP(customizations.GetUsers())
img.Groups = users.GroupsFromBP(customizations.GetGroups())
img.SquashfsCompression = "xz"
d := t.arch.distro
img.ISOLabelTempl = d.isolabelTmpl

View file

@ -27,6 +27,8 @@ type ImageInstaller struct {
Users []users.User
Groups []users.Group
SquashfsCompression string
ISOLabelTempl string
Product string
Variant string
@ -120,6 +122,8 @@ func (img *ImageInstaller) InstantiateManifest(m *manifest.Manifest,
isoTreePipeline.Users = img.Users
isoTreePipeline.Groups = img.Groups
isoTreePipeline.SquashfsCompression = img.SquashfsCompression
isoTreePipeline.OSPipeline = osPipeline
isoTreePipeline.KernelOpts = img.AdditionalKernelOpts

View file

@ -22,6 +22,8 @@ type OSTreeInstaller struct {
Users []users.User
Groups []users.Group
SquashfsCompression string
ISOLabelTempl string
Product string
Variant string
@ -101,6 +103,9 @@ func (img *OSTreeInstaller) InstantiateManifest(m *manifest.Manifest,
isoTreePipeline.OSName = img.OSName
isoTreePipeline.Users = img.Users
isoTreePipeline.Groups = img.Groups
isoTreePipeline.SquashfsCompression = img.SquashfsCompression
isoTreePipeline.KSPath = "/ostree.ks"
isoTreePipeline.OSTree = &img.Commit

View file

@ -32,6 +32,8 @@ type ISOTree struct {
KSPath string
isoLabel string
SquashfsCompression string
OSPipeline *OS
OSTree *ostree.CommitSpec
@ -143,10 +145,21 @@ func (p *ISOTree) serialize() osbuild.Pipeline {
squashfsOptions := osbuild.SquashfsStageOptions{
Filename: "images/install.img",
Compression: osbuild.FSCompression{
Method: "lz4",
},
}
if p.SquashfsCompression != "" {
squashfsOptions.Compression.Method = p.SquashfsCompression
} else {
// default to xz if not specified
squashfsOptions.Compression.Method = "xz"
}
if squashfsOptions.Compression.Method == "xz" {
squashfsOptions.Compression.Options = &osbuild.FSCompressionOptions{
BCJ: osbuild.BCJOption(p.anacondaPipeline.platform.GetArch().String()),
}
}
squashfsStage := osbuild.NewSquashfsStage(&squashfsOptions, p.rootfsPipeline.Name())
pipeline.AddStage(squashfsStage)