debian-forge-composer/internal/osbuild2/device.go
Achilleas Koutsou 745443181e osbuild2: remove stage-specific device types
Devices unlike stage options, shouldn't be stage specific.
There is only one type of device so far, the loopback device, which
is already defined as a separate type.

The top level Devices type is simply an alias to a Device map.

The mkfs stages require a single device with a specific key ("device").
These stages accept only one device in their NewStage() function for
convenience and create the Stage struct with the required key.

The zipl.inst stage requires a device labeled 'disk' as well as the rest
of the devices that correspond to each partition. The disk device is
passed to the New stage function separately and added to the Stage
devices with the required key.

Signed-off-by: Achilleas Koutsou <achilleas@koutsou.net>
2021-08-21 13:39:10 +02:00

12 lines
213 B
Go

package osbuild2
type Devices map[string]Device
type Device struct {
Type string `json:"type"`
Options DeviceOptions `json:"options,omitempty"`
}
type DeviceOptions interface {
isDeviceOptions()
}