osbuild2: GenCopyFSTreeOptions takes filename not device

The only thing we needed from the passed in device was the filename,
so just pass in that directly.

Co-Authored-By: Achilleas Koutsou <achilleas@koutsou.net>
This commit is contained in:
Christian Kellner 2022-02-11 11:30:44 +00:00 committed by Tom Gundersen
parent a2e1fcc451
commit d48d6f22e1
5 changed files with 9 additions and 15 deletions

View file

@ -978,7 +978,7 @@ func simplifiedInstallerBootISOTreePipeline(archivePipelineName, kver string) *o
inputName := "root-tree"
copyInputs := osbuild.NewCopyStagePipelineTreeInputs(inputName, "efiboot-tree")
copyOptions, copyDevices, copyMounts := osbuild.GenCopyFSTreeOptions(inputName, "efiboot-tree", &pt, loopback)
copyOptions, copyDevices, copyMounts := osbuild.GenCopyFSTreeOptions(inputName, "efiboot-tree", filename, &pt)
p.AddStage(osbuild.NewCopyStage(copyOptions, copyInputs, copyDevices, copyMounts))
inputName = "coi"
@ -1232,7 +1232,7 @@ func liveImagePipeline(inputPipelineName string, outputFilename string, pt *disk
}
inputName := "root-tree"
copyOptions, copyDevices, copyMounts := osbuild.GenCopyFSTreeOptions(inputName, inputPipelineName, pt, loopback)
copyOptions, copyDevices, copyMounts := osbuild.GenCopyFSTreeOptions(inputName, inputPipelineName, outputFilename, pt)
copyInputs := osbuild.NewCopyStagePipelineTreeInputs(inputName, inputPipelineName)
p.AddStage(osbuild.NewCopyStage(copyOptions, copyInputs, copyDevices, copyMounts))
p.AddStage(bootloaderInstStage(outputFilename, pt, arch, kernelVer, copyDevices, copyMounts, loopback))

View file

@ -716,7 +716,7 @@ func simplifiedInstallerBootISOTreePipeline(archivePipelineName, kver string) *o
inputName := "root-tree"
copyInputs := osbuild.NewCopyStagePipelineTreeInputs(inputName, "efiboot-tree")
copyOptions, copyDevices, copyMounts := osbuild.GenCopyFSTreeOptions(inputName, "efiboot-tree", &pt, loopback)
copyOptions, copyDevices, copyMounts := osbuild.GenCopyFSTreeOptions(inputName, "efiboot-tree", filename, &pt)
p.AddStage(osbuild.NewCopyStage(copyOptions, copyInputs, copyDevices, copyMounts))
inputName = "coi"
@ -956,7 +956,7 @@ func liveImagePipeline(inputPipelineName string, outputFilename string, pt *disk
}
inputName := "root-tree"
copyOptions, copyDevices, copyMounts := osbuild.GenCopyFSTreeOptions(inputName, inputPipelineName, pt, loopback)
copyOptions, copyDevices, copyMounts := osbuild.GenCopyFSTreeOptions(inputName, inputPipelineName, outputFilename, pt)
copyInputs := osbuild.NewCopyStagePipelineTreeInputs(inputName, inputPipelineName)
p.AddStage(osbuild.NewCopyStage(copyOptions, copyInputs, copyDevices, copyMounts))
p.AddStage(bootloaderInstStage(outputFilename, pt, arch, kernelVer, copyDevices, copyMounts, loopback))

View file

@ -716,7 +716,7 @@ func simplifiedInstallerBootISOTreePipeline(archivePipelineName, kver string, rn
inputName := "root-tree"
copyInputs := osbuild.NewCopyStagePipelineTreeInputs(inputName, "efiboot-tree")
copyOptions, copyDevices, copyMounts := osbuild.GenCopyFSTreeOptions(inputName, "efiboot-tree", &pt, loopback)
copyOptions, copyDevices, copyMounts := osbuild.GenCopyFSTreeOptions(inputName, "efiboot-tree", filename, &pt)
p.AddStage(osbuild.NewCopyStage(copyOptions, copyInputs, copyDevices, copyMounts))
inputName = "coi"
@ -956,7 +956,7 @@ func liveImagePipeline(inputPipelineName string, outputFilename string, pt *disk
}
inputName := "root-tree"
copyOptions, copyDevices, copyMounts := osbuild.GenCopyFSTreeOptions(inputName, inputPipelineName, pt, loopback)
copyOptions, copyDevices, copyMounts := osbuild.GenCopyFSTreeOptions(inputName, inputPipelineName, outputFilename, pt)
copyInputs := osbuild.NewCopyStagePipelineTreeInputs(inputName, inputPipelineName)
p.AddStage(osbuild.NewCopyStage(copyOptions, copyInputs, copyDevices, copyMounts))
p.AddStage(bootloaderInstStage(outputFilename, pt, arch, kernelVer, copyDevices, copyMounts, loopback))

View file

@ -1047,7 +1047,7 @@ func liveImagePipeline(inputPipelineName string, outputFilename string, pt *disk
}
inputName := "root-tree"
copyOptions, copyDevices, copyMounts := osbuild.GenCopyFSTreeOptions(inputName, inputPipelineName, pt, loopback)
copyOptions, copyDevices, copyMounts := osbuild.GenCopyFSTreeOptions(inputName, inputPipelineName, outputFilename, pt)
copyInputs := osbuild.NewCopyStagePipelineTreeInputs(inputName, inputPipelineName)
p.AddStage(osbuild.NewCopyStage(copyOptions, copyInputs, copyDevices, copyMounts))
p.AddStage(bootloaderInstStage(outputFilename, pt, arch, kernelVer, copyDevices, copyMounts, loopback))

View file

@ -77,22 +77,16 @@ func NewCopyStagePipelineTreeInputs(inputName, inputPipeline string) *CopyStageI
// GenCopyFSTreeOptions creates the options, inputs, devices, and mounts properties
// for an org.osbuild.copy stage for a given source tree using a partition
// table description to define the mounts
func GenCopyFSTreeOptions(inputName, inputPipeline string, pt *disk.PartitionTable, device *Device) (
func GenCopyFSTreeOptions(inputName, inputPipeline, filename string, pt *disk.PartitionTable) (
*CopyStageOptions,
*Devices,
*Mounts,
) {
// assume loopback device for simplicity since it's the only one currently supported
// panic if the conversion fails
devOptions, ok := device.Options.(*LoopbackDeviceOptions)
if !ok {
panic("GenCopyStageOptions: failed to convert device options to loopback options")
}
devices := make(map[string]Device, len(pt.Partitions))
mounts := make([]Mount, 0, len(pt.Partitions))
genMounts := func(mnt disk.Mountable, path []disk.Entity) error {
stageDevices, name := getDevices(path, devOptions.Filename)
stageDevices, name := getDevices(path, filename)
mountpoint := mnt.GetMountpoint()
var mount *Mount