distro: add root filesystem support

This commit is contained in:
Gianluca Zuccarelli 2021-07-08 13:54:25 +01:00 committed by Tom Gundersen
parent d0e4558b2b
commit f4ee0bfabf
6 changed files with 104 additions and 0 deletions

View file

@ -289,6 +289,23 @@ func (t *imageType) pipeline(c *blueprint.Customizations, options distro.ImageOp
return nil, fmt.Errorf("kernel boot parameter customizations are not supported for ostree types")
}
mountpoints := c.GetFilesystems()
if mountpoints != nil && t.rpmOstree {
return nil, fmt.Errorf("Custom mountpoints are not supported for ostree types")
}
invalidMountpoints := []string{}
for _, m := range mountpoints {
if m.Mountpoint != "/" {
invalidMountpoints = append(invalidMountpoints, m.Mountpoint)
}
}
if len(invalidMountpoints) > 0 {
return nil, fmt.Errorf("The following custom mountpoints are not supported %+q", invalidMountpoints)
}
p := &osbuild.Pipeline{}
p.SetBuild(t.buildPipeline(repos, *t.arch, buildPackageSpecs), "org.osbuild.fedora33")

View file

@ -288,6 +288,26 @@ func (t *imageType) pipeline(c *blueprint.Customizations, options distro.ImageOp
return nil, fmt.Errorf("kernel boot parameter customizations are not supported for ostree types")
}
mountpoints := c.GetFilesystems()
if mountpoints != nil && t.rpmOstree {
return nil, fmt.Errorf("Custom mountpoints are not supported for ostree types")
}
// create a slice for storing
// invalid mountpoints in order to return
// a detailed message
invalidMountpoints := []string{}
for _, m := range mountpoints {
if m.Mountpoint != "/" {
invalidMountpoints = append(invalidMountpoints, m.Mountpoint)
}
}
if len(invalidMountpoints) > 0 {
return nil, fmt.Errorf("The following custom mountpoints are not supported %+q", invalidMountpoints)
}
p := &osbuild.Pipeline{}
p.SetBuild(t.buildPipeline(repos, *t.arch, buildPackageSpecs), "org.osbuild.rhel82")

View file

@ -317,6 +317,23 @@ func (t *imageType) pipeline(c *blueprint.Customizations, options distro.ImageOp
return nil, fmt.Errorf("kernel boot parameter customizations are not supported for ostree types")
}
mountpoints := c.GetFilesystems()
if mountpoints != nil && t.rpmOstree {
return nil, fmt.Errorf("Custom mountpoints are not supported for ostree types")
}
invalidMountpoints := []string{}
for _, m := range mountpoints {
if m.Mountpoint != "/" {
invalidMountpoints = append(invalidMountpoints, m.Mountpoint)
}
}
if len(invalidMountpoints) > 0 {
return nil, fmt.Errorf("The following custom mountpoints are not supported %+q", invalidMountpoints)
}
var pt *disk.PartitionTable
if t.partitionTableGenerator != nil {
table := t.partitionTableGenerator(options, t.arch, rng)

View file

@ -206,6 +206,23 @@ func (t *imageTypeS2) pipelines(customizations *blueprint.Customizations, option
return nil, fmt.Errorf("kernel boot parameter customizations are not supported for ostree types")
}
mountpoints := customizations.GetFilesystems()
if mountpoints != nil && t.rpmOstree {
return nil, fmt.Errorf("Custom mountpoints are not supported for ostree types")
}
invalidMountpoints := []string{}
for _, m := range mountpoints {
if m.Mountpoint != "/" {
invalidMountpoints = append(invalidMountpoints, m.Mountpoint)
}
}
if len(invalidMountpoints) > 0 {
return nil, fmt.Errorf("The following custom mountpoints are not supported %+q", invalidMountpoints)
}
pipelines := make([]osbuild.Pipeline, 0)
pipelines = append(pipelines, *t.buildPipeline(repos, packageSetSpecs["build-packages"]))

View file

@ -368,6 +368,24 @@ func (t *imageType) checkOptions(customizations *blueprint.Customizations, optio
return fmt.Errorf("kernel boot parameter customizations are not supported for ostree types")
}
mountpoints := customizations.GetFilesystems()
if mountpoints != nil && t.rpmOstree {
return fmt.Errorf("Custom mountpoints are not supported for ostree types")
}
// only allow root mountpoint for the time-being
invalidMountpoints := []string{}
for _, m := range mountpoints {
if m.Mountpoint != "/" {
invalidMountpoints = append(invalidMountpoints, m.Mountpoint)
}
}
if len(invalidMountpoints) > 0 {
return fmt.Errorf("The following custom mountpoints are not supported %+q", invalidMountpoints)
}
return nil
}

View file

@ -288,6 +288,21 @@ func sources(packages []rpmmd.PackageSpec) *osbuild.Sources {
}
func (t *imageType) pipeline(c *blueprint.Customizations, options distro.ImageOptions, repos []rpmmd.RepoConfig, packageSpecs, buildPackageSpecs []rpmmd.PackageSpec, rng *rand.Rand) (*osbuild.Pipeline, error) {
mountpoints := c.GetFilesystems()
// only allow root mountpoint for the time-being
invalidMountpoints := []string{}
for _, m := range mountpoints {
if m.Mountpoint != "/" {
invalidMountpoints = append(invalidMountpoints, m.Mountpoint)
}
}
if len(invalidMountpoints) > 0 {
return nil, fmt.Errorf("The following custom mountpoints are not supported %+q", invalidMountpoints)
}
var pt *disk.PartitionTable
if t.partitionTableGenerator != nil {
table := t.partitionTableGenerator(options, t.arch, rng)