Support adding any pipeline as the tree for the ISO. The existing ISOTree (bootiso-tree) pipeline is specific to Anaconda. This change will allow the ISO (bootiso) pipeline to be created with any pipeline, so we can add an ISO tree that is specific to the CoreOS Installer.
75 lines
1.7 KiB
Go
75 lines
1.7 KiB
Go
package manifest
|
|
|
|
import (
|
|
"github.com/osbuild/osbuild-composer/internal/artifact"
|
|
"github.com/osbuild/osbuild-composer/internal/osbuild"
|
|
)
|
|
|
|
// An ISO represents a bootable ISO file created from an
|
|
// an existing ISOTreePipeline.
|
|
type ISO struct {
|
|
Base
|
|
ISOLinux bool
|
|
Filename string
|
|
|
|
treePipeline Pipeline
|
|
isoLabel string
|
|
}
|
|
|
|
func NewISO(m *Manifest,
|
|
buildPipeline *Build,
|
|
treePipeline Pipeline,
|
|
isoLabel string) *ISO {
|
|
p := &ISO{
|
|
Base: NewBase(m, "bootiso", buildPipeline),
|
|
treePipeline: treePipeline,
|
|
Filename: "image.iso",
|
|
isoLabel: isoLabel,
|
|
}
|
|
buildPipeline.addDependent(p)
|
|
m.addPipeline(p)
|
|
return p
|
|
}
|
|
|
|
func (p *ISO) getBuildPackages() []string {
|
|
return []string{
|
|
"isomd5sum",
|
|
"xorriso",
|
|
}
|
|
}
|
|
|
|
func (p *ISO) serialize() osbuild.Pipeline {
|
|
pipeline := p.Base.serialize()
|
|
|
|
pipeline.AddStage(osbuild.NewXorrisofsStage(xorrisofsStageOptions(p.Filename, p.isoLabel, p.ISOLinux), p.treePipeline.Name()))
|
|
pipeline.AddStage(osbuild.NewImplantisomd5Stage(&osbuild.Implantisomd5StageOptions{Filename: p.Filename}))
|
|
|
|
return pipeline
|
|
}
|
|
|
|
func xorrisofsStageOptions(filename, isolabel string, isolinux bool) *osbuild.XorrisofsStageOptions {
|
|
options := &osbuild.XorrisofsStageOptions{
|
|
Filename: filename,
|
|
VolID: isolabel,
|
|
SysID: "LINUX",
|
|
EFI: "images/efiboot.img",
|
|
ISOLevel: 3,
|
|
}
|
|
|
|
if isolinux {
|
|
options.Boot = &osbuild.XorrisofsBoot{
|
|
Image: "isolinux/isolinux.bin",
|
|
Catalog: "isolinux/boot.cat",
|
|
}
|
|
|
|
options.IsohybridMBR = "/usr/share/syslinux/isohdpfx.bin"
|
|
}
|
|
|
|
return options
|
|
}
|
|
|
|
func (p *ISO) Export() *artifact.Artifact {
|
|
p.Base.export = true
|
|
mimeType := "application/x-iso9660-image"
|
|
return artifact.New(p.Name(), p.Filename, &mimeType)
|
|
}
|