Remove all the internal package that are now in the github.com/osbuild/images package and vendor it. A new function in internal/blueprint/ converts from an osbuild-composer blueprint to an images blueprint. This is necessary for keeping the blueprint implementation in both packages. In the future, the images package will change the blueprint (and most likely rename it) and it will only be part of the osbuild-composer internals and interface. The Convert() function will be responsible for converting the blueprint into the new configuration object.
75 lines
1.7 KiB
Go
75 lines
1.7 KiB
Go
package manifest
|
|
|
|
import (
|
|
"github.com/osbuild/images/pkg/artifact"
|
|
"github.com/osbuild/images/pkg/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(Distro) []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)
|
|
}
|