diff --git a/internal/distro/distro.go b/internal/distro/distro.go index 622f322ec..c7341223e 100644 --- a/internal/distro/distro.go +++ b/internal/distro/distro.go @@ -97,6 +97,10 @@ type ImageType interface { // is 0 the default value for the format will be returned. Size(size uint64) uint64 + // Returns the corresponding partion type ("gpt", "dos") or "" the image type + // has no partition table. Only support for RHEL 8.5+ + PartitionType() string + // Returns the sets of packages to include and exclude when building the image. // Indexed by a string label. How each set is labeled and used depends on the // image type. diff --git a/internal/distro/fedora33/distro.go b/internal/distro/fedora33/distro.go index 2a766eaa3..ff986d102 100644 --- a/internal/distro/fedora33/distro.go +++ b/internal/distro/fedora33/distro.go @@ -192,6 +192,10 @@ func (t *imageType) Size(size uint64) uint64 { return size } +func (t *imageType) PartitionType() string { + return "" +} + func (t *imageType) Packages(bp blueprint.Blueprint) ([]string, []string) { packages := append(t.packages, bp.GetPackages()...) timezone, _ := bp.Customizations.GetTimezoneSettings() diff --git a/internal/distro/rhel8/distro.go b/internal/distro/rhel8/distro.go index b9caf1cd7..c1785492f 100644 --- a/internal/distro/rhel8/distro.go +++ b/internal/distro/rhel8/distro.go @@ -184,6 +184,10 @@ func (t *imageType) Size(size uint64) uint64 { return size } +func (t *imageType) PartitionType() string { + return "" +} + func (t *imageType) Packages(bp blueprint.Blueprint) ([]string, []string) { packages := append(t.packages, bp.GetPackages()...) timezone, _ := bp.Customizations.GetTimezoneSettings() diff --git a/internal/distro/rhel84/distro.go b/internal/distro/rhel84/distro.go index 2b8cf9ef3..4868565dd 100644 --- a/internal/distro/rhel84/distro.go +++ b/internal/distro/rhel84/distro.go @@ -215,6 +215,10 @@ func (t *imageType) Size(size uint64) uint64 { return size } +func (t *imageType) PartitionType() string { + return "" +} + func (t *imageType) Packages(bp blueprint.Blueprint) ([]string, []string) { packages := append(t.packages, bp.GetPackages()...) timezone, _ := bp.Customizations.GetTimezoneSettings() diff --git a/internal/distro/rhel84/distro_v2.go b/internal/distro/rhel84/distro_v2.go index 091d8f44b..73e184f85 100644 --- a/internal/distro/rhel84/distro_v2.go +++ b/internal/distro/rhel84/distro_v2.go @@ -68,6 +68,10 @@ func (t *imageTypeS2) Size(size uint64) uint64 { return size } +func (t *imageTypeS2) PartitionType() string { + return "" +} + func (t *imageTypeS2) Packages(bp blueprint.Blueprint) ([]string, []string) { packages := append(t.packageSets["packages"].Include, bp.GetPackages()...) timezone, _ := bp.Customizations.GetTimezoneSettings() diff --git a/internal/distro/rhel85/distro.go b/internal/distro/rhel85/distro.go index 864fd9263..0c8733a90 100644 --- a/internal/distro/rhel85/distro.go +++ b/internal/distro/rhel85/distro.go @@ -327,6 +327,16 @@ func (t *imageType) getPartitionTable( return disk.CreatePartitionTable(mountpoints, imageSize, &basePartitionTable, rng) } +func (t *imageType) PartitionType() string { + archName := t.arch.Name() + basePartitionTable, exists := t.basePartitionTables[archName] + if !exists { + return "" + } + + return basePartitionTable.Type +} + // local type for ostree commit metadata used to define commit sources type ostreeCommit struct { Checksum string diff --git a/internal/distro/rhel86/distro.go b/internal/distro/rhel86/distro.go index 3be1fe03b..5828e5288 100644 --- a/internal/distro/rhel86/distro.go +++ b/internal/distro/rhel86/distro.go @@ -404,6 +404,17 @@ func (t *imageType) getDefaultImageConfig() *distro.ImageConfig { imageConfig = &distro.ImageConfig{} } return imageConfig.InheritFrom(t.arch.distro.getDefaultImageConfig()) + +} + +func (t *imageType) PartitionType() string { + archName := t.arch.Name() + basePartitionTable, exists := t.basePartitionTables[archName] + if !exists { + return "" + } + + return basePartitionTable.Type } // local type for ostree commit metadata used to define commit sources diff --git a/internal/distro/rhel90/distro.go b/internal/distro/rhel90/distro.go index b4ed6aab1..3f5482e7f 100644 --- a/internal/distro/rhel90/distro.go +++ b/internal/distro/rhel90/distro.go @@ -392,6 +392,17 @@ func (t *imageType) getDefaultImageConfig() *distro.ImageConfig { imageConfig = &distro.ImageConfig{} } return imageConfig.InheritFrom(t.arch.distro.getDefaultImageConfig()) + +} + +func (t *imageType) PartitionType() string { + archName := t.arch.Name() + basePartitionTable, exists := t.basePartitionTables[archName] + if !exists { + return "" + } + + return basePartitionTable.Type } // local type for ostree commit metadata used to define commit sources diff --git a/internal/distro/rhel90beta/distro.go b/internal/distro/rhel90beta/distro.go index b60e67526..da4fd9b55 100644 --- a/internal/distro/rhel90beta/distro.go +++ b/internal/distro/rhel90beta/distro.go @@ -362,6 +362,16 @@ func (t *imageType) getPartitionTable( return disk.CreatePartitionTable(mountpoints, imageSize, &basePartitionTable, rng) } +func (t *imageType) PartitionType() string { + archName := t.arch.Name() + basePartitionTable, exists := t.basePartitionTables[archName] + if !exists { + return "" + } + + return basePartitionTable.Type +} + // local type for ostree commit metadata used to define commit sources type ostreeCommit struct { Checksum string diff --git a/internal/distro/test_distro/distro.go b/internal/distro/test_distro/distro.go index f23f32bd4..2fbfba565 100644 --- a/internal/distro/test_distro/distro.go +++ b/internal/distro/test_distro/distro.go @@ -167,6 +167,10 @@ func (t *TestImageType) Size(size uint64) uint64 { return 0 } +func (t *TestImageType) PartitionType() string { + return "" +} + func (t *TestImageType) Packages(bp blueprint.Blueprint) ([]string, []string) { return nil, nil }