80 lines
1.6 KiB
Go
80 lines
1.6 KiB
Go
package rhel7
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/osbuild/osbuild-composer/internal/distro"
|
|
"github.com/osbuild/osbuild-composer/internal/rpmmd"
|
|
)
|
|
|
|
// BOOT PACKAGE SETS
|
|
|
|
func bootPackageSet(t *imageType) rpmmd.PackageSet {
|
|
if !t.bootable {
|
|
return rpmmd.PackageSet{}
|
|
}
|
|
|
|
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))
|
|
}
|
|
|
|
ps := rpmmd.PackageSet{}
|
|
|
|
switch t.arch.Name() {
|
|
case distro.X86_64ArchName:
|
|
if addLegacyBootPkg {
|
|
ps = ps.Append(x8664LegacyBootPackageSet(t))
|
|
}
|
|
if addUEFIBootPkg {
|
|
ps = ps.Append(x8664UEFIBootPackageSet(t))
|
|
}
|
|
|
|
default:
|
|
panic(fmt.Sprintf("unsupported boot arch: %s", t.arch.Name()))
|
|
}
|
|
|
|
return ps
|
|
}
|
|
|
|
// x86_64 Legacy arch-specific boot package set
|
|
func x8664LegacyBootPackageSet(t *imageType) rpmmd.PackageSet {
|
|
return rpmmd.PackageSet{
|
|
Include: []string{
|
|
"dracut-config-generic",
|
|
"grub2-pc",
|
|
},
|
|
}
|
|
}
|
|
|
|
// x86_64 UEFI arch-specific boot package set
|
|
func x8664UEFIBootPackageSet(t *imageType) rpmmd.PackageSet {
|
|
return rpmmd.PackageSet{
|
|
Include: []string{
|
|
"dracut-config-generic",
|
|
"efibootmgr",
|
|
"grub2-efi-x64",
|
|
"shim-x64",
|
|
},
|
|
}
|
|
}
|
|
|
|
// packages that are only in some (sub)-distributions
|
|
func distroSpecificPackageSet(t *imageType) rpmmd.PackageSet {
|
|
if t.arch.distro.isRHEL() {
|
|
return rpmmd.PackageSet{
|
|
Include: []string{"insights-client"},
|
|
}
|
|
}
|
|
return rpmmd.PackageSet{}
|
|
}
|