distro: remove rhel 9 beta
This was a stop-gap until the actual rhel 9 distro was created. It is in a sad state, quite broken and shout not be used by anybody. Put it out of its misery.
This commit is contained in:
parent
8f9bb1bc01
commit
54ae069b94
39 changed files with 0 additions and 375887 deletions
|
|
@ -1,908 +0,0 @@
|
|||
package rhel90beta
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"math/rand"
|
||||
"path"
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
"github.com/osbuild/osbuild-composer/internal/blueprint"
|
||||
"github.com/osbuild/osbuild-composer/internal/disk"
|
||||
"github.com/osbuild/osbuild-composer/internal/distro"
|
||||
osbuild "github.com/osbuild/osbuild-composer/internal/osbuild2"
|
||||
"github.com/osbuild/osbuild-composer/internal/ostree"
|
||||
"github.com/osbuild/osbuild-composer/internal/rpmmd"
|
||||
)
|
||||
|
||||
const defaultName = "rhel-90-beta"
|
||||
const osVersion = "9.0"
|
||||
const releaseVersion = "9"
|
||||
const modulePlatformID = "platform:el9"
|
||||
const ostreeRef = "rhel/9/%s/edge"
|
||||
|
||||
const (
|
||||
// package set names
|
||||
|
||||
// build package set name
|
||||
buildPkgsKey = "build"
|
||||
|
||||
// Legacy bootable image package set name
|
||||
bootLegacyPkgsKey = "boot.legacy"
|
||||
|
||||
// UEFI bootable image package set name
|
||||
bootUEFIPkgsKey = "boot.uefi"
|
||||
|
||||
// main/common os image package set name
|
||||
osPkgsKey = "packages"
|
||||
|
||||
// edge os image package set name
|
||||
edgePkgsKey = "edge"
|
||||
|
||||
// edge build package set name
|
||||
edgeBuildPkgsKey = "build.edge"
|
||||
|
||||
// container package set name
|
||||
containerPkgsKey = "container"
|
||||
|
||||
// installer package set name
|
||||
installerPkgsKey = "installer"
|
||||
|
||||
// blueprint package set name
|
||||
blueprintPkgsKey = "blueprint"
|
||||
)
|
||||
|
||||
var mountpointAllowList = []string{
|
||||
"/", "/var", "/opt", "/srv", "/usr", "/app", "/data", "/home",
|
||||
}
|
||||
|
||||
type distribution struct {
|
||||
name string
|
||||
modulePlatformID string
|
||||
ostreeRef string
|
||||
arches map[string]distro.Arch
|
||||
packageSets map[string]rpmmd.PackageSet
|
||||
}
|
||||
|
||||
func (d *distribution) Name() string {
|
||||
return d.name
|
||||
}
|
||||
|
||||
func (d *distribution) Releasever() string {
|
||||
return releaseVersion
|
||||
}
|
||||
|
||||
func (d *distribution) ModulePlatformID() string {
|
||||
return d.modulePlatformID
|
||||
}
|
||||
|
||||
func (d *distribution) OSTreeRef() string {
|
||||
return d.ostreeRef
|
||||
}
|
||||
|
||||
func (d *distribution) ListArches() []string {
|
||||
archNames := make([]string, 0, len(d.arches))
|
||||
for name := range d.arches {
|
||||
archNames = append(archNames, name)
|
||||
}
|
||||
sort.Strings(archNames)
|
||||
return archNames
|
||||
}
|
||||
|
||||
func (d *distribution) GetArch(name string) (distro.Arch, error) {
|
||||
arch, exists := d.arches[name]
|
||||
if !exists {
|
||||
return nil, errors.New("invalid architecture: " + name)
|
||||
}
|
||||
return arch, nil
|
||||
}
|
||||
|
||||
func (d *distribution) addArches(arches ...architecture) {
|
||||
if d.arches == nil {
|
||||
d.arches = map[string]distro.Arch{}
|
||||
}
|
||||
|
||||
// Do not make copies of architectures, as opposed to image types,
|
||||
// because architecture definitions are not used by more than a single
|
||||
// distro definition.
|
||||
for idx := range arches {
|
||||
d.arches[arches[idx].name] = &arches[idx]
|
||||
}
|
||||
}
|
||||
|
||||
type architecture struct {
|
||||
distro *distribution
|
||||
name string
|
||||
imageTypes map[string]distro.ImageType
|
||||
imageTypeAliases map[string]string
|
||||
packageSets map[string]rpmmd.PackageSet
|
||||
legacy string
|
||||
bootType distro.BootType
|
||||
}
|
||||
|
||||
func (a *architecture) Name() string {
|
||||
return a.name
|
||||
}
|
||||
|
||||
func (a *architecture) ListImageTypes() []string {
|
||||
itNames := make([]string, 0, len(a.imageTypes))
|
||||
for name := range a.imageTypes {
|
||||
itNames = append(itNames, name)
|
||||
}
|
||||
sort.Strings(itNames)
|
||||
return itNames
|
||||
}
|
||||
|
||||
func (a *architecture) GetImageType(name string) (distro.ImageType, error) {
|
||||
t, exists := a.imageTypes[name]
|
||||
if !exists {
|
||||
aliasForName, exists := a.imageTypeAliases[name]
|
||||
if !exists {
|
||||
return nil, errors.New("invalid image type: " + name)
|
||||
}
|
||||
t, exists = a.imageTypes[aliasForName]
|
||||
if !exists {
|
||||
panic(fmt.Sprintf("image type '%s' is an alias to a non-existing image type '%s'", name, aliasForName))
|
||||
}
|
||||
}
|
||||
return t, nil
|
||||
}
|
||||
|
||||
func (a *architecture) addImageTypes(imageTypes ...imageType) {
|
||||
if a.imageTypes == nil {
|
||||
a.imageTypes = map[string]distro.ImageType{}
|
||||
}
|
||||
for idx := range imageTypes {
|
||||
it := imageTypes[idx]
|
||||
it.arch = a
|
||||
a.imageTypes[it.name] = &it
|
||||
for _, alias := range it.nameAliases {
|
||||
if a.imageTypeAliases == nil {
|
||||
a.imageTypeAliases = map[string]string{}
|
||||
}
|
||||
if existingAliasFor, exists := a.imageTypeAliases[alias]; exists {
|
||||
panic(fmt.Sprintf("image type alias '%s' for '%s' is already defined for another image type '%s'", alias, it.name, existingAliasFor))
|
||||
}
|
||||
a.imageTypeAliases[alias] = it.name
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (a *architecture) Distro() distro.Distro {
|
||||
return a.distro
|
||||
}
|
||||
|
||||
type pipelinesFunc func(t *imageType, customizations *blueprint.Customizations, options distro.ImageOptions, repos []rpmmd.RepoConfig, packageSetSpecs map[string][]rpmmd.PackageSpec, rng *rand.Rand) ([]osbuild.Pipeline, error)
|
||||
|
||||
type imageType struct {
|
||||
arch *architecture
|
||||
name string
|
||||
nameAliases []string
|
||||
filename string
|
||||
mimeType string
|
||||
packageSets map[string]rpmmd.PackageSet
|
||||
packageSetChains map[string][]string
|
||||
enabledServices []string
|
||||
disabledServices []string
|
||||
defaultTarget string
|
||||
kernelOptions string
|
||||
defaultSize uint64
|
||||
buildPipelines []string
|
||||
payloadPipelines []string
|
||||
exports []string
|
||||
pipelines pipelinesFunc
|
||||
|
||||
// bootISO: installable ISO
|
||||
bootISO bool
|
||||
// rpmOstree: edge/ostree
|
||||
rpmOstree bool
|
||||
// bootable image
|
||||
bootable bool
|
||||
// If set to a value, it is preferred over the architecture value
|
||||
bootType distro.BootType
|
||||
// List of valid arches for the image type
|
||||
basePartitionTables distro.BasePartitionTableMap
|
||||
}
|
||||
|
||||
func (t *imageType) Name() string {
|
||||
return t.name
|
||||
}
|
||||
|
||||
func (t *imageType) Arch() distro.Arch {
|
||||
return t.arch
|
||||
}
|
||||
|
||||
func (t *imageType) Filename() string {
|
||||
return t.filename
|
||||
}
|
||||
|
||||
func (t *imageType) MIMEType() string {
|
||||
return t.mimeType
|
||||
}
|
||||
|
||||
func (t *imageType) OSTreeRef() string {
|
||||
if t.rpmOstree {
|
||||
return fmt.Sprintf(ostreeRef, t.Arch().Name())
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (t *imageType) Size(size uint64) uint64 {
|
||||
const MegaByte = 1024 * 1024
|
||||
// Microsoft Azure requires vhd images to be rounded up to the nearest MB
|
||||
if t.name == "vhd" && size%MegaByte != 0 {
|
||||
size = (size/MegaByte + 1) * MegaByte
|
||||
}
|
||||
if size == 0 {
|
||||
size = t.defaultSize
|
||||
}
|
||||
return size
|
||||
}
|
||||
|
||||
func (t *imageType) PackageSets(bp blueprint.Blueprint, repos []rpmmd.RepoConfig) map[string][]rpmmd.PackageSet {
|
||||
// merge package sets that appear in the image type with the package sets
|
||||
// of the same name from the distro and arch
|
||||
mergedSets := make(map[string]rpmmd.PackageSet)
|
||||
|
||||
imageSets := t.packageSets
|
||||
archSets := t.arch.packageSets
|
||||
distroSets := t.arch.distro.packageSets
|
||||
for name := range imageSets {
|
||||
mergedSets[name] = imageSets[name].Append(archSets[name]).Append(distroSets[name])
|
||||
}
|
||||
|
||||
if _, hasPackages := imageSets[osPkgsKey]; !hasPackages {
|
||||
// should this be possible??
|
||||
mergedSets[osPkgsKey] = rpmmd.PackageSet{}
|
||||
}
|
||||
|
||||
// build is usually not defined on the image type
|
||||
// handle it explicitly when it's not
|
||||
if _, hasBuild := imageSets[buildPkgsKey]; !hasBuild {
|
||||
mergedSets[buildPkgsKey] = archSets[buildPkgsKey].Append(distroSets[buildPkgsKey])
|
||||
}
|
||||
|
||||
// package sets from flags
|
||||
if t.bootable {
|
||||
var addLegacyBootPkg bool
|
||||
var addUEFIBootPkg bool
|
||||
|
||||
switch bt := t.getBootType(); bt {
|
||||
case distro.LegacyBootType:
|
||||
addLegacyBootPkg = true
|
||||
case distro.UEFIBootType:
|
||||
addUEFIBootPkg = true
|
||||
case distro.HybridBootType:
|
||||
addLegacyBootPkg = true
|
||||
addUEFIBootPkg = true
|
||||
default:
|
||||
panic(fmt.Sprintf("unsupported boot type: %q", bt))
|
||||
}
|
||||
|
||||
if addLegacyBootPkg {
|
||||
mergedSets[osPkgsKey] = mergedSets[osPkgsKey].Append(archSets[bootLegacyPkgsKey]).Append(distroSets[bootLegacyPkgsKey])
|
||||
}
|
||||
if addUEFIBootPkg {
|
||||
mergedSets[osPkgsKey] = mergedSets[osPkgsKey].Append(archSets[bootUEFIPkgsKey]).Append(distroSets[bootUEFIPkgsKey])
|
||||
}
|
||||
}
|
||||
if t.rpmOstree {
|
||||
// add ostree sets
|
||||
mergedSets[buildPkgsKey] = mergedSets[buildPkgsKey].Append(archSets[edgeBuildPkgsKey]).Append(distroSets[edgeBuildPkgsKey])
|
||||
mergedSets[osPkgsKey] = mergedSets[osPkgsKey].Append(archSets[edgePkgsKey]).Append(distroSets[edgePkgsKey])
|
||||
}
|
||||
|
||||
// blueprint packages
|
||||
bpPackages := bp.GetPackages()
|
||||
timezone, _ := bp.Customizations.GetTimezoneSettings()
|
||||
if timezone != nil {
|
||||
bpPackages = append(bpPackages, "chrony")
|
||||
}
|
||||
|
||||
// depsolve bp packages separately
|
||||
// bp packages aren't restricted by exclude lists
|
||||
mergedSets[blueprintPkgsKey] = rpmmd.PackageSet{Include: bpPackages}
|
||||
kernel := bp.Customizations.GetKernel().Name
|
||||
|
||||
// add bp kernel to main OS package set to avoid duplicate kernels
|
||||
mergedSets[osPkgsKey] = mergedSets[osPkgsKey].Append(rpmmd.PackageSet{Include: []string{kernel}})
|
||||
|
||||
return distro.MakePackageSetChains(t, mergedSets, repos)
|
||||
}
|
||||
|
||||
func (t *imageType) BuildPipelines() []string {
|
||||
return t.buildPipelines
|
||||
}
|
||||
|
||||
func (t *imageType) PayloadPipelines() []string {
|
||||
return t.payloadPipelines
|
||||
}
|
||||
|
||||
func (t *imageType) PayloadPackageSets() []string {
|
||||
return []string{blueprintPkgsKey}
|
||||
}
|
||||
|
||||
func (t *imageType) PackageSetsChains() map[string][]string {
|
||||
return t.packageSetChains
|
||||
}
|
||||
|
||||
func (t *imageType) Exports() []string {
|
||||
return t.exports
|
||||
}
|
||||
|
||||
// getBootType returns the BootType which should be used for this particular
|
||||
// combination of architecture and image type.
|
||||
func (t *imageType) getBootType() distro.BootType {
|
||||
bootType := t.arch.bootType
|
||||
if t.bootType != distro.UnsetBootType {
|
||||
bootType = t.bootType
|
||||
}
|
||||
return bootType
|
||||
}
|
||||
|
||||
func (t *imageType) supportsUEFI() bool {
|
||||
bootType := t.getBootType()
|
||||
if bootType == distro.HybridBootType || bootType == distro.UEFIBootType {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (t *imageType) getPartitionTable(
|
||||
mountpoints []blueprint.FilesystemCustomization,
|
||||
options distro.ImageOptions,
|
||||
rng *rand.Rand,
|
||||
) (*disk.PartitionTable, error) {
|
||||
archName := t.arch.Name()
|
||||
|
||||
basePartitionTable, exists := t.basePartitionTables[archName]
|
||||
|
||||
if !exists {
|
||||
return nil, fmt.Errorf("unknown arch: " + archName)
|
||||
}
|
||||
|
||||
imageSize := t.Size(options.Size)
|
||||
|
||||
return disk.NewPartitionTable(&basePartitionTable, mountpoints, imageSize, false, rng)
|
||||
}
|
||||
|
||||
func (t *imageType) PartitionType() string {
|
||||
archName := t.arch.Name()
|
||||
basePartitionTable, exists := t.basePartitionTables[archName]
|
||||
if !exists {
|
||||
return ""
|
||||
}
|
||||
|
||||
return basePartitionTable.Type
|
||||
}
|
||||
|
||||
func (t *imageType) Manifest(customizations *blueprint.Customizations,
|
||||
options distro.ImageOptions,
|
||||
repos []rpmmd.RepoConfig,
|
||||
packageSpecSets map[string][]rpmmd.PackageSpec,
|
||||
seed int64) (distro.Manifest, error) {
|
||||
|
||||
if err := t.checkOptions(customizations, options); err != nil {
|
||||
return distro.Manifest{}, err
|
||||
}
|
||||
|
||||
source := rand.NewSource(seed)
|
||||
// math/rand is good enough in this case
|
||||
/* #nosec G404 */
|
||||
rng := rand.New(source)
|
||||
|
||||
pipelines, err := t.pipelines(t, customizations, options, repos, packageSpecSets, rng)
|
||||
if err != nil {
|
||||
return distro.Manifest{}, err
|
||||
}
|
||||
|
||||
// flatten spec sets for sources
|
||||
allPackageSpecs := make([]rpmmd.PackageSpec, 0)
|
||||
for _, specs := range packageSpecSets {
|
||||
allPackageSpecs = append(allPackageSpecs, specs...)
|
||||
}
|
||||
|
||||
var commits []ostree.CommitSource
|
||||
if t.bootISO && options.OSTree.Parent != "" && options.OSTree.URL != "" {
|
||||
commits = []ostree.CommitSource{{Checksum: options.OSTree.Parent, URL: options.OSTree.URL}}
|
||||
}
|
||||
return json.Marshal(
|
||||
osbuild.Manifest{
|
||||
Version: "2",
|
||||
Pipelines: pipelines,
|
||||
Sources: osbuild.GenSources(allPackageSpecs, commits, nil),
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
func isMountpointAllowed(mountpoint string) bool {
|
||||
for _, allowed := range mountpointAllowList {
|
||||
match, _ := path.Match(allowed, mountpoint)
|
||||
if match {
|
||||
return true
|
||||
}
|
||||
// ensure that only clean mountpoints
|
||||
// are valid
|
||||
if strings.Contains(mountpoint, "//") {
|
||||
return false
|
||||
}
|
||||
match = strings.HasPrefix(mountpoint, allowed+"/")
|
||||
if allowed != "/" && match {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// checkOptions checks the validity and compatibility of options and customizations for the image type.
|
||||
func (t *imageType) checkOptions(customizations *blueprint.Customizations, options distro.ImageOptions) error {
|
||||
if t.bootISO && t.rpmOstree {
|
||||
if options.OSTree.Parent == "" {
|
||||
return fmt.Errorf("boot ISO image type %q requires specifying a URL from which to retrieve the OSTree commit", t.name)
|
||||
}
|
||||
if t.name == "edge-installer" {
|
||||
allowed := []string{"User", "Group"}
|
||||
if err := customizations.CheckAllowed(allowed...); err != nil {
|
||||
return fmt.Errorf("unsupported blueprint customizations found for boot ISO image type %q: (allowed: %s)", t.name, strings.Join(allowed, ", "))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if kernelOpts := customizations.GetKernel(); kernelOpts.Append != "" && t.rpmOstree {
|
||||
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")
|
||||
}
|
||||
|
||||
invalidMountpoints := []string{}
|
||||
for _, m := range mountpoints {
|
||||
if !isMountpointAllowed(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
|
||||
}
|
||||
|
||||
// New creates a new distro object, defining the supported architectures and image types
|
||||
func New() distro.Distro {
|
||||
return newDistro(defaultName, modulePlatformID, ostreeRef)
|
||||
}
|
||||
|
||||
func NewHostDistro(name, modulePlatformID, ostreeRef string) distro.Distro {
|
||||
return newDistro(name, modulePlatformID, ostreeRef)
|
||||
}
|
||||
|
||||
func newDistro(name, modulePlatformID, ostreeRef string) distro.Distro {
|
||||
const GigaByte = 1024 * 1024 * 1024
|
||||
|
||||
rd := &distribution{
|
||||
name: name,
|
||||
modulePlatformID: modulePlatformID,
|
||||
ostreeRef: ostreeRef,
|
||||
packageSets: map[string]rpmmd.PackageSet{
|
||||
buildPkgsKey: distroBuildPackageSet(),
|
||||
edgeBuildPkgsKey: edgeBuildPackageSet(),
|
||||
},
|
||||
}
|
||||
|
||||
// Architecture definitions
|
||||
x86_64 := architecture{
|
||||
name: distro.X86_64ArchName,
|
||||
distro: rd,
|
||||
packageSets: map[string]rpmmd.PackageSet{
|
||||
buildPkgsKey: x8664BuildPackageSet(),
|
||||
bootLegacyPkgsKey: x8664LegacyBootPackageSet(),
|
||||
bootUEFIPkgsKey: x8664UEFIBootPackageSet(),
|
||||
edgePkgsKey: x8664EdgeCommitPackageSet(),
|
||||
},
|
||||
legacy: "i386-pc",
|
||||
bootType: distro.HybridBootType,
|
||||
}
|
||||
|
||||
aarch64 := architecture{
|
||||
name: distro.Aarch64ArchName,
|
||||
distro: rd,
|
||||
packageSets: map[string]rpmmd.PackageSet{
|
||||
bootUEFIPkgsKey: aarch64UEFIBootPackageSet(),
|
||||
edgePkgsKey: aarch64EdgeCommitPackageSet(),
|
||||
},
|
||||
bootType: distro.UEFIBootType,
|
||||
}
|
||||
|
||||
ppc64le := architecture{
|
||||
distro: rd,
|
||||
name: distro.Ppc64leArchName,
|
||||
packageSets: map[string]rpmmd.PackageSet{
|
||||
bootLegacyPkgsKey: ppc64leLegacyBootPackageSet(),
|
||||
buildPkgsKey: ppc64leBuildPackageSet(),
|
||||
},
|
||||
legacy: "powerpc-ieee1275",
|
||||
bootType: distro.LegacyBootType,
|
||||
}
|
||||
s390x := architecture{
|
||||
distro: rd,
|
||||
name: distro.S390xArchName,
|
||||
packageSets: map[string]rpmmd.PackageSet{
|
||||
bootLegacyPkgsKey: s390xLegacyBootPackageSet(),
|
||||
},
|
||||
bootType: distro.LegacyBootType,
|
||||
}
|
||||
|
||||
// Shared Services
|
||||
edgeServices := []string{
|
||||
"NetworkManager.service", "firewalld.service", "sshd.service",
|
||||
"greenboot-grub2-set-counter", "greenboot-grub2-set-success", "greenboot-healthcheck",
|
||||
"greenboot-rpm-ostree-grub2-check-fallback", "greenboot-status", "greenboot-task-runner",
|
||||
"redboot-auto-reboot", "redboot-task-runner",
|
||||
}
|
||||
|
||||
// Image Definitions
|
||||
edgeCommitImgType := imageType{
|
||||
name: "edge-commit",
|
||||
nameAliases: []string{"rhel-edge-commit"},
|
||||
filename: "commit.tar",
|
||||
mimeType: "application/x-tar",
|
||||
packageSets: map[string]rpmmd.PackageSet{
|
||||
buildPkgsKey: edgeBuildPackageSet(),
|
||||
osPkgsKey: edgeCommitPackageSet(),
|
||||
},
|
||||
packageSetChains: map[string][]string{
|
||||
osPkgsKey: {osPkgsKey, blueprintPkgsKey},
|
||||
},
|
||||
enabledServices: edgeServices,
|
||||
rpmOstree: true,
|
||||
pipelines: edgeCommitPipelines,
|
||||
buildPipelines: []string{"build"},
|
||||
payloadPipelines: []string{"ostree-tree", "ostree-commit", "commit-archive"},
|
||||
exports: []string{"commit-archive"},
|
||||
}
|
||||
edgeOCIImgType := imageType{
|
||||
name: "edge-container",
|
||||
nameAliases: []string{"rhel-edge-container"},
|
||||
filename: "container.tar",
|
||||
mimeType: "application/x-tar",
|
||||
packageSets: map[string]rpmmd.PackageSet{
|
||||
buildPkgsKey: edgeBuildPackageSet(),
|
||||
osPkgsKey: edgeCommitPackageSet(),
|
||||
containerPkgsKey: {Include: []string{"httpd"}},
|
||||
},
|
||||
packageSetChains: map[string][]string{
|
||||
osPkgsKey: {osPkgsKey, blueprintPkgsKey},
|
||||
},
|
||||
enabledServices: edgeServices,
|
||||
rpmOstree: true,
|
||||
bootISO: false,
|
||||
pipelines: edgeContainerPipelines,
|
||||
buildPipelines: []string{"build"},
|
||||
payloadPipelines: []string{"ostree-tree", "ostree-commit", "container-tree", "container"},
|
||||
exports: []string{"container"},
|
||||
}
|
||||
edgeInstallerImgType := imageType{
|
||||
name: "edge-installer",
|
||||
nameAliases: []string{"rhel-edge-installer"},
|
||||
filename: "installer.iso",
|
||||
mimeType: "application/x-iso9660-image",
|
||||
packageSets: map[string]rpmmd.PackageSet{
|
||||
// TODO: non-arch-specific package set handling for installers
|
||||
// This image type requires build packages for installers and
|
||||
// ostree/edge. For now we only have x86-64 installer build
|
||||
// package sets defined. When we add installer build package sets
|
||||
// for other architectures, this will need to be moved to the
|
||||
// architecture and the merging will happen in the PackageSets()
|
||||
// method like the other sets.
|
||||
buildPkgsKey: x8664InstallerBuildPackageSet().Append(edgeBuildPackageSet()),
|
||||
osPkgsKey: edgeCommitPackageSet(),
|
||||
installerPkgsKey: edgeInstallerPackageSet(),
|
||||
},
|
||||
packageSetChains: map[string][]string{
|
||||
osPkgsKey: {osPkgsKey, blueprintPkgsKey},
|
||||
},
|
||||
enabledServices: edgeServices,
|
||||
rpmOstree: true,
|
||||
bootISO: true,
|
||||
pipelines: edgeInstallerPipelines,
|
||||
buildPipelines: []string{"build"},
|
||||
payloadPipelines: []string{"anaconda-tree", "bootiso-tree", "bootiso"},
|
||||
exports: []string{"bootiso"},
|
||||
}
|
||||
|
||||
qcow2ImgType := imageType{
|
||||
name: "qcow2",
|
||||
filename: "disk.qcow2",
|
||||
mimeType: "application/x-qemu-disk",
|
||||
defaultTarget: "multi-user.target",
|
||||
kernelOptions: "console=tty0 console=ttyS0,115200n8 no_timer_check net.ifnames=0 crashkernel=auto",
|
||||
packageSets: map[string]rpmmd.PackageSet{
|
||||
osPkgsKey: qcow2CommonPackageSet(),
|
||||
},
|
||||
packageSetChains: map[string][]string{
|
||||
osPkgsKey: {osPkgsKey, blueprintPkgsKey},
|
||||
},
|
||||
bootable: true,
|
||||
defaultSize: 10 * GigaByte,
|
||||
pipelines: qcow2Pipelines,
|
||||
buildPipelines: []string{"build"},
|
||||
payloadPipelines: []string{"os", "image", "qcow2"},
|
||||
exports: []string{"qcow2"},
|
||||
basePartitionTables: defaultBasePartitionTables,
|
||||
}
|
||||
|
||||
vhdImgType := imageType{
|
||||
name: "vhd",
|
||||
filename: "disk.vhd",
|
||||
mimeType: "application/x-vhd",
|
||||
packageSets: map[string]rpmmd.PackageSet{
|
||||
osPkgsKey: vhdCommonPackageSet(),
|
||||
},
|
||||
packageSetChains: map[string][]string{
|
||||
osPkgsKey: {osPkgsKey, blueprintPkgsKey},
|
||||
},
|
||||
enabledServices: []string{
|
||||
"sshd",
|
||||
"waagent",
|
||||
},
|
||||
defaultTarget: "multi-user.target",
|
||||
kernelOptions: "ro biosdevname=0 rootdelay=300 console=ttyS0 earlyprintk=ttyS0 net.ifnames=0",
|
||||
bootable: true,
|
||||
defaultSize: 4 * GigaByte,
|
||||
pipelines: vhdPipelines,
|
||||
buildPipelines: []string{"build"},
|
||||
payloadPipelines: []string{"os", "image", "vpc"},
|
||||
exports: []string{"vpc"},
|
||||
basePartitionTables: defaultBasePartitionTables,
|
||||
}
|
||||
|
||||
vmdkImgType := imageType{
|
||||
name: "vmdk",
|
||||
filename: "disk.vmdk",
|
||||
mimeType: "application/x-vmdk",
|
||||
packageSets: map[string]rpmmd.PackageSet{
|
||||
osPkgsKey: vmdkCommonPackageSet(),
|
||||
},
|
||||
packageSetChains: map[string][]string{
|
||||
osPkgsKey: {osPkgsKey, blueprintPkgsKey},
|
||||
},
|
||||
kernelOptions: "ro net.ifnames=0",
|
||||
bootable: true,
|
||||
defaultSize: 4 * GigaByte,
|
||||
pipelines: vmdkPipelines,
|
||||
buildPipelines: []string{"build"},
|
||||
payloadPipelines: []string{"os", "image", "vmdk"},
|
||||
exports: []string{"vmdk"},
|
||||
basePartitionTables: defaultBasePartitionTables,
|
||||
}
|
||||
|
||||
openstackImgType := imageType{
|
||||
name: "openstack",
|
||||
filename: "disk.qcow2",
|
||||
mimeType: "application/x-qemu-disk",
|
||||
packageSets: map[string]rpmmd.PackageSet{
|
||||
osPkgsKey: openstackCommonPackageSet(),
|
||||
},
|
||||
packageSetChains: map[string][]string{
|
||||
osPkgsKey: {osPkgsKey, blueprintPkgsKey},
|
||||
},
|
||||
kernelOptions: "ro net.ifnames=0",
|
||||
bootable: true,
|
||||
defaultSize: 4 * GigaByte,
|
||||
pipelines: openstackPipelines,
|
||||
buildPipelines: []string{"build"},
|
||||
payloadPipelines: []string{"os", "image", "qcow2"},
|
||||
exports: []string{"qcow2"},
|
||||
basePartitionTables: defaultBasePartitionTables,
|
||||
}
|
||||
|
||||
// EC2 services
|
||||
ec2EnabledServices := []string{
|
||||
"sshd",
|
||||
"NetworkManager",
|
||||
"nm-cloud-setup.service",
|
||||
"nm-cloud-setup.timer",
|
||||
"cloud-init",
|
||||
"cloud-init-local",
|
||||
"cloud-config",
|
||||
"cloud-final",
|
||||
"reboot.target",
|
||||
}
|
||||
|
||||
amiImgTypeX86_64 := imageType{
|
||||
name: "ami",
|
||||
filename: "image.raw",
|
||||
mimeType: "application/octet-stream",
|
||||
packageSets: map[string]rpmmd.PackageSet{
|
||||
buildPkgsKey: ec2BuildPackageSet(),
|
||||
osPkgsKey: ec2CommonPackageSet(),
|
||||
},
|
||||
packageSetChains: map[string][]string{
|
||||
osPkgsKey: {osPkgsKey, blueprintPkgsKey},
|
||||
},
|
||||
defaultTarget: "multi-user.target",
|
||||
enabledServices: ec2EnabledServices,
|
||||
kernelOptions: "console=ttyS0,115200n8 console=tty0 net.ifnames=0 rd.blacklist=nouveau nvme_core.io_timeout=4294967295 crashkernel=auto",
|
||||
bootable: true,
|
||||
bootType: distro.LegacyBootType,
|
||||
defaultSize: 10 * GigaByte,
|
||||
pipelines: ec2Pipelines,
|
||||
buildPipelines: []string{"build"},
|
||||
payloadPipelines: []string{"os", "image"},
|
||||
exports: []string{"image"},
|
||||
basePartitionTables: ec2BasePartitionTables,
|
||||
}
|
||||
|
||||
amiImgTypeAarch64 := imageType{
|
||||
name: "ami",
|
||||
filename: "image.raw",
|
||||
mimeType: "application/octet-stream",
|
||||
packageSets: map[string]rpmmd.PackageSet{
|
||||
buildPkgsKey: ec2BuildPackageSet(),
|
||||
osPkgsKey: ec2CommonPackageSet(),
|
||||
},
|
||||
packageSetChains: map[string][]string{
|
||||
osPkgsKey: {osPkgsKey, blueprintPkgsKey},
|
||||
},
|
||||
defaultTarget: "multi-user.target",
|
||||
enabledServices: ec2EnabledServices,
|
||||
kernelOptions: "console=ttyS0,115200n8 console=tty0 net.ifnames=0 rd.blacklist=nouveau nvme_core.io_timeout=4294967295 iommu.strict=0 crashkernel=auto",
|
||||
bootable: true,
|
||||
defaultSize: 10 * GigaByte,
|
||||
pipelines: ec2Pipelines,
|
||||
buildPipelines: []string{"build"},
|
||||
payloadPipelines: []string{"os", "image"},
|
||||
exports: []string{"image"},
|
||||
basePartitionTables: ec2BasePartitionTables,
|
||||
}
|
||||
|
||||
ec2ImgTypeX86_64 := imageType{
|
||||
name: "ec2",
|
||||
filename: "image.raw.xz",
|
||||
mimeType: "application/xz",
|
||||
packageSets: map[string]rpmmd.PackageSet{
|
||||
buildPkgsKey: ec2BuildPackageSet(),
|
||||
osPkgsKey: rhelEc2PackageSet(),
|
||||
},
|
||||
packageSetChains: map[string][]string{
|
||||
osPkgsKey: {osPkgsKey, blueprintPkgsKey},
|
||||
},
|
||||
defaultTarget: "multi-user.target",
|
||||
enabledServices: ec2EnabledServices,
|
||||
kernelOptions: "console=ttyS0,115200n8 console=tty0 net.ifnames=0 rd.blacklist=nouveau nvme_core.io_timeout=4294967295 crashkernel=auto",
|
||||
bootable: true,
|
||||
bootType: distro.LegacyBootType,
|
||||
defaultSize: 10 * GigaByte,
|
||||
pipelines: rhelEc2Pipelines,
|
||||
buildPipelines: []string{"build"},
|
||||
payloadPipelines: []string{"os", "image", "archive"},
|
||||
exports: []string{"archive"},
|
||||
basePartitionTables: ec2BasePartitionTables,
|
||||
}
|
||||
|
||||
ec2ImgTypeAarch64 := imageType{
|
||||
name: "ec2",
|
||||
filename: "image.raw.xz",
|
||||
mimeType: "application/xz",
|
||||
packageSets: map[string]rpmmd.PackageSet{
|
||||
buildPkgsKey: ec2BuildPackageSet(),
|
||||
osPkgsKey: rhelEc2PackageSet(),
|
||||
},
|
||||
packageSetChains: map[string][]string{
|
||||
osPkgsKey: {osPkgsKey, blueprintPkgsKey},
|
||||
},
|
||||
defaultTarget: "multi-user.target",
|
||||
enabledServices: ec2EnabledServices,
|
||||
kernelOptions: "console=ttyS0,115200n8 console=tty0 net.ifnames=0 rd.blacklist=nouveau nvme_core.io_timeout=4294967295 iommu.strict=0 crashkernel=auto",
|
||||
bootable: true,
|
||||
defaultSize: 10 * GigaByte,
|
||||
pipelines: rhelEc2Pipelines,
|
||||
buildPipelines: []string{"build"},
|
||||
payloadPipelines: []string{"os", "image", "archive"},
|
||||
exports: []string{"archive"},
|
||||
basePartitionTables: ec2BasePartitionTables,
|
||||
}
|
||||
|
||||
ec2HaImgTypeX86_64 := imageType{
|
||||
name: "ec2-ha",
|
||||
filename: "image.raw.xz",
|
||||
mimeType: "application/xz",
|
||||
packageSets: map[string]rpmmd.PackageSet{
|
||||
buildPkgsKey: ec2BuildPackageSet(),
|
||||
osPkgsKey: rhelEc2HaPackageSet(),
|
||||
},
|
||||
packageSetChains: map[string][]string{
|
||||
osPkgsKey: {osPkgsKey, blueprintPkgsKey},
|
||||
},
|
||||
defaultTarget: "multi-user.target",
|
||||
enabledServices: ec2EnabledServices,
|
||||
kernelOptions: "console=ttyS0,115200n8 console=tty0 net.ifnames=0 rd.blacklist=nouveau nvme_core.io_timeout=4294967295 crashkernel=auto",
|
||||
bootable: true,
|
||||
bootType: distro.LegacyBootType,
|
||||
defaultSize: 10 * GigaByte,
|
||||
pipelines: rhelEc2Pipelines,
|
||||
buildPipelines: []string{"build"},
|
||||
payloadPipelines: []string{"os", "image", "archive"},
|
||||
exports: []string{"archive"},
|
||||
basePartitionTables: ec2BasePartitionTables,
|
||||
}
|
||||
|
||||
ec2SapImgTypeX86_64 := imageType{
|
||||
name: "ec2-sap",
|
||||
filename: "image.raw.xz",
|
||||
mimeType: "application/xz",
|
||||
packageSets: map[string]rpmmd.PackageSet{
|
||||
buildPkgsKey: ec2BuildPackageSet(),
|
||||
osPkgsKey: rhelEc2SapPackageSet(),
|
||||
},
|
||||
packageSetChains: map[string][]string{
|
||||
osPkgsKey: {osPkgsKey, blueprintPkgsKey},
|
||||
},
|
||||
defaultTarget: "multi-user.target",
|
||||
enabledServices: ec2EnabledServices,
|
||||
kernelOptions: "console=ttyS0,115200n8 console=tty0 net.ifnames=0 rd.blacklist=nouveau nvme_core.io_timeout=4294967295 crashkernel=auto processor.max_cstate=1 intel_idle.max_cstate=1",
|
||||
bootable: true,
|
||||
bootType: distro.LegacyBootType,
|
||||
defaultSize: 10 * GigaByte,
|
||||
pipelines: rhelEc2SapPipelines,
|
||||
exports: []string{"archive"},
|
||||
basePartitionTables: ec2BasePartitionTables,
|
||||
}
|
||||
|
||||
tarImgType := imageType{
|
||||
name: "tar",
|
||||
filename: "root.tar.xz",
|
||||
mimeType: "application/x-tar",
|
||||
packageSets: map[string]rpmmd.PackageSet{
|
||||
osPkgsKey: {
|
||||
Include: []string{"policycoreutils", "selinux-policy-targeted"},
|
||||
Exclude: []string{"rng-tools"},
|
||||
},
|
||||
},
|
||||
packageSetChains: map[string][]string{
|
||||
osPkgsKey: {osPkgsKey, blueprintPkgsKey},
|
||||
},
|
||||
pipelines: tarPipelines,
|
||||
buildPipelines: []string{"build"},
|
||||
payloadPipelines: []string{"os", "root-tar"},
|
||||
exports: []string{"root-tar"},
|
||||
}
|
||||
imageInstallerImgTypeX86_64 := imageType{
|
||||
name: "image-installer",
|
||||
filename: "installer.iso",
|
||||
mimeType: "application/x-iso9660-image",
|
||||
packageSets: map[string]rpmmd.PackageSet{
|
||||
buildPkgsKey: x8664InstallerBuildPackageSet(),
|
||||
osPkgsKey: bareMetalPackageSet(),
|
||||
installerPkgsKey: installerPackageSet(),
|
||||
},
|
||||
packageSetChains: map[string][]string{
|
||||
osPkgsKey: {osPkgsKey, blueprintPkgsKey},
|
||||
},
|
||||
rpmOstree: false,
|
||||
bootISO: true,
|
||||
bootable: true,
|
||||
pipelines: imageInstallerPipelines,
|
||||
buildPipelines: []string{"build"},
|
||||
payloadPipelines: []string{"os", "anaconda-tree", "bootiso-tree", "bootiso"},
|
||||
exports: []string{"bootiso"},
|
||||
}
|
||||
|
||||
ociImgtype := qcow2ImgType
|
||||
ociImgtype.name = "oci"
|
||||
|
||||
x86_64.addImageTypes(qcow2ImgType, vhdImgType, vmdkImgType, openstackImgType, amiImgTypeX86_64, ec2ImgTypeX86_64, ec2HaImgTypeX86_64, ec2SapImgTypeX86_64, tarImgType, imageInstallerImgTypeX86_64, edgeCommitImgType, edgeInstallerImgType, edgeOCIImgType, ociImgtype)
|
||||
aarch64.addImageTypes(qcow2ImgType, openstackImgType, amiImgTypeAarch64, ec2ImgTypeAarch64, tarImgType, edgeCommitImgType, edgeOCIImgType)
|
||||
ppc64le.addImageTypes(qcow2ImgType, tarImgType)
|
||||
s390x.addImageTypes(qcow2ImgType, tarImgType)
|
||||
|
||||
rd.addArches(x86_64, aarch64, ppc64le, s390x)
|
||||
return rd
|
||||
}
|
||||
|
|
@ -1,795 +0,0 @@
|
|||
package rhel90beta_test
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/osbuild/osbuild-composer/internal/blueprint"
|
||||
"github.com/osbuild/osbuild-composer/internal/distro"
|
||||
"github.com/osbuild/osbuild-composer/internal/distro/distro_test_common"
|
||||
rhel90 "github.com/osbuild/osbuild-composer/internal/distro/rhel90beta"
|
||||
)
|
||||
|
||||
type rhelFamilyDistro struct {
|
||||
name string
|
||||
distro distro.Distro
|
||||
}
|
||||
|
||||
var rhelFamilyDistros = []rhelFamilyDistro{
|
||||
{
|
||||
name: "rhel",
|
||||
distro: rhel90.New(),
|
||||
},
|
||||
}
|
||||
|
||||
func TestFilenameFromType(t *testing.T) {
|
||||
type args struct {
|
||||
outputFormat string
|
||||
}
|
||||
type wantResult struct {
|
||||
filename string
|
||||
mimeType string
|
||||
wantErr bool
|
||||
}
|
||||
tests := []struct {
|
||||
name string
|
||||
args args
|
||||
want wantResult
|
||||
}{
|
||||
{
|
||||
name: "ami",
|
||||
args: args{"ami"},
|
||||
want: wantResult{
|
||||
filename: "image.raw",
|
||||
mimeType: "application/octet-stream",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "ec2",
|
||||
args: args{"ec2"},
|
||||
want: wantResult{
|
||||
filename: "image.raw.xz",
|
||||
mimeType: "application/xz",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "ec2-ha",
|
||||
args: args{"ec2-ha"},
|
||||
want: wantResult{
|
||||
filename: "image.raw.xz",
|
||||
mimeType: "application/xz",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "ec2-sap",
|
||||
args: args{"ec2-sap"},
|
||||
want: wantResult{
|
||||
filename: "image.raw.xz",
|
||||
mimeType: "application/xz",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "qcow2",
|
||||
args: args{"qcow2"},
|
||||
want: wantResult{
|
||||
filename: "disk.qcow2",
|
||||
mimeType: "application/x-qemu-disk",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "openstack",
|
||||
args: args{"openstack"},
|
||||
want: wantResult{
|
||||
filename: "disk.qcow2",
|
||||
mimeType: "application/x-qemu-disk",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "vhd",
|
||||
args: args{"vhd"},
|
||||
want: wantResult{
|
||||
filename: "disk.vhd",
|
||||
mimeType: "application/x-vhd",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "vmdk",
|
||||
args: args{"vmdk"},
|
||||
want: wantResult{
|
||||
filename: "disk.vmdk",
|
||||
mimeType: "application/x-vmdk",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "tar",
|
||||
args: args{"tar"},
|
||||
want: wantResult{
|
||||
filename: "root.tar.xz",
|
||||
mimeType: "application/x-tar",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "image-installer",
|
||||
args: args{"image-installer"},
|
||||
want: wantResult{
|
||||
filename: "installer.iso",
|
||||
mimeType: "application/x-iso9660-image",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "edge-commit",
|
||||
args: args{"edge-commit"},
|
||||
want: wantResult{
|
||||
filename: "commit.tar",
|
||||
mimeType: "application/x-tar",
|
||||
},
|
||||
},
|
||||
// Alias
|
||||
{
|
||||
name: "rhel-edge-commit",
|
||||
args: args{"rhel-edge-commit"},
|
||||
want: wantResult{
|
||||
filename: "commit.tar",
|
||||
mimeType: "application/x-tar",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "edge-container",
|
||||
args: args{"edge-container"},
|
||||
want: wantResult{
|
||||
filename: "container.tar",
|
||||
mimeType: "application/x-tar",
|
||||
},
|
||||
},
|
||||
// Alias
|
||||
{
|
||||
name: "rhel-edge-container",
|
||||
args: args{"rhel-edge-container"},
|
||||
want: wantResult{
|
||||
filename: "container.tar",
|
||||
mimeType: "application/x-tar",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "edge-installer",
|
||||
args: args{"edge-installer"},
|
||||
want: wantResult{
|
||||
filename: "installer.iso",
|
||||
mimeType: "application/x-iso9660-image",
|
||||
},
|
||||
},
|
||||
// Alias
|
||||
{
|
||||
name: "rhel-edge-installer",
|
||||
args: args{"rhel-edge-installer"},
|
||||
want: wantResult{
|
||||
filename: "installer.iso",
|
||||
mimeType: "application/x-iso9660-image",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "invalid-output-type",
|
||||
args: args{"foobar"},
|
||||
want: wantResult{wantErr: true},
|
||||
},
|
||||
}
|
||||
for _, dist := range rhelFamilyDistros {
|
||||
t.Run(dist.name, func(t *testing.T) {
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
dist := dist.distro
|
||||
arch, _ := dist.GetArch("x86_64")
|
||||
imgType, err := arch.GetImageType(tt.args.outputFormat)
|
||||
if (err != nil) != tt.want.wantErr {
|
||||
t.Errorf("Arch.GetImageType() error = %v, wantErr %v", err, tt.want.wantErr)
|
||||
return
|
||||
}
|
||||
if !tt.want.wantErr {
|
||||
gotFilename := imgType.Filename()
|
||||
gotMIMEType := imgType.MIMEType()
|
||||
if gotFilename != tt.want.filename {
|
||||
t.Errorf("ImageType.Filename() got = %v, want %v", gotFilename, tt.want.filename)
|
||||
}
|
||||
if gotMIMEType != tt.want.mimeType {
|
||||
t.Errorf("ImageType.MIMEType() got1 = %v, want %v", gotMIMEType, tt.want.mimeType)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestImageType_BuildPackages(t *testing.T) {
|
||||
x8664BuildPackages := []string{
|
||||
"dnf",
|
||||
"dosfstools",
|
||||
"e2fsprogs",
|
||||
"grub2-efi-x64",
|
||||
"grub2-pc",
|
||||
"policycoreutils",
|
||||
"shim-x64",
|
||||
"systemd",
|
||||
"tar",
|
||||
"qemu-img",
|
||||
"xz",
|
||||
}
|
||||
aarch64BuildPackages := []string{
|
||||
"dnf",
|
||||
"dosfstools",
|
||||
"e2fsprogs",
|
||||
"policycoreutils",
|
||||
"qemu-img",
|
||||
"systemd",
|
||||
"tar",
|
||||
"xz",
|
||||
}
|
||||
buildPackages := map[string][]string{
|
||||
"x86_64": x8664BuildPackages,
|
||||
"aarch64": aarch64BuildPackages,
|
||||
}
|
||||
for _, dist := range rhelFamilyDistros {
|
||||
t.Run(dist.name, func(t *testing.T) {
|
||||
d := dist.distro
|
||||
for _, archLabel := range d.ListArches() {
|
||||
archStruct, err := d.GetArch(archLabel)
|
||||
if assert.NoErrorf(t, err, "d.GetArch(%v) returned err = %v; expected nil", archLabel, err) {
|
||||
continue
|
||||
}
|
||||
for _, itLabel := range archStruct.ListImageTypes() {
|
||||
itStruct, err := archStruct.GetImageType(itLabel)
|
||||
if assert.NoErrorf(t, err, "d.GetArch(%v) returned err = %v; expected nil", archLabel, err) {
|
||||
continue
|
||||
}
|
||||
buildPkgs := itStruct.PackageSets(blueprint.Blueprint{}, nil)["build"]
|
||||
assert.NotNil(t, buildPkgs)
|
||||
assert.Len(t, buildPkgs, 1)
|
||||
assert.ElementsMatch(t, buildPackages[archLabel], buildPkgs[0].Include)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestImageType_Name(t *testing.T) {
|
||||
imgMap := []struct {
|
||||
arch string
|
||||
imgNames []string
|
||||
}{
|
||||
{
|
||||
arch: "x86_64",
|
||||
imgNames: []string{
|
||||
"qcow2",
|
||||
"openstack",
|
||||
"vhd",
|
||||
"vmdk",
|
||||
"ami",
|
||||
"ec2",
|
||||
"ec2-ha",
|
||||
"ec2-sap",
|
||||
"edge-commit",
|
||||
"edge-container",
|
||||
"edge-installer",
|
||||
"tar",
|
||||
"image-installer",
|
||||
},
|
||||
},
|
||||
{
|
||||
arch: "aarch64",
|
||||
imgNames: []string{
|
||||
"qcow2",
|
||||
"openstack",
|
||||
"ami",
|
||||
"ec2",
|
||||
"edge-commit",
|
||||
"edge-container",
|
||||
"tar",
|
||||
},
|
||||
},
|
||||
{
|
||||
arch: "ppc64le",
|
||||
imgNames: []string{
|
||||
"qcow2",
|
||||
"tar",
|
||||
},
|
||||
},
|
||||
{
|
||||
arch: "s390x",
|
||||
imgNames: []string{
|
||||
"qcow2",
|
||||
"tar",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for _, dist := range rhelFamilyDistros {
|
||||
t.Run(dist.name, func(t *testing.T) {
|
||||
for _, mapping := range imgMap {
|
||||
if mapping.arch == distro.S390xArchName && dist.name == "centos" {
|
||||
continue
|
||||
}
|
||||
arch, err := dist.distro.GetArch(mapping.arch)
|
||||
if assert.NoError(t, err) {
|
||||
for _, imgName := range mapping.imgNames {
|
||||
if imgName == "edge-commit" && dist.name == "centos" {
|
||||
continue
|
||||
}
|
||||
imgType, err := arch.GetImageType(imgName)
|
||||
if assert.NoError(t, err) {
|
||||
assert.Equalf(t, imgName, imgType.Name(), "arch: %s", mapping.arch)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestImageTypeAliases(t *testing.T) {
|
||||
type args struct {
|
||||
imageTypeAliases []string
|
||||
}
|
||||
type wantResult struct {
|
||||
imageTypeName string
|
||||
}
|
||||
tests := []struct {
|
||||
name string
|
||||
args args
|
||||
want wantResult
|
||||
}{
|
||||
{
|
||||
name: "edge-commit aliases",
|
||||
args: args{
|
||||
imageTypeAliases: []string{"rhel-edge-commit"},
|
||||
},
|
||||
want: wantResult{
|
||||
imageTypeName: "edge-commit",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "edge-container aliases",
|
||||
args: args{
|
||||
imageTypeAliases: []string{"rhel-edge-container"},
|
||||
},
|
||||
want: wantResult{
|
||||
imageTypeName: "edge-container",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "edge-installer aliases",
|
||||
args: args{
|
||||
imageTypeAliases: []string{"rhel-edge-installer"},
|
||||
},
|
||||
want: wantResult{
|
||||
imageTypeName: "edge-installer",
|
||||
},
|
||||
},
|
||||
}
|
||||
for _, dist := range rhelFamilyDistros {
|
||||
t.Run(dist.name, func(t *testing.T) {
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
dist := dist.distro
|
||||
for _, archName := range dist.ListArches() {
|
||||
t.Run(archName, func(t *testing.T) {
|
||||
arch, err := dist.GetArch(archName)
|
||||
require.Nilf(t, err,
|
||||
"failed to get architecture '%s', previously listed as supported for the distro '%s'",
|
||||
archName, dist.Name())
|
||||
// Test image type aliases only if the aliased image type is supported for the arch
|
||||
if _, err = arch.GetImageType(tt.want.imageTypeName); err != nil {
|
||||
t.Skipf("aliased image type '%s' is not supported for architecture '%s'",
|
||||
tt.want.imageTypeName, archName)
|
||||
}
|
||||
for _, alias := range tt.args.imageTypeAliases {
|
||||
t.Run(fmt.Sprintf("'%s' alias for image type '%s'", alias, tt.want.imageTypeName),
|
||||
func(t *testing.T) {
|
||||
gotImage, err := arch.GetImageType(alias)
|
||||
require.Nilf(t, err, "arch.GetImageType() for image type alias '%s' failed: %v",
|
||||
alias, err)
|
||||
assert.Equalf(t, tt.want.imageTypeName, gotImage.Name(),
|
||||
"got unexpected image type name for alias '%s'. got = %s, want = %s",
|
||||
alias, tt.want.imageTypeName, gotImage.Name())
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// Check that Manifest() function returns an error for unsupported
|
||||
// configurations.
|
||||
func TestDistro_ManifestError(t *testing.T) {
|
||||
// Currently, the only unsupported configuration is OSTree commit types
|
||||
// with Kernel boot options
|
||||
r9distro := rhel90.New()
|
||||
bp := blueprint.Blueprint{
|
||||
Customizations: &blueprint.Customizations{
|
||||
Kernel: &blueprint.KernelCustomization{
|
||||
Append: "debug",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for _, archName := range r9distro.ListArches() {
|
||||
arch, _ := r9distro.GetArch(archName)
|
||||
for _, imgTypeName := range arch.ListImageTypes() {
|
||||
imgType, _ := arch.GetImageType(imgTypeName)
|
||||
imgOpts := distro.ImageOptions{
|
||||
Size: imgType.Size(0),
|
||||
}
|
||||
testPackageSpecSets := distro_test_common.GetTestingImagePackageSpecSets("kernel", imgType)
|
||||
_, err := imgType.Manifest(bp.Customizations, imgOpts, nil, testPackageSpecSets, 0)
|
||||
if imgTypeName == "edge-commit" || imgTypeName == "edge-container" {
|
||||
assert.EqualError(t, err, "kernel boot parameter customizations are not supported for ostree types")
|
||||
} else if imgTypeName == "edge-installer" {
|
||||
assert.EqualError(t, err, "boot ISO image type \"edge-installer\" requires specifying a URL from which to retrieve the OSTree commit")
|
||||
} else {
|
||||
assert.NoError(t, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestArchitecture_ListImageTypes(t *testing.T) {
|
||||
imgMap := []struct {
|
||||
arch string
|
||||
imgNames []string
|
||||
rhelAdditionalImageTypes []string
|
||||
}{
|
||||
{
|
||||
arch: "x86_64",
|
||||
imgNames: []string{
|
||||
"qcow2",
|
||||
"openstack",
|
||||
"vhd",
|
||||
"vmdk",
|
||||
"ami",
|
||||
"ec2",
|
||||
"ec2-ha",
|
||||
"ec2-sap",
|
||||
"edge-commit",
|
||||
"edge-container",
|
||||
"edge-installer",
|
||||
"tar",
|
||||
"image-installer",
|
||||
"oci",
|
||||
},
|
||||
},
|
||||
{
|
||||
arch: "aarch64",
|
||||
imgNames: []string{
|
||||
"qcow2",
|
||||
"openstack",
|
||||
"ami",
|
||||
"ec2",
|
||||
"edge-commit",
|
||||
"edge-container",
|
||||
"tar",
|
||||
},
|
||||
},
|
||||
{
|
||||
arch: "ppc64le",
|
||||
imgNames: []string{
|
||||
"qcow2",
|
||||
"tar",
|
||||
},
|
||||
},
|
||||
{
|
||||
arch: "s390x",
|
||||
imgNames: []string{
|
||||
"qcow2",
|
||||
"tar",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for _, dist := range rhelFamilyDistros {
|
||||
t.Run(dist.name, func(t *testing.T) {
|
||||
for _, mapping := range imgMap {
|
||||
arch, err := dist.distro.GetArch(mapping.arch)
|
||||
require.NoError(t, err)
|
||||
imageTypes := arch.ListImageTypes()
|
||||
|
||||
var expectedImageTypes []string
|
||||
expectedImageTypes = append(expectedImageTypes, mapping.imgNames...)
|
||||
if dist.name == "rhel" {
|
||||
expectedImageTypes = append(expectedImageTypes, mapping.rhelAdditionalImageTypes...)
|
||||
}
|
||||
|
||||
require.ElementsMatch(t, expectedImageTypes, imageTypes)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestRhel90_ListArches(t *testing.T) {
|
||||
arches := rhel90.New().ListArches()
|
||||
assert.Equal(t, []string{"aarch64", "ppc64le", "s390x", "x86_64"}, arches)
|
||||
}
|
||||
|
||||
func TestRhel90_GetArch(t *testing.T) {
|
||||
arches := []struct {
|
||||
name string
|
||||
errorExpected bool
|
||||
errorExpectedInCentos bool
|
||||
}{
|
||||
{
|
||||
name: "x86_64",
|
||||
},
|
||||
{
|
||||
name: "aarch64",
|
||||
},
|
||||
{
|
||||
name: "ppc64le",
|
||||
},
|
||||
{
|
||||
name: "s390x",
|
||||
},
|
||||
{
|
||||
name: "foo-arch",
|
||||
errorExpected: true,
|
||||
},
|
||||
}
|
||||
|
||||
for _, dist := range rhelFamilyDistros {
|
||||
t.Run(dist.name, func(t *testing.T) {
|
||||
for _, a := range arches {
|
||||
actualArch, err := dist.distro.GetArch(a.name)
|
||||
if a.errorExpected || (a.errorExpectedInCentos && dist.name == "centos") {
|
||||
assert.Nil(t, actualArch)
|
||||
assert.Error(t, err)
|
||||
} else {
|
||||
assert.Equal(t, a.name, actualArch.Name())
|
||||
assert.NoError(t, err)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestRhel90_Name(t *testing.T) {
|
||||
distro := rhel90.New()
|
||||
assert.Equal(t, "rhel-90-beta", distro.Name())
|
||||
}
|
||||
|
||||
func TestRhel90_ModulePlatformID(t *testing.T) {
|
||||
distro := rhel90.New()
|
||||
assert.Equal(t, "platform:el9", distro.ModulePlatformID())
|
||||
}
|
||||
|
||||
func TestRhel90_KernelOption(t *testing.T) {
|
||||
distro_test_common.TestDistro_KernelOption(t, rhel90.New())
|
||||
}
|
||||
|
||||
func TestDistro_CustomFileSystemManifestError(t *testing.T) {
|
||||
r9distro := rhel90.New()
|
||||
bp := blueprint.Blueprint{
|
||||
Customizations: &blueprint.Customizations{
|
||||
Filesystem: []blueprint.FilesystemCustomization{
|
||||
{
|
||||
MinSize: 1024,
|
||||
Mountpoint: "/boot",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
for _, archName := range r9distro.ListArches() {
|
||||
arch, _ := r9distro.GetArch(archName)
|
||||
for _, imgTypeName := range arch.ListImageTypes() {
|
||||
imgType, _ := arch.GetImageType(imgTypeName)
|
||||
_, err := imgType.Manifest(bp.Customizations, distro.ImageOptions{}, nil, nil, 0)
|
||||
if imgTypeName == "edge-commit" || imgTypeName == "edge-container" {
|
||||
assert.EqualError(t, err, "Custom mountpoints are not supported for ostree types")
|
||||
} else if imgTypeName == "edge-installer" {
|
||||
continue
|
||||
} else {
|
||||
assert.EqualError(t, err, "The following custom mountpoints are not supported [\"/boot\"]")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestDistro_TestRootMountPoint(t *testing.T) {
|
||||
r9distro := rhel90.New()
|
||||
bp := blueprint.Blueprint{
|
||||
Customizations: &blueprint.Customizations{
|
||||
Filesystem: []blueprint.FilesystemCustomization{
|
||||
{
|
||||
MinSize: 1024,
|
||||
Mountpoint: "/",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
for _, archName := range r9distro.ListArches() {
|
||||
arch, _ := r9distro.GetArch(archName)
|
||||
for _, imgTypeName := range arch.ListImageTypes() {
|
||||
imgType, _ := arch.GetImageType(imgTypeName)
|
||||
testPackageSpecSets := distro_test_common.GetTestingImagePackageSpecSets("kernel", imgType)
|
||||
_, err := imgType.Manifest(bp.Customizations, distro.ImageOptions{}, nil, testPackageSpecSets, 0)
|
||||
if imgTypeName == "edge-commit" || imgTypeName == "edge-container" {
|
||||
assert.EqualError(t, err, "Custom mountpoints are not supported for ostree types")
|
||||
} else if imgTypeName == "edge-installer" {
|
||||
continue
|
||||
} else {
|
||||
assert.NoError(t, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestDistro_CustomFileSystemSubDirectories(t *testing.T) {
|
||||
r9distro := rhel90.New()
|
||||
bp := blueprint.Blueprint{
|
||||
Customizations: &blueprint.Customizations{
|
||||
Filesystem: []blueprint.FilesystemCustomization{
|
||||
{
|
||||
MinSize: 1024,
|
||||
Mountpoint: "/var/log",
|
||||
},
|
||||
{
|
||||
MinSize: 1024,
|
||||
Mountpoint: "/var/log/audit",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
for _, archName := range r9distro.ListArches() {
|
||||
arch, _ := r9distro.GetArch(archName)
|
||||
for _, imgTypeName := range arch.ListImageTypes() {
|
||||
imgType, _ := arch.GetImageType(imgTypeName)
|
||||
testPackageSpecSets := distro_test_common.GetTestingImagePackageSpecSets("kernel", imgType)
|
||||
_, err := imgType.Manifest(bp.Customizations, distro.ImageOptions{}, nil, testPackageSpecSets, 0)
|
||||
if strings.HasPrefix(imgTypeName, "edge-") {
|
||||
continue
|
||||
} else {
|
||||
assert.NoError(t, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestDistro_MountpointsWithArbitraryDepthAllowed(t *testing.T) {
|
||||
r9distro := rhel90.New()
|
||||
bp := blueprint.Blueprint{
|
||||
Customizations: &blueprint.Customizations{
|
||||
Filesystem: []blueprint.FilesystemCustomization{
|
||||
{
|
||||
MinSize: 1024,
|
||||
Mountpoint: "/var/a",
|
||||
},
|
||||
{
|
||||
MinSize: 1024,
|
||||
Mountpoint: "/var/a/b",
|
||||
},
|
||||
{
|
||||
MinSize: 1024,
|
||||
Mountpoint: "/var/a/b/c",
|
||||
},
|
||||
{
|
||||
MinSize: 1024,
|
||||
Mountpoint: "/var/a/b/c/d",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
for _, archName := range r9distro.ListArches() {
|
||||
arch, _ := r9distro.GetArch(archName)
|
||||
for _, imgTypeName := range arch.ListImageTypes() {
|
||||
imgType, _ := arch.GetImageType(imgTypeName)
|
||||
testPackageSpecSets := distro_test_common.GetTestingImagePackageSpecSets("kernel", imgType)
|
||||
_, err := imgType.Manifest(bp.Customizations, distro.ImageOptions{}, nil, testPackageSpecSets, 0)
|
||||
layout := imgType.PartitionType()
|
||||
if layout == "" || strings.HasPrefix(imgTypeName, "edge-") {
|
||||
continue
|
||||
} else if layout == "gpt" {
|
||||
assert.NoError(t, err)
|
||||
} else {
|
||||
assert.EqualError(t, err, "failed creating volume: maximum number of partitions reached (4)")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestDistro_DirtyMountpointsNotAllowed(t *testing.T) {
|
||||
r9distro := rhel90.New()
|
||||
bp := blueprint.Blueprint{
|
||||
Customizations: &blueprint.Customizations{
|
||||
Filesystem: []blueprint.FilesystemCustomization{
|
||||
{
|
||||
MinSize: 1024,
|
||||
Mountpoint: "//",
|
||||
},
|
||||
{
|
||||
MinSize: 1024,
|
||||
Mountpoint: "/var//",
|
||||
},
|
||||
{
|
||||
MinSize: 1024,
|
||||
Mountpoint: "/var//log/audit/",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
for _, archName := range r9distro.ListArches() {
|
||||
arch, _ := r9distro.GetArch(archName)
|
||||
for _, imgTypeName := range arch.ListImageTypes() {
|
||||
imgType, _ := arch.GetImageType(imgTypeName)
|
||||
_, err := imgType.Manifest(bp.Customizations, distro.ImageOptions{}, nil, nil, 0)
|
||||
if strings.HasPrefix(imgTypeName, "edge-") {
|
||||
continue
|
||||
} else {
|
||||
assert.EqualError(t, err, "The following custom mountpoints are not supported [\"//\" \"/var//\" \"/var//log/audit/\"]")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestDistro_CustomFileSystemPatternMatching(t *testing.T) {
|
||||
r9distro := rhel90.New()
|
||||
bp := blueprint.Blueprint{
|
||||
Customizations: &blueprint.Customizations{
|
||||
Filesystem: []blueprint.FilesystemCustomization{
|
||||
{
|
||||
MinSize: 1024,
|
||||
Mountpoint: "/variable",
|
||||
},
|
||||
{
|
||||
MinSize: 1024,
|
||||
Mountpoint: "/variable/log/audit",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
for _, archName := range r9distro.ListArches() {
|
||||
arch, _ := r9distro.GetArch(archName)
|
||||
for _, imgTypeName := range arch.ListImageTypes() {
|
||||
imgType, _ := arch.GetImageType(imgTypeName)
|
||||
_, err := imgType.Manifest(bp.Customizations, distro.ImageOptions{}, nil, nil, 0)
|
||||
if imgTypeName == "edge-commit" || imgTypeName == "edge-container" {
|
||||
assert.EqualError(t, err, "Custom mountpoints are not supported for ostree types")
|
||||
} else if imgTypeName == "edge-installer" {
|
||||
continue
|
||||
} else {
|
||||
assert.EqualError(t, err, "The following custom mountpoints are not supported [\"/variable\" \"/variable/log/audit\"]")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestDistro_CustomUsrPartitionNotLargeEnough(t *testing.T) {
|
||||
r9distro := rhel90.New()
|
||||
bp := blueprint.Blueprint{
|
||||
Customizations: &blueprint.Customizations{
|
||||
Filesystem: []blueprint.FilesystemCustomization{
|
||||
{
|
||||
MinSize: 1024,
|
||||
Mountpoint: "/usr",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
for _, archName := range r9distro.ListArches() {
|
||||
arch, _ := r9distro.GetArch(archName)
|
||||
for _, imgTypeName := range arch.ListImageTypes() {
|
||||
imgType, _ := arch.GetImageType(imgTypeName)
|
||||
testPackageSpecSets := distro_test_common.GetTestingImagePackageSpecSets("kernel", imgType)
|
||||
_, err := imgType.Manifest(bp.Customizations, distro.ImageOptions{}, nil, testPackageSpecSets, 0)
|
||||
if imgTypeName == "edge-commit" || imgTypeName == "edge-container" {
|
||||
assert.EqualError(t, err, "Custom mountpoints are not supported for ostree types")
|
||||
} else if imgTypeName == "edge-installer" {
|
||||
continue
|
||||
} else {
|
||||
assert.NoError(t, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,451 +0,0 @@
|
|||
package rhel90beta
|
||||
|
||||
// This file defines package sets that are used by more than one image type.
|
||||
|
||||
import "github.com/osbuild/osbuild-composer/internal/rpmmd"
|
||||
|
||||
// BUILD PACKAGE SETS
|
||||
|
||||
// distro-wide build package set
|
||||
func distroBuildPackageSet() rpmmd.PackageSet {
|
||||
return rpmmd.PackageSet{
|
||||
Include: []string{
|
||||
"dnf", "dosfstools", "e2fsprogs", "glibc", "lorax-templates-generic",
|
||||
"lorax-templates-rhel", "policycoreutils",
|
||||
"python3-iniparse", "qemu-img", "selinux-policy-targeted", "systemd",
|
||||
"tar", "xfsprogs", "xz",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// x86_64 build package set
|
||||
func x8664BuildPackageSet() rpmmd.PackageSet {
|
||||
return rpmmd.PackageSet{
|
||||
Include: []string{"grub2-pc"},
|
||||
}
|
||||
}
|
||||
|
||||
// ppc64le build package set
|
||||
func ppc64leBuildPackageSet() rpmmd.PackageSet {
|
||||
return rpmmd.PackageSet{
|
||||
Include: []string{"grub2-ppc64le", "grub2-ppc64le-modules"},
|
||||
}
|
||||
}
|
||||
|
||||
// common ec2 image build package set
|
||||
func ec2BuildPackageSet() rpmmd.PackageSet {
|
||||
return rpmmd.PackageSet{
|
||||
Include: []string{"python3-pyyaml"},
|
||||
}
|
||||
}
|
||||
|
||||
// common edge image build package set
|
||||
func edgeBuildPackageSet() rpmmd.PackageSet {
|
||||
return rpmmd.PackageSet{
|
||||
Include: []string{"rpm-ostree"},
|
||||
Exclude: nil,
|
||||
}
|
||||
}
|
||||
|
||||
// x86_64 installer ISO build package set
|
||||
// TODO: separate into common installer and arch specific sets
|
||||
func x8664InstallerBuildPackageSet() rpmmd.PackageSet {
|
||||
return rpmmd.PackageSet{
|
||||
Include: []string{
|
||||
"efibootmgr", "grub2-efi-ia32-cdboot",
|
||||
"grub2-efi-x64", "grub2-efi-x64-cdboot", "grub2-pc",
|
||||
"grub2-pc-modules", "grub2-tools", "grub2-tools-efi",
|
||||
"grub2-tools-extra", "grub2-tools-minimal", "isomd5sum",
|
||||
"rpm-ostree", "shim-ia32", "shim-x64", "squashfs-tools",
|
||||
"syslinux", "syslinux-nonlinux", "xorriso",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// BOOT PACKAGE SETS
|
||||
|
||||
// x86_64 Legacy arch-specific boot package set
|
||||
func x8664LegacyBootPackageSet() rpmmd.PackageSet {
|
||||
return rpmmd.PackageSet{
|
||||
Include: []string{"dracut-config-generic", "grub2-pc"},
|
||||
}
|
||||
}
|
||||
|
||||
// x86_64 UEFI arch-specific boot package set
|
||||
func x8664UEFIBootPackageSet() rpmmd.PackageSet {
|
||||
return rpmmd.PackageSet{
|
||||
Include: []string{"dracut-config-generic", "grub2-efi-x64", "shim-x64"},
|
||||
}
|
||||
}
|
||||
|
||||
// aarch64 UEFI arch-specific boot package set
|
||||
func aarch64UEFIBootPackageSet() rpmmd.PackageSet {
|
||||
return rpmmd.PackageSet{
|
||||
Include: []string{
|
||||
"dracut-config-generic", "efibootmgr", "grub2-efi-aa64",
|
||||
"grub2-tools", "shim-aa64",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// ppc64le Legacy arch-specific boot package set
|
||||
func ppc64leLegacyBootPackageSet() rpmmd.PackageSet {
|
||||
return rpmmd.PackageSet{
|
||||
Include: []string{
|
||||
"dracut-config-generic", "powerpc-utils", "grub2-ppc64le",
|
||||
"grub2-ppc64le-modules",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// s390x Legacy arch-specific boot package set
|
||||
func s390xLegacyBootPackageSet() rpmmd.PackageSet {
|
||||
return rpmmd.PackageSet{
|
||||
Include: []string{"dracut-config-generic", "s390utils-base"},
|
||||
}
|
||||
}
|
||||
|
||||
// OS package sets
|
||||
|
||||
func qcow2CommonPackageSet() rpmmd.PackageSet {
|
||||
return rpmmd.PackageSet{
|
||||
Include: []string{
|
||||
"@core", "authselect-compat", "chrony", "cloud-init",
|
||||
"cloud-utils-growpart", "cockpit-system", "cockpit-ws",
|
||||
"dnf", "dnf-utils", "dosfstools",
|
||||
"insights-client", "NetworkManager", "nfs-utils",
|
||||
"oddjob", "oddjob-mkhomedir", "psmisc", "python3-jsonschema",
|
||||
"qemu-guest-agent", "redhat-release", "redhat-release-eula",
|
||||
"rsync", "subscription-manager-cockpit", "tar", "tcpdump", "yum",
|
||||
},
|
||||
Exclude: []string{
|
||||
"aic94xx-firmware", "alsa-firmware", "alsa-lib",
|
||||
"alsa-tools-firmware", "biosdevname", "dnf-plugin-spacewalk",
|
||||
"dracut-config-rescue", "fedora-release", "fedora-repos",
|
||||
"firewalld", "iprutils", "ivtv-firmware",
|
||||
"iwl100-firmware", "iwl1000-firmware", "iwl105-firmware",
|
||||
"iwl135-firmware", "iwl2000-firmware", "iwl2030-firmware",
|
||||
"iwl3160-firmware", "iwl3945-firmware", "iwl4965-firmware",
|
||||
"iwl5000-firmware", "iwl5150-firmware", "iwl6000-firmware",
|
||||
"iwl6000g2a-firmware", "iwl6000g2b-firmware", "iwl6050-firmware",
|
||||
"iwl7260-firmware", "langpacks-*", "langpacks-en", "langpacks-en",
|
||||
"libertas-sd8686-firmware", "libertas-sd8787-firmware",
|
||||
"libertas-usb8388-firmware", "nss", "plymouth", "rng-tools",
|
||||
"udisks2",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func vhdCommonPackageSet() rpmmd.PackageSet {
|
||||
return rpmmd.PackageSet{
|
||||
Include: []string{
|
||||
// Defaults
|
||||
"@Core", "langpacks-en",
|
||||
|
||||
// From the lorax kickstart
|
||||
"selinux-policy-targeted", "chrony", "WALinuxAgent", "python3",
|
||||
"net-tools", "cloud-init", "cloud-utils-growpart", "gdisk",
|
||||
|
||||
// removed from defaults but required to boot in azure
|
||||
"dhcp-client",
|
||||
},
|
||||
Exclude: []string{
|
||||
"dracut-config-rescue", "rng-tools",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func vmdkCommonPackageSet() rpmmd.PackageSet {
|
||||
return rpmmd.PackageSet{
|
||||
Include: []string{
|
||||
"@core", "chrony", "firewalld", "langpacks-en", "open-vm-tools",
|
||||
"selinux-policy-targeted",
|
||||
},
|
||||
Exclude: []string{
|
||||
"dracut-config-rescue", "rng-tools",
|
||||
},
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func openstackCommonPackageSet() rpmmd.PackageSet {
|
||||
return rpmmd.PackageSet{
|
||||
Include: []string{
|
||||
// Defaults
|
||||
"@Core", "langpacks-en",
|
||||
|
||||
// From the lorax kickstart
|
||||
"selinux-policy-targeted", "cloud-init", "qemu-guest-agent",
|
||||
"spice-vdagent",
|
||||
},
|
||||
Exclude: []string{
|
||||
"dracut-config-rescue", "rng-tools",
|
||||
},
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func ec2CommonPackageSet() rpmmd.PackageSet {
|
||||
return rpmmd.PackageSet{
|
||||
Include: []string{
|
||||
"@core", "authselect-compat", "chrony", "cloud-init", "cloud-utils-growpart",
|
||||
"dhcp-client", "yum-utils", "dracut-config-generic", "gdisk",
|
||||
"grub2", "insights-client", "langpacks-en", "NetworkManager",
|
||||
"NetworkManager-cloud-setup", "redhat-release",
|
||||
"redhat-release-eula", "rsync", "tar", "qemu-guest-agent",
|
||||
},
|
||||
Exclude: []string{
|
||||
"aic94xx-firmware", "alsa-firmware",
|
||||
"alsa-tools-firmware", "biosdevname", "firewalld", "iprutils", "ivtv-firmware",
|
||||
"iwl1000-firmware", "iwl100-firmware", "iwl105-firmware",
|
||||
"iwl135-firmware", "iwl2000-firmware", "iwl2030-firmware",
|
||||
"iwl3160-firmware", "iwl3945-firmware", "iwl4965-firmware",
|
||||
"iwl5000-firmware", "iwl5150-firmware", "iwl6000-firmware",
|
||||
"iwl6000g2a-firmware", "iwl6000g2b-firmware", "iwl6050-firmware",
|
||||
"iwl7260-firmware", "libertas-sd8686-firmware",
|
||||
"libertas-sd8787-firmware", "libertas-usb8388-firmware",
|
||||
"plymouth",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// rhel-ec2 image package set
|
||||
func rhelEc2PackageSet() rpmmd.PackageSet {
|
||||
ec2PackageSet := ec2CommonPackageSet()
|
||||
ec2PackageSet.Include = append(ec2PackageSet.Include, "rh-amazon-rhui-client")
|
||||
ec2PackageSet.Exclude = append(ec2PackageSet.Exclude, "alsa-lib")
|
||||
return ec2PackageSet
|
||||
}
|
||||
|
||||
// rhel-ha-ec2 image package set
|
||||
func rhelEc2HaPackageSet() rpmmd.PackageSet {
|
||||
ec2HaPackageSet := ec2CommonPackageSet()
|
||||
ec2HaPackageSet.Include = append(ec2HaPackageSet.Include,
|
||||
"fence-agents-all",
|
||||
"pacemaker",
|
||||
"pcs",
|
||||
"rh-amazon-rhui-client-ha",
|
||||
)
|
||||
ec2HaPackageSet.Exclude = append(ec2HaPackageSet.Exclude, "alsa-lib")
|
||||
return ec2HaPackageSet
|
||||
}
|
||||
|
||||
// rhel-sap-ec2 image package set
|
||||
func rhelEc2SapPackageSet() rpmmd.PackageSet {
|
||||
ec2SapPackageSet := ec2CommonPackageSet()
|
||||
ec2SapPackageSet.Include = append(ec2SapPackageSet.Include,
|
||||
// SAP System Roles
|
||||
// https://access.redhat.com/sites/default/files/attachments/rhel_system_roles_for_sap_1.pdf
|
||||
"ansible-core",
|
||||
"rhel-system-roles-sap",
|
||||
// RHBZ#1959813
|
||||
"bind-utils",
|
||||
//"compat-sap-c++-9", // not needed on RHEL-9
|
||||
"nfs-utils",
|
||||
"tcsh",
|
||||
// RHBZ#1959955
|
||||
"uuidd",
|
||||
// RHBZ#1959923
|
||||
"cairo",
|
||||
"expect",
|
||||
"graphviz",
|
||||
"gtk2",
|
||||
"iptraf-ng",
|
||||
"krb5-workstation",
|
||||
"libaio",
|
||||
"libatomic",
|
||||
"libcanberra-gtk2",
|
||||
"libicu",
|
||||
//"libpng12", // not needed on RHEL-9
|
||||
"libtool-ltdl",
|
||||
"lm_sensors",
|
||||
"net-tools",
|
||||
"numactl",
|
||||
"PackageKit-gtk3-module",
|
||||
"xorg-x11-xauth",
|
||||
// RHBZ#1960617
|
||||
"tuned-profiles-sap-hana",
|
||||
// RHBZ#1961168
|
||||
"libnsl",
|
||||
// RHUI client
|
||||
"rh-amazon-rhui-client-sap-bundle-e4s",
|
||||
)
|
||||
return ec2SapPackageSet
|
||||
}
|
||||
|
||||
// edge commit OS package set
|
||||
func edgeCommitPackageSet() rpmmd.PackageSet {
|
||||
return rpmmd.PackageSet{
|
||||
Include: []string{
|
||||
"redhat-release", "glibc", "glibc-minimal-langpack",
|
||||
"nss-altfiles", "dracut-config-generic", "dracut-network",
|
||||
"basesystem", "bash", "platform-python", "shadow-utils", "chrony",
|
||||
"setup", "shadow-utils", "sudo", "systemd", "coreutils",
|
||||
"util-linux", "curl", "vim-minimal", "rpm", "rpm-ostree", "polkit",
|
||||
"lvm2", "cryptsetup", "pinentry", "e2fsprogs", "dosfstools",
|
||||
"keyutils", "gnupg2", "attr", "xz", "gzip", "firewalld",
|
||||
"iptables", "NetworkManager", "NetworkManager-wifi",
|
||||
"NetworkManager-wwan", "wpa_supplicant", "dnsmasq", "traceroute",
|
||||
"hostname", "iproute", "iputils", "openssh-clients", "procps-ng",
|
||||
"rootfiles", "openssh-server", "passwd", "policycoreutils",
|
||||
"policycoreutils-python-utils", "selinux-policy-targeted",
|
||||
"setools-console", "less", "tar", "rsync", "fwupd", "usbguard",
|
||||
"bash-completion", "tmux", "ima-evm-utils", "audit", "podman",
|
||||
"container-selinux", "skopeo", "criu", "slirp4netns",
|
||||
"fuse-overlayfs", "clevis", "clevis-dracut", "clevis-luks",
|
||||
"greenboot", "greenboot-grub2", "greenboot-rpm-ostree-grub2",
|
||||
"greenboot-reboot", "greenboot-status",
|
||||
},
|
||||
Exclude: []string{"rng-tools"},
|
||||
}
|
||||
}
|
||||
|
||||
func x8664EdgeCommitPackageSet() rpmmd.PackageSet {
|
||||
return rpmmd.PackageSet{
|
||||
Include: []string{
|
||||
"grub2", "grub2-efi-x64", "efibootmgr", "shim-x64",
|
||||
"microcode_ctl", "iwl1000-firmware", "iwl100-firmware",
|
||||
"iwl105-firmware", "iwl135-firmware", "iwl2000-firmware",
|
||||
"iwl2030-firmware", "iwl3160-firmware", "iwl5000-firmware",
|
||||
"iwl5150-firmware", "iwl6050-firmware",
|
||||
"iwl7260-firmware",
|
||||
},
|
||||
Exclude: nil,
|
||||
}
|
||||
}
|
||||
|
||||
func aarch64EdgeCommitPackageSet() rpmmd.PackageSet {
|
||||
return rpmmd.PackageSet{
|
||||
Include: []string{"grub2-efi-aa64", "efibootmgr", "shim-aa64", "iwl7260-firmware"},
|
||||
Exclude: nil,
|
||||
}
|
||||
}
|
||||
|
||||
// INSTALLER PACKAGE SET
|
||||
func installerPackageSet() rpmmd.PackageSet {
|
||||
// TODO: simplify
|
||||
return rpmmd.PackageSet{
|
||||
Include: []string{
|
||||
"aajohan-comfortaa-fonts", "abattis-cantarell-fonts",
|
||||
"alsa-firmware", "alsa-tools-firmware", "anaconda",
|
||||
"anaconda-dracut", "anaconda-install-env-deps", "anaconda-widgets",
|
||||
"audit", "bind-utils", "biosdevname", "bitmap-fangsongti-fonts",
|
||||
"bzip2", "cryptsetup", "curl", "dbus-x11", "dejavu-sans-fonts",
|
||||
"dejavu-sans-mono-fonts", "device-mapper-persistent-data",
|
||||
"dmidecode", "dnf", "dracut-config-generic", "dracut-network",
|
||||
/*"dump",*/ "efibootmgr", "ethtool", "ftp", "gdb-gdbserver", "gdisk",
|
||||
/*"gfs2-utils",*/ "glibc-all-langpacks", "gnome-kiosk",
|
||||
"google-noto-sans-cjk-ttc-fonts", "grub2-efi-ia32-cdboot",
|
||||
"grub2-efi-x64-cdboot", "grub2-tools", "grub2-tools-efi",
|
||||
"grub2-tools-extra", "grub2-tools-minimal", "grubby",
|
||||
"gsettings-desktop-schemas", "hdparm", "hexedit", "hostname",
|
||||
"initscripts", "ipmitool", "iwl1000-firmware", "iwl100-firmware",
|
||||
"iwl105-firmware", "iwl135-firmware", "iwl2000-firmware",
|
||||
"iwl2030-firmware", "iwl3160-firmware", /*"iwl3945-firmware",*/
|
||||
/*"iwl4965-firmware",*/ "iwl5000-firmware", "iwl5150-firmware",
|
||||
/*"iwl6000-firmware",*/ "iwl6000g2a-firmware", "iwl6000g2b-firmware",
|
||||
"iwl6050-firmware", "iwl7260-firmware", "jomolhari-fonts",
|
||||
"kacst-farsi-fonts", "kacst-qurn-fonts", "kbd", "kbd-misc",
|
||||
"kdump-anaconda-addon", "kernel", "khmeros-base-fonts", "less",
|
||||
"libblockdev-lvm-dbus", /*"libertas-sd8686-firmware",*/
|
||||
/*"libertas-sd8787-firmware",*/ /*"libertas-usb8388-firmware",*/
|
||||
/*"libertas-usb8388-olpc-firmware",*/ "libibverbs",
|
||||
"libreport-plugin-bugzilla", "libreport-plugin-reportuploader",
|
||||
/*"libreport-rhel-anaconda-bugzilla",*/ "librsvg2", "linux-firmware",
|
||||
"lklug-fonts", "lohit-assamese-fonts", "lohit-bengali-fonts",
|
||||
"lohit-devanagari-fonts", "lohit-gujarati-fonts",
|
||||
"lohit-gurmukhi-fonts", "lohit-kannada-fonts", "lohit-odia-fonts",
|
||||
"lohit-tamil-fonts", "lohit-telugu-fonts", "lsof", "madan-fonts",
|
||||
"memtest86+" /*"metacity",*/, "mtr", "mt-st", "net-tools", "nfs-utils",
|
||||
"nmap-ncat", "nm-connection-editor", "nss-tools",
|
||||
"openssh-clients", "openssh-server", "oscap-anaconda-addon",
|
||||
"ostree", "pciutils", "perl-interpreter", "pigz", "plymouth",
|
||||
"prefixdevname", "python3-pyatspi", "rdma-core",
|
||||
"redhat-release-eula", "rng-tools", "rpcbind", "rpm-ostree",
|
||||
"rsync", "rsyslog", "selinux-policy-targeted", "sg3_utils",
|
||||
"shim-ia32", "shim-x64", "sil-abyssinica-fonts",
|
||||
"sil-padauk-fonts", "sil-scheherazade-fonts", "smartmontools",
|
||||
"smc-meera-fonts", "spice-vdagent", "strace", "syslinux",
|
||||
"systemd" /*"system-storage-manager",*/, "tar",
|
||||
"thai-scalable-waree-fonts", "tigervnc-server-minimal",
|
||||
"tigervnc-server-module", "udisks2", "udisks2-iscsi", "usbutils",
|
||||
"vim-minimal", "volume_key", "wget", "xfsdump", "xfsprogs",
|
||||
"xorg-x11-drivers", "xorg-x11-fonts-misc", "xorg-x11-server-utils",
|
||||
"xorg-x11-server-Xorg", "xorg-x11-xauth", "xz",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func edgeInstallerPackageSet() rpmmd.PackageSet {
|
||||
return rpmmd.PackageSet{
|
||||
Include: []string{
|
||||
"aajohan-comfortaa-fonts", "abattis-cantarell-fonts",
|
||||
"alsa-firmware", "alsa-tools-firmware", "anaconda",
|
||||
"anaconda-dracut", "anaconda-install-env-deps", "anaconda-widgets",
|
||||
"audit", "bind-utils", "biosdevname", "bitmap-fangsongti-fonts",
|
||||
"bzip2", "cryptsetup", "curl", "dbus-x11", "dejavu-sans-fonts",
|
||||
"dejavu-sans-mono-fonts", "device-mapper-persistent-data",
|
||||
"dmidecode", "dnf", "dracut-config-generic", "dracut-network",
|
||||
/*"dump",*/ "efibootmgr", "ethtool", "ftp", "gdb-gdbserver", "gdisk",
|
||||
/*"gfs2-utils",*/ "glibc-all-langpacks", "gnome-kiosk",
|
||||
"google-noto-sans-cjk-ttc-fonts", "grub2-efi-ia32-cdboot",
|
||||
"grub2-efi-x64-cdboot", "grub2-tools", "grub2-tools-efi",
|
||||
"grub2-tools-extra", "grub2-tools-minimal", "grubby",
|
||||
"gsettings-desktop-schemas", "hdparm", "hexedit", "hostname",
|
||||
"initscripts", "ipmitool", "iwl1000-firmware", "iwl100-firmware",
|
||||
"iwl105-firmware", "iwl135-firmware", "iwl2000-firmware",
|
||||
"iwl2030-firmware", "iwl3160-firmware", /*"iwl3945-firmware",*/
|
||||
/*"iwl4965-firmware",*/ "iwl5000-firmware", "iwl5150-firmware",
|
||||
"iwl6000g2a-firmware", "iwl6000g2b-firmware",
|
||||
"iwl6050-firmware", "iwl7260-firmware", "jomolhari-fonts",
|
||||
"kacst-farsi-fonts", "kacst-qurn-fonts", "kbd", "kbd-misc",
|
||||
"kdump-anaconda-addon", "kernel", "khmeros-base-fonts", "less",
|
||||
"libblockdev-lvm-dbus", /*"libertas-sd8686-firmware",*/
|
||||
/*"libertas-sd8787-firmware",*/ /*"libertas-usb8388-firmware",*/
|
||||
/*"libertas-usb8388-olpc-firmware",*/ "libibverbs",
|
||||
"libreport-plugin-bugzilla", "libreport-plugin-reportuploader",
|
||||
/*"libreport-rhel-anaconda-bugzilla",*/ "librsvg2", "linux-firmware",
|
||||
"lklug-fonts", "lohit-assamese-fonts", "lohit-bengali-fonts",
|
||||
"lohit-devanagari-fonts", "lohit-gujarati-fonts",
|
||||
"lohit-gurmukhi-fonts", "lohit-kannada-fonts", "lohit-odia-fonts",
|
||||
"lohit-tamil-fonts", "lohit-telugu-fonts", "lsof", "madan-fonts",
|
||||
"memtest86+" /*"metacity",*/, "mtr", "mt-st", "net-tools", "nfs-utils",
|
||||
"nmap-ncat", "nm-connection-editor", "nss-tools",
|
||||
"openssh-clients", "openssh-server", "oscap-anaconda-addon",
|
||||
"ostree", "pciutils", "perl-interpreter", "pigz", "plymouth",
|
||||
"prefixdevname", "python3-pyatspi", "rdma-core",
|
||||
"redhat-release-eula", "rng-tools", "rpcbind", "rpm-ostree",
|
||||
"rsync", "rsyslog", "selinux-policy-targeted", "sg3_utils",
|
||||
"shim-ia32", "shim-x64", "sil-abyssinica-fonts",
|
||||
"sil-padauk-fonts", "sil-scheherazade-fonts", "smartmontools",
|
||||
"smc-meera-fonts", "spice-vdagent", "strace", "syslinux",
|
||||
"systemd" /*"system-storage-manager",*/, "tar",
|
||||
"thai-scalable-waree-fonts", "tigervnc-server-minimal",
|
||||
"tigervnc-server-module", "udisks2", "udisks2-iscsi", "usbutils",
|
||||
"vim-minimal", "volume_key", "wget", "xfsdump", "xfsprogs",
|
||||
"xorg-x11-drivers", "xorg-x11-fonts-misc", "xorg-x11-server-utils",
|
||||
"xorg-x11-server-Xorg", "xorg-x11-xauth", "xz",
|
||||
},
|
||||
Exclude: nil,
|
||||
}
|
||||
}
|
||||
|
||||
func bareMetalPackageSet() rpmmd.PackageSet {
|
||||
return rpmmd.PackageSet{
|
||||
Include: []string{
|
||||
"authselect-compat", "chrony", "cockpit-system", "cockpit-ws",
|
||||
"@core", "dhcp-client", "dnf", "dnf-utils", "dosfstools",
|
||||
"insights-client", "iwl1000-firmware", "iwl100-firmware",
|
||||
"iwl105-firmware", "iwl135-firmware", "iwl2000-firmware",
|
||||
"iwl2030-firmware", "iwl3160-firmware", "iwl5000-firmware",
|
||||
"iwl5150-firmware", "iwl6000g2a-firmware", "iwl6000g2b-firmware",
|
||||
"iwl6050-firmware", "iwl7260-firmware", "lvm2", "net-tools",
|
||||
"NetworkManager", "nfs-utils", "oddjob", "oddjob-mkhomedir",
|
||||
"policycoreutils", "psmisc", "python3-jsonschema",
|
||||
"qemu-guest-agent", "redhat-release", "redhat-release-eula",
|
||||
"rsync", "selinux-policy-targeted", "subscription-manager-cockpit",
|
||||
"tar", "tcpdump", "yum",
|
||||
},
|
||||
Exclude: nil,
|
||||
}
|
||||
}
|
||||
|
|
@ -1,199 +0,0 @@
|
|||
package rhel90beta
|
||||
|
||||
import (
|
||||
"github.com/osbuild/osbuild-composer/internal/disk"
|
||||
"github.com/osbuild/osbuild-composer/internal/distro"
|
||||
)
|
||||
|
||||
const (
|
||||
// For historical reasons the 8.5/9.0 beta images had some
|
||||
// extra padding at the end. The reason was to leave space
|
||||
// for the secondary GPT header, but it was too much and
|
||||
// also done for MBR. Since image definitions are frozen,
|
||||
// we keep this extra padding around.
|
||||
ExtraPaddingGPT = uint64(34304)
|
||||
ExtraPaddingMBR = uint64(51200)
|
||||
)
|
||||
|
||||
var defaultBasePartitionTables = distro.BasePartitionTableMap{
|
||||
distro.X86_64ArchName: disk.PartitionTable{
|
||||
UUID: "D209C89E-EA5E-4FBD-B161-B461CCE297E0",
|
||||
Type: "gpt",
|
||||
ExtraPadding: ExtraPaddingGPT,
|
||||
Partitions: []disk.Partition{
|
||||
{
|
||||
Size: 1048576,
|
||||
Bootable: true,
|
||||
Type: disk.BIOSBootPartitionGUID,
|
||||
UUID: disk.BIOSBootPartitionUUID,
|
||||
},
|
||||
{
|
||||
Size: 104857600,
|
||||
Type: disk.EFISystemPartitionGUID,
|
||||
UUID: disk.EFISystemPartitionUUID,
|
||||
Payload: &disk.Filesystem{
|
||||
Type: "vfat",
|
||||
UUID: disk.EFIFilesystemUUID,
|
||||
Mountpoint: "/boot/efi",
|
||||
FSTabOptions: "defaults,uid=0,gid=0,umask=077,shortname=winnt",
|
||||
FSTabFreq: 0,
|
||||
FSTabPassNo: 2,
|
||||
},
|
||||
},
|
||||
{
|
||||
Type: disk.FilesystemDataGUID,
|
||||
UUID: disk.RootPartitionUUID,
|
||||
Payload: &disk.Filesystem{
|
||||
Type: "xfs",
|
||||
Label: "root",
|
||||
Mountpoint: "/",
|
||||
FSTabOptions: "defaults",
|
||||
FSTabFreq: 0,
|
||||
FSTabPassNo: 0,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
distro.Aarch64ArchName: disk.PartitionTable{
|
||||
UUID: "D209C89E-EA5E-4FBD-B161-B461CCE297E0",
|
||||
Type: "gpt",
|
||||
ExtraPadding: ExtraPaddingGPT,
|
||||
Partitions: []disk.Partition{
|
||||
{
|
||||
Size: 104857600,
|
||||
Type: disk.EFISystemPartitionGUID,
|
||||
UUID: disk.EFISystemPartitionUUID,
|
||||
Payload: &disk.Filesystem{
|
||||
Type: "vfat",
|
||||
UUID: disk.EFIFilesystemUUID,
|
||||
Mountpoint: "/boot/efi",
|
||||
FSTabOptions: "defaults,uid=0,gid=0,umask=077,shortname=winnt",
|
||||
FSTabFreq: 0,
|
||||
FSTabPassNo: 2,
|
||||
},
|
||||
},
|
||||
{
|
||||
Type: disk.FilesystemDataGUID,
|
||||
UUID: disk.RootPartitionUUID,
|
||||
Payload: &disk.Filesystem{
|
||||
Type: "xfs",
|
||||
Label: "root",
|
||||
Mountpoint: "/",
|
||||
FSTabOptions: "defaults",
|
||||
FSTabFreq: 0,
|
||||
FSTabPassNo: 0,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
distro.Ppc64leArchName: disk.PartitionTable{
|
||||
UUID: "0x14fc63d2",
|
||||
Type: "dos",
|
||||
ExtraPadding: ExtraPaddingMBR,
|
||||
Partitions: []disk.Partition{
|
||||
{
|
||||
Size: 4194304,
|
||||
Type: "41",
|
||||
Bootable: true,
|
||||
},
|
||||
{
|
||||
Payload: &disk.Filesystem{
|
||||
Type: "xfs",
|
||||
Mountpoint: "/",
|
||||
FSTabOptions: "defaults",
|
||||
FSTabFreq: 0,
|
||||
FSTabPassNo: 0,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
distro.S390xArchName: disk.PartitionTable{
|
||||
UUID: "0x14fc63d2",
|
||||
Type: "dos",
|
||||
ExtraPadding: ExtraPaddingMBR,
|
||||
Partitions: []disk.Partition{
|
||||
{
|
||||
Bootable: true,
|
||||
Payload: &disk.Filesystem{
|
||||
Type: "xfs",
|
||||
Mountpoint: "/",
|
||||
FSTabOptions: "defaults",
|
||||
FSTabFreq: 0,
|
||||
FSTabPassNo: 0,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
var ec2BasePartitionTables = distro.BasePartitionTableMap{
|
||||
distro.X86_64ArchName: disk.PartitionTable{
|
||||
UUID: "D209C89E-EA5E-4FBD-B161-B461CCE297E0",
|
||||
Type: "gpt",
|
||||
ExtraPadding: ExtraPaddingGPT,
|
||||
Partitions: []disk.Partition{
|
||||
{
|
||||
Size: 1048576,
|
||||
Bootable: true,
|
||||
Type: disk.BIOSBootPartitionGUID,
|
||||
UUID: disk.BIOSBootPartitionUUID,
|
||||
},
|
||||
{
|
||||
Type: disk.FilesystemDataGUID,
|
||||
UUID: disk.RootPartitionUUID,
|
||||
Payload: &disk.Filesystem{
|
||||
Type: "xfs",
|
||||
Label: "root",
|
||||
Mountpoint: "/",
|
||||
FSTabOptions: "defaults",
|
||||
FSTabFreq: 0,
|
||||
FSTabPassNo: 0,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
distro.Aarch64ArchName: disk.PartitionTable{
|
||||
UUID: "D209C89E-EA5E-4FBD-B161-B461CCE297E0",
|
||||
Type: "gpt",
|
||||
ExtraPadding: ExtraPaddingGPT,
|
||||
Partitions: []disk.Partition{
|
||||
{
|
||||
Size: 209715200,
|
||||
Type: disk.EFISystemPartitionGUID,
|
||||
UUID: disk.EFISystemPartitionUUID,
|
||||
Payload: &disk.Filesystem{
|
||||
Type: "vfat",
|
||||
UUID: disk.EFIFilesystemUUID,
|
||||
Mountpoint: "/boot/efi",
|
||||
FSTabOptions: "defaults,uid=0,gid=0,umask=077,shortname=winnt",
|
||||
FSTabFreq: 0,
|
||||
FSTabPassNo: 2,
|
||||
},
|
||||
},
|
||||
{
|
||||
Size: 536870912,
|
||||
Type: disk.FilesystemDataGUID,
|
||||
UUID: disk.FilesystemDataUUID,
|
||||
Payload: &disk.Filesystem{
|
||||
Type: "xfs",
|
||||
Mountpoint: "/boot",
|
||||
FSTabOptions: "defaults",
|
||||
FSTabFreq: 0,
|
||||
FSTabPassNo: 0,
|
||||
},
|
||||
},
|
||||
{
|
||||
Type: disk.FilesystemDataGUID,
|
||||
UUID: disk.RootPartitionUUID,
|
||||
Payload: &disk.Filesystem{
|
||||
Type: "xfs",
|
||||
Label: "root",
|
||||
Mountpoint: "/",
|
||||
FSTabOptions: "defaults",
|
||||
FSTabFreq: 0,
|
||||
FSTabPassNo: 0,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,209 +0,0 @@
|
|||
package rhel90beta
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/osbuild/osbuild-composer/internal/blueprint"
|
||||
osbuild "github.com/osbuild/osbuild-composer/internal/osbuild2"
|
||||
)
|
||||
|
||||
const (
|
||||
kspath = "/osbuild.ks"
|
||||
)
|
||||
|
||||
// selinuxStageOptions returns the options for the org.osbuild.selinux stage.
|
||||
// Setting the argument to 'true' relabels the '/usr/bin/cp' and '/usr/bin/tar'
|
||||
// binaries with 'install_exec_t'. This should be set in the build root.
|
||||
func selinuxStageOptions(labelcp bool) *osbuild.SELinuxStageOptions {
|
||||
options := &osbuild.SELinuxStageOptions{
|
||||
FileContexts: "etc/selinux/targeted/contexts/files/file_contexts",
|
||||
}
|
||||
if labelcp {
|
||||
options.Labels = map[string]string{
|
||||
"/usr/bin/cp": "system_u:object_r:install_exec_t:s0",
|
||||
"/usr/bin/tar": "system_u:object_r:install_exec_t:s0",
|
||||
}
|
||||
}
|
||||
return options
|
||||
}
|
||||
|
||||
func usersFirstBootOptions(usersStageOptions *osbuild.UsersStageOptions) *osbuild.FirstBootStageOptions {
|
||||
cmds := make([]string, 0, 3*len(usersStageOptions.Users)+1)
|
||||
// workaround for creating authorized_keys file for user
|
||||
varhome := filepath.Join("/var", "home")
|
||||
for name, user := range usersStageOptions.Users {
|
||||
if user.Key != nil {
|
||||
sshdir := filepath.Join(varhome, name, ".ssh")
|
||||
cmds = append(cmds, fmt.Sprintf("mkdir -p %s", sshdir))
|
||||
cmds = append(cmds, fmt.Sprintf("sh -c 'echo %q >> %q'", *user.Key, filepath.Join(sshdir, "authorized_keys")))
|
||||
cmds = append(cmds, fmt.Sprintf("chown %s:%s -Rc %s", name, name, sshdir))
|
||||
}
|
||||
}
|
||||
cmds = append(cmds, fmt.Sprintf("restorecon -rvF %s", varhome))
|
||||
options := &osbuild.FirstBootStageOptions{
|
||||
Commands: cmds,
|
||||
WaitForNetwork: false,
|
||||
}
|
||||
|
||||
return options
|
||||
}
|
||||
|
||||
func firewallStageOptions(firewall *blueprint.FirewallCustomization) *osbuild.FirewallStageOptions {
|
||||
options := osbuild.FirewallStageOptions{
|
||||
Ports: firewall.Ports,
|
||||
}
|
||||
|
||||
if firewall.Services != nil {
|
||||
options.EnabledServices = firewall.Services.Enabled
|
||||
options.DisabledServices = firewall.Services.Disabled
|
||||
}
|
||||
|
||||
return &options
|
||||
}
|
||||
|
||||
func systemdStageOptions(enabledServices, disabledServices []string, s *blueprint.ServicesCustomization, target string) *osbuild.SystemdStageOptions {
|
||||
if s != nil {
|
||||
enabledServices = append(enabledServices, s.Enabled...)
|
||||
disabledServices = append(disabledServices, s.Disabled...)
|
||||
}
|
||||
return &osbuild.SystemdStageOptions{
|
||||
EnabledServices: enabledServices,
|
||||
DisabledServices: disabledServices,
|
||||
DefaultTarget: target,
|
||||
}
|
||||
}
|
||||
|
||||
func buildStampStageOptions(arch string) *osbuild.BuildstampStageOptions {
|
||||
return &osbuild.BuildstampStageOptions{
|
||||
Arch: arch,
|
||||
Product: "Red Hat Enterprise Linux",
|
||||
Version: osVersion,
|
||||
Variant: "edge",
|
||||
Final: true,
|
||||
}
|
||||
}
|
||||
|
||||
func loraxScriptStageOptions(arch string) *osbuild.LoraxScriptStageOptions {
|
||||
return &osbuild.LoraxScriptStageOptions{
|
||||
Path: "99-generic/runtime-postinstall.tmpl",
|
||||
BaseArch: arch,
|
||||
}
|
||||
}
|
||||
|
||||
func dracutStageOptions(kernelVer string) *osbuild.DracutStageOptions {
|
||||
kernel := []string{kernelVer}
|
||||
modules := []string{
|
||||
"bash",
|
||||
"systemd",
|
||||
"fips",
|
||||
"systemd-initrd",
|
||||
"modsign",
|
||||
"nss-softokn",
|
||||
"rdma",
|
||||
"rngd",
|
||||
"i18n",
|
||||
"convertfs",
|
||||
"network-manager",
|
||||
"network",
|
||||
"ifcfg",
|
||||
"url-lib",
|
||||
"drm",
|
||||
"plymouth",
|
||||
"prefixdevname",
|
||||
"prefixdevname-tools",
|
||||
"anaconda",
|
||||
"crypt",
|
||||
"dm",
|
||||
"dmsquash-live",
|
||||
"kernel-modules",
|
||||
"kernel-modules-extra",
|
||||
"kernel-network-modules",
|
||||
"livenet",
|
||||
"lvm",
|
||||
"mdraid",
|
||||
"multipath",
|
||||
"qemu",
|
||||
"qemu-net",
|
||||
"fcoe",
|
||||
"fcoe-uefi",
|
||||
"iscsi",
|
||||
"lunmask",
|
||||
"nfs",
|
||||
"resume",
|
||||
"rootfs-block",
|
||||
"terminfo",
|
||||
"udev-rules",
|
||||
"biosdevname",
|
||||
"dracut-systemd",
|
||||
"pollcdrom",
|
||||
"usrmount",
|
||||
"base",
|
||||
"fs-lib",
|
||||
"img-lib",
|
||||
"shutdown",
|
||||
"uefi-lib",
|
||||
}
|
||||
return &osbuild.DracutStageOptions{
|
||||
Kernel: kernel,
|
||||
Modules: modules,
|
||||
Install: []string{"/.buildstamp"},
|
||||
}
|
||||
}
|
||||
|
||||
func bootISOMonoStageOptions(kernelVer string, arch string) *osbuild.BootISOMonoStageOptions {
|
||||
comprOptions := new(osbuild.FSCompressionOptions)
|
||||
if bcj := osbuild.BCJOption(arch); bcj != "" {
|
||||
comprOptions.BCJ = bcj
|
||||
}
|
||||
isolabel := fmt.Sprintf("RHEL-9-0-0-BaseOS-%s", arch)
|
||||
return &osbuild.BootISOMonoStageOptions{
|
||||
Product: osbuild.Product{
|
||||
Name: "Red Hat Enterprise Linux",
|
||||
Version: osVersion,
|
||||
},
|
||||
ISOLabel: isolabel,
|
||||
Kernel: kernelVer,
|
||||
KernelOpts: fmt.Sprintf("inst.ks=hd:LABEL=%s:%s", isolabel, kspath),
|
||||
EFI: osbuild.EFI{
|
||||
Architectures: []string{
|
||||
"IA32",
|
||||
"X64",
|
||||
},
|
||||
Vendor: "redhat",
|
||||
},
|
||||
ISOLinux: osbuild.ISOLinux{
|
||||
Enabled: true,
|
||||
Debug: false,
|
||||
},
|
||||
Templates: "80-rhel",
|
||||
RootFS: osbuild.RootFS{
|
||||
Size: 9216,
|
||||
Compression: osbuild.FSCompression{
|
||||
Method: "xz",
|
||||
Options: comprOptions,
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func discinfoStageOptions(arch string) *osbuild.DiscinfoStageOptions {
|
||||
return &osbuild.DiscinfoStageOptions{
|
||||
BaseArch: arch,
|
||||
Release: "202010217.n.0",
|
||||
}
|
||||
}
|
||||
|
||||
func xorrisofsStageOptions(filename string, arch string) *osbuild.XorrisofsStageOptions {
|
||||
return &osbuild.XorrisofsStageOptions{
|
||||
Filename: filename,
|
||||
VolID: fmt.Sprintf("RHEL-9-0-0-BaseOS-%s", arch),
|
||||
SysID: "LINUX",
|
||||
Boot: &osbuild.XorrisofsBoot{
|
||||
Image: "isolinux/isolinux.bin",
|
||||
Catalog: "isolinux/boot.cat",
|
||||
},
|
||||
EFI: "images/efiboot.img",
|
||||
IsohybridMBR: "/usr/share/syslinux/isohdpfx.bin",
|
||||
}
|
||||
}
|
||||
|
|
@ -13,7 +13,6 @@ import (
|
|||
"github.com/osbuild/osbuild-composer/internal/distro/rhel84"
|
||||
"github.com/osbuild/osbuild-composer/internal/distro/rhel86"
|
||||
"github.com/osbuild/osbuild-composer/internal/distro/rhel90"
|
||||
"github.com/osbuild/osbuild-composer/internal/distro/rhel90beta"
|
||||
)
|
||||
|
||||
// When adding support for a new distribution, add it here.
|
||||
|
|
@ -29,7 +28,6 @@ var supportedDistros = []supportedDistro{
|
|||
{rhel86.NewRHEL85, rhel86.NewRHEL85HostDistro},
|
||||
{rhel86.NewRHEL87, rhel86.NewRHEL87HostDistro},
|
||||
{rhel86.NewCentos, rhel86.NewCentosHostDistro},
|
||||
{rhel90beta.New, rhel90beta.NewHostDistro},
|
||||
{rhel90.New, rhel90.NewHostDistro},
|
||||
{rhel90.NewRHEL91, rhel90.NewRHEL91HostDistro},
|
||||
{rhel90.NewCentos, rhel90.NewCentosHostDistro},
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue