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.
85 lines
1.5 KiB
Go
85 lines
1.5 KiB
Go
package disk
|
|
|
|
import (
|
|
"math/rand"
|
|
|
|
"github.com/google/uuid"
|
|
)
|
|
|
|
// Filesystem related functions
|
|
type Filesystem struct {
|
|
Type string
|
|
// ID of the filesystem, vfat doesn't use traditional UUIDs, therefore this
|
|
// is just a string.
|
|
UUID string
|
|
Label string
|
|
Mountpoint string
|
|
// The fourth field of fstab(5); fs_mntops
|
|
FSTabOptions string
|
|
// The fifth field of fstab(5); fs_freq
|
|
FSTabFreq uint64
|
|
// The sixth field of fstab(5); fs_passno
|
|
FSTabPassNo uint64
|
|
}
|
|
|
|
func (fs *Filesystem) IsContainer() bool {
|
|
return false
|
|
}
|
|
|
|
// Clone the filesystem structure
|
|
func (fs *Filesystem) Clone() Entity {
|
|
if fs == nil {
|
|
return nil
|
|
}
|
|
|
|
return &Filesystem{
|
|
Type: fs.Type,
|
|
UUID: fs.UUID,
|
|
Label: fs.Label,
|
|
Mountpoint: fs.Mountpoint,
|
|
FSTabOptions: fs.FSTabOptions,
|
|
FSTabFreq: fs.FSTabFreq,
|
|
FSTabPassNo: fs.FSTabPassNo,
|
|
}
|
|
}
|
|
|
|
func (fs *Filesystem) GetMountpoint() string {
|
|
if fs == nil {
|
|
return ""
|
|
}
|
|
return fs.Mountpoint
|
|
}
|
|
|
|
func (fs *Filesystem) GetFSType() string {
|
|
if fs == nil {
|
|
return ""
|
|
}
|
|
return fs.Type
|
|
}
|
|
|
|
func (fs *Filesystem) GetFSSpec() FSSpec {
|
|
if fs == nil {
|
|
return FSSpec{}
|
|
}
|
|
return FSSpec{
|
|
UUID: fs.UUID,
|
|
Label: fs.Label,
|
|
}
|
|
}
|
|
|
|
func (fs *Filesystem) GetFSTabOptions() FSTabOptions {
|
|
if fs == nil {
|
|
return FSTabOptions{}
|
|
}
|
|
return FSTabOptions{
|
|
MntOps: fs.FSTabOptions,
|
|
Freq: fs.FSTabFreq,
|
|
PassNo: fs.FSTabPassNo,
|
|
}
|
|
}
|
|
|
|
func (fs *Filesystem) GenUUID(rng *rand.Rand) {
|
|
if fs.UUID == "" {
|
|
fs.UUID = uuid.Must(newRandomUUIDFromReader(rng)).String()
|
|
}
|
|
}
|