distro/rhel8: update edge installer to new definitions
Using the same pipeline functions as Fedora and RHEL 9 and copied the image function from RHEL 9. The most notable change is the replacment of the deprecated bootiso.mono stage with the more granular stages, just like with the image installer.
This commit is contained in:
parent
1ec7de4caf
commit
254623459f
5 changed files with 48 additions and 308 deletions
|
|
@ -97,21 +97,16 @@ func edgeInstallerImgType(rd distribution) imageType {
|
|||
// 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: edgeInstallerBuildPackageSet,
|
||||
osPkgsKey: edgeCommitPackageSet,
|
||||
installerPkgsKey: edgeInstallerPackageSet,
|
||||
},
|
||||
packageSetChains: map[string][]string{
|
||||
osPkgsKey: {osPkgsKey, blueprintPkgsKey},
|
||||
},
|
||||
defaultImageConfig: &distro.ImageConfig{
|
||||
EnabledServices: edgeServices(rd),
|
||||
},
|
||||
rpmOstree: true,
|
||||
bootISO: true,
|
||||
pipelines: edgeInstallerPipelines,
|
||||
image: edgeInstallerImage,
|
||||
buildPipelines: []string{"build"},
|
||||
payloadPipelines: []string{"anaconda-tree", "bootiso-tree", "bootiso"},
|
||||
payloadPipelines: []string{"anaconda-tree", "rootfs-image", "efiboot-tree", "bootiso-tree", "bootiso"},
|
||||
exports: []string{"bootiso"},
|
||||
}
|
||||
return it
|
||||
|
|
@ -373,12 +368,6 @@ func edgeSimplifiedInstallerPackageSet(t *imageType) rpmmd.PackageSet {
|
|||
return ps
|
||||
}
|
||||
|
||||
func edgeInstallerBuildPackageSet(t *imageType) rpmmd.PackageSet {
|
||||
return anacondaBuildPackageSet(t).Append(
|
||||
edgeBuildPackageSet(t),
|
||||
)
|
||||
}
|
||||
|
||||
func edgeServices(rd distribution) []string {
|
||||
// Common Services
|
||||
var edgeServices = []string{"NetworkManager.service", "firewalld.service", "sshd.service"}
|
||||
|
|
|
|||
|
|
@ -260,6 +260,52 @@ func tarImage(workload workload.Workload,
|
|||
|
||||
}
|
||||
|
||||
func edgeInstallerImage(workload workload.Workload,
|
||||
t *imageType,
|
||||
customizations *blueprint.Customizations,
|
||||
options distro.ImageOptions,
|
||||
packageSets map[string]rpmmd.PackageSet,
|
||||
containers []container.Spec,
|
||||
rng *rand.Rand) (image.ImageKind, error) {
|
||||
|
||||
d := t.arch.distro
|
||||
|
||||
commit := ostree.CommitSpec{
|
||||
Ref: options.OSTree.ImageRef,
|
||||
URL: options.OSTree.URL,
|
||||
ContentURL: options.OSTree.ContentURL,
|
||||
Checksum: options.OSTree.FetchChecksum,
|
||||
}
|
||||
if options.OSTree.RHSM {
|
||||
commit.Secrets = "org.osbuild.rhsm.consumer"
|
||||
}
|
||||
img := image.NewOSTreeInstaller(commit)
|
||||
|
||||
img.Platform = t.platform
|
||||
img.ExtraBasePackages = packageSets[installerPkgsKey]
|
||||
img.Users = users.UsersFromBP(customizations.GetUsers())
|
||||
img.Groups = users.GroupsFromBP(customizations.GetGroups())
|
||||
|
||||
img.SquashfsCompression = "xz"
|
||||
img.AdditionalDracutModules = []string{"prefixdevname", "prefixdevname-tools"}
|
||||
|
||||
if len(img.Users)+len(img.Groups) > 0 {
|
||||
// only enable the users module if needed
|
||||
img.AdditionalAnacondaModules = []string{"org.fedoraproject.Anaconda.Modules.Users"}
|
||||
}
|
||||
|
||||
img.ISOLabelTempl = d.isolabelTmpl
|
||||
img.Product = d.product
|
||||
img.Variant = "edge"
|
||||
img.OSName = "rhel"
|
||||
img.OSVersion = d.osVersion
|
||||
img.Release = fmt.Sprintf("%s %s", d.product, d.osVersion)
|
||||
|
||||
img.Filename = t.Filename()
|
||||
|
||||
return img, nil
|
||||
}
|
||||
|
||||
func edgeRawImage(workload workload.Workload,
|
||||
t *imageType,
|
||||
customizations *blueprint.Customizations,
|
||||
|
|
|
|||
|
|
@ -115,29 +115,6 @@ func anacondaBootPackageSet(t *imageType) rpmmd.PackageSet {
|
|||
return ps
|
||||
}
|
||||
|
||||
func installerBuildPackageSet(t *imageType) rpmmd.PackageSet {
|
||||
return distroBuildPackageSet(t).Append(
|
||||
rpmmd.PackageSet{
|
||||
Include: []string{
|
||||
"isomd5sum",
|
||||
"xorriso",
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func anacondaBuildPackageSet(t *imageType) rpmmd.PackageSet {
|
||||
ps := rpmmd.PackageSet{
|
||||
Include: []string{
|
||||
"squashfs-tools",
|
||||
},
|
||||
}
|
||||
|
||||
ps = ps.Append(installerBuildPackageSet(t))
|
||||
ps = ps.Append(anacondaBootPackageSet(t))
|
||||
|
||||
return ps
|
||||
}
|
||||
|
||||
// BOOT PACKAGE SETS
|
||||
|
||||
func bootPackageSet(t *imageType) rpmmd.PackageSet {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ package rhel8
|
|||
import (
|
||||
"fmt"
|
||||
"math/rand"
|
||||
"path"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/osbuild/osbuild-composer/internal/blueprint"
|
||||
|
|
@ -28,34 +27,6 @@ func prependKernelCmdlineStage(pipeline *osbuild.Pipeline, t *imageType, pt *dis
|
|||
return pipeline
|
||||
}
|
||||
|
||||
// makeISORootPath return a path that can be used to address files and folders in
|
||||
// the root of the iso
|
||||
func makeISORootPath(p string) string {
|
||||
fullpath := path.Join("/run/install/repo", p)
|
||||
return fmt.Sprintf("file://%s", fullpath)
|
||||
}
|
||||
|
||||
func edgeInstallerPipelines(t *imageType, customizations *blueprint.Customizations, options distro.ImageOptions, repos []rpmmd.RepoConfig, packageSetSpecs map[string][]rpmmd.PackageSpec, containers []container.Spec, rng *rand.Rand) ([]osbuild.Pipeline, error) {
|
||||
pipelines := make([]osbuild.Pipeline, 0)
|
||||
pipelines = append(pipelines, *buildPipeline(repos, packageSetSpecs[buildPkgsKey], t.arch.distro.runner.String()))
|
||||
installerPackages := packageSetSpecs[installerPkgsKey]
|
||||
d := t.arch.distro
|
||||
archName := t.Arch().Name()
|
||||
kernelVer := rpmmd.GetVerStrFromPackageSpecListPanic(installerPackages, "kernel")
|
||||
ostreeRepoPath := "/ostree/repo"
|
||||
payloadStages := ostreePayloadStages(options, ostreeRepoPath)
|
||||
kickstartOptions, err := osbuild.NewKickstartStageOptions(kspath, "", users.UsersFromBP(customizations.GetUsers()), users.GroupsFromBP(customizations.GetGroups()), makeISORootPath(ostreeRepoPath), options.OSTree.ImageRef, "rhel")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
ksUsers := len(customizations.GetUsers())+len(customizations.GetGroups()) > 0
|
||||
pipelines = append(pipelines, *anacondaTreePipeline(repos, installerPackages, kernelVer, archName, d.product, d.osVersion, "edge", ksUsers))
|
||||
isolabel := fmt.Sprintf(d.isolabelTmpl, archName)
|
||||
pipelines = append(pipelines, *bootISOTreePipeline(kernelVer, archName, d.vendor, d.product, d.osVersion, isolabel, kickstartOptions, payloadStages))
|
||||
pipelines = append(pipelines, *bootISOPipeline(t.Filename(), d.isolabelTmpl, archName, t.Arch().Name() == "x86_64"))
|
||||
return pipelines, nil
|
||||
}
|
||||
|
||||
func edgeCorePipelines(t *imageType, customizations *blueprint.Customizations, options distro.ImageOptions, repos []rpmmd.RepoConfig, packageSetSpecs map[string][]rpmmd.PackageSpec, containers []container.Spec) ([]osbuild.Pipeline, error) {
|
||||
pipelines := make([]osbuild.Pipeline, 0)
|
||||
pipelines = append(pipelines, *buildPipeline(repos, packageSetSpecs[buildPkgsKey], t.arch.distro.runner.String()))
|
||||
|
|
@ -507,101 +478,6 @@ func containerPipeline(t *imageType, nginxConfigPath, listenPort string) *osbuil
|
|||
return p
|
||||
}
|
||||
|
||||
func ostreePayloadStages(options distro.ImageOptions, ostreeRepoPath string) []*osbuild.Stage {
|
||||
stages := make([]*osbuild.Stage, 0)
|
||||
|
||||
// ostree commit payload
|
||||
stages = append(stages, osbuild.NewOSTreeInitStage(&osbuild.OSTreeInitStageOptions{Path: ostreeRepoPath}))
|
||||
stages = append(stages, osbuild.NewOSTreePullStage(
|
||||
&osbuild.OSTreePullStageOptions{Repo: ostreeRepoPath},
|
||||
osbuild.NewOstreePullStageInputs("org.osbuild.source", options.OSTree.FetchChecksum, options.OSTree.ImageRef),
|
||||
))
|
||||
|
||||
return stages
|
||||
}
|
||||
|
||||
func anacondaTreePipeline(repos []rpmmd.RepoConfig, packages []rpmmd.PackageSpec, kernelVer, arch, product, osVersion, variant string, users bool) *osbuild.Pipeline {
|
||||
p := new(osbuild.Pipeline)
|
||||
p.Name = "anaconda-tree"
|
||||
p.Build = "name:build"
|
||||
p.AddStage(osbuild.NewRPMStage(osbuild.NewRPMStageOptions(repos), osbuild.NewRpmStageSourceFilesInputs(packages)))
|
||||
p.AddStage(osbuild.NewBuildstampStage(buildStampStageOptions(arch, product, osVersion, variant)))
|
||||
p.AddStage(osbuild.NewLocaleStage(&osbuild.LocaleStageOptions{Language: "en_US.UTF-8"}))
|
||||
|
||||
rootPassword := ""
|
||||
rootUser := osbuild.UsersStageOptionsUser{
|
||||
Password: &rootPassword,
|
||||
}
|
||||
|
||||
installUID := 0
|
||||
installGID := 0
|
||||
installHome := "/root"
|
||||
installShell := "/usr/libexec/anaconda/run-anaconda"
|
||||
installPassword := ""
|
||||
installUser := osbuild.UsersStageOptionsUser{
|
||||
UID: &installUID,
|
||||
GID: &installGID,
|
||||
Home: &installHome,
|
||||
Shell: &installShell,
|
||||
Password: &installPassword,
|
||||
}
|
||||
usersStageOptions := &osbuild.UsersStageOptions{
|
||||
Users: map[string]osbuild.UsersStageOptionsUser{
|
||||
"root": rootUser,
|
||||
"install": installUser,
|
||||
},
|
||||
}
|
||||
|
||||
p.AddStage(osbuild.NewUsersStage(usersStageOptions))
|
||||
|
||||
anacondaModules := []string{}
|
||||
if users {
|
||||
anacondaModules = []string{"org.fedoraproject.Anaconda.Modules.Users"}
|
||||
}
|
||||
p.AddStage(osbuild.NewAnacondaStage(osbuild.NewAnacondaStageOptions(anacondaModules)))
|
||||
p.AddStage(osbuild.NewLoraxScriptStage(loraxScriptStageOptions(arch)))
|
||||
p.AddStage(osbuild.NewDracutStage(dracutStageOptions(kernelVer, arch, []string{
|
||||
"anaconda",
|
||||
"rdma",
|
||||
"rngd",
|
||||
"multipath",
|
||||
"fcoe",
|
||||
"fcoe-uefi",
|
||||
"iscsi",
|
||||
"lunmask",
|
||||
"nfs",
|
||||
})))
|
||||
p.AddStage(osbuild.NewSELinuxConfigStage(&osbuild.SELinuxConfigStageOptions{State: osbuild.SELinuxStatePermissive}))
|
||||
|
||||
return p
|
||||
}
|
||||
|
||||
func bootISOTreePipeline(kernelVer, arch, vendor, product, osVersion, isolabel string, ksOptions *osbuild.KickstartStageOptions, payloadStages []*osbuild.Stage) *osbuild.Pipeline {
|
||||
p := new(osbuild.Pipeline)
|
||||
p.Name = "bootiso-tree"
|
||||
p.Build = "name:build"
|
||||
|
||||
p.AddStage(osbuild.NewBootISOMonoStage(bootISOMonoStageOptions(kernelVer, arch, vendor, product, osVersion, isolabel), osbuild.NewBootISOMonoStagePipelineTreeInputs("anaconda-tree")))
|
||||
p.AddStage(osbuild.NewKickstartStage(ksOptions))
|
||||
p.AddStage(osbuild.NewDiscinfoStage(discinfoStageOptions(arch)))
|
||||
|
||||
for _, stage := range payloadStages {
|
||||
p.AddStage(stage)
|
||||
}
|
||||
|
||||
return p
|
||||
}
|
||||
func bootISOPipeline(filename, isolabel, arch string, isolinux bool) *osbuild.Pipeline {
|
||||
p := new(osbuild.Pipeline)
|
||||
p.Name = "bootiso"
|
||||
p.Build = "name:build"
|
||||
|
||||
p.AddStage(osbuild.NewXorrisofsStage(xorrisofsStageOptions(filename, isolabel, arch, isolinux), "bootiso-tree"))
|
||||
p.AddStage(osbuild.NewImplantisomd5Stage(&osbuild.Implantisomd5StageOptions{Filename: filename}))
|
||||
|
||||
return p
|
||||
}
|
||||
|
||||
func tarArchivePipeline(name, inputPipelineName string, tarOptions *osbuild.TarStageOptions) *osbuild.Pipeline {
|
||||
p := new(osbuild.Pipeline)
|
||||
p.Name = name
|
||||
|
|
|
|||
|
|
@ -6,14 +6,9 @@ import (
|
|||
|
||||
"github.com/osbuild/osbuild-composer/internal/blueprint"
|
||||
"github.com/osbuild/osbuild-composer/internal/common"
|
||||
"github.com/osbuild/osbuild-composer/internal/distro"
|
||||
"github.com/osbuild/osbuild-composer/internal/osbuild"
|
||||
)
|
||||
|
||||
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.
|
||||
|
|
@ -99,149 +94,6 @@ func systemdStageOptions(enabledServices, disabledServices []string, s *blueprin
|
|||
}
|
||||
}
|
||||
|
||||
func buildStampStageOptions(arch, product, osVersion, variant string) *osbuild.BuildstampStageOptions {
|
||||
return &osbuild.BuildstampStageOptions{
|
||||
Arch: arch,
|
||||
Product: product,
|
||||
Version: osVersion,
|
||||
Variant: variant,
|
||||
Final: true,
|
||||
}
|
||||
}
|
||||
|
||||
func loraxScriptStageOptions(arch string) *osbuild.LoraxScriptStageOptions {
|
||||
return &osbuild.LoraxScriptStageOptions{
|
||||
Path: "99-generic/runtime-postinstall.tmpl",
|
||||
BaseArch: arch,
|
||||
}
|
||||
}
|
||||
|
||||
func dracutStageOptions(kernelVer, arch string, additionalModules []string) *osbuild.DracutStageOptions {
|
||||
kernel := []string{kernelVer}
|
||||
modules := []string{
|
||||
"bash",
|
||||
"systemd",
|
||||
"fips",
|
||||
"systemd-initrd",
|
||||
"modsign",
|
||||
"nss-softokn",
|
||||
"i18n",
|
||||
"convertfs",
|
||||
"network-manager",
|
||||
"network",
|
||||
"ifcfg",
|
||||
"url-lib",
|
||||
"drm",
|
||||
"plymouth",
|
||||
"prefixdevname",
|
||||
"prefixdevname-tools",
|
||||
"crypt",
|
||||
"dm",
|
||||
"dmsquash-live",
|
||||
"kernel-modules",
|
||||
"kernel-modules-extra",
|
||||
"kernel-network-modules",
|
||||
"livenet",
|
||||
"lvm",
|
||||
"mdraid",
|
||||
"qemu",
|
||||
"qemu-net",
|
||||
"resume",
|
||||
"rootfs-block",
|
||||
"terminfo",
|
||||
"udev-rules",
|
||||
"dracut-systemd",
|
||||
"pollcdrom",
|
||||
"usrmount",
|
||||
"base",
|
||||
"fs-lib",
|
||||
"img-lib",
|
||||
"shutdown",
|
||||
"uefi-lib",
|
||||
}
|
||||
|
||||
if arch == distro.X86_64ArchName {
|
||||
modules = append(modules, "biosdevname")
|
||||
}
|
||||
|
||||
modules = append(modules, additionalModules...)
|
||||
return &osbuild.DracutStageOptions{
|
||||
Kernel: kernel,
|
||||
Modules: modules,
|
||||
Install: []string{"/.buildstamp"},
|
||||
}
|
||||
}
|
||||
|
||||
func bootISOMonoStageOptions(kernelVer, arch, vendor, product, osVersion, isolabel string) *osbuild.BootISOMonoStageOptions {
|
||||
comprOptions := new(osbuild.FSCompressionOptions)
|
||||
if bcj := osbuild.BCJOption(arch); bcj != "" {
|
||||
comprOptions.BCJ = bcj
|
||||
}
|
||||
var architectures []string
|
||||
|
||||
if arch == distro.X86_64ArchName {
|
||||
architectures = []string{"IA32", "X64"}
|
||||
} else if arch == distro.Aarch64ArchName {
|
||||
architectures = []string{"AA64"}
|
||||
} else {
|
||||
panic("unsupported architecture")
|
||||
}
|
||||
|
||||
return &osbuild.BootISOMonoStageOptions{
|
||||
Product: osbuild.Product{
|
||||
Name: product,
|
||||
Version: osVersion,
|
||||
},
|
||||
ISOLabel: isolabel,
|
||||
Kernel: kernelVer,
|
||||
KernelOpts: fmt.Sprintf("inst.ks=hd:LABEL=%s:%s", isolabel, kspath),
|
||||
EFI: osbuild.EFI{
|
||||
Architectures: architectures,
|
||||
Vendor: vendor,
|
||||
},
|
||||
ISOLinux: osbuild.ISOLinux{
|
||||
Enabled: arch == distro.X86_64ArchName,
|
||||
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, isolabel, arch string, isolinux bool) *osbuild.XorrisofsStageOptions {
|
||||
options := &osbuild.XorrisofsStageOptions{
|
||||
Filename: filename,
|
||||
VolID: fmt.Sprintf(isolabel, arch),
|
||||
SysID: "LINUX",
|
||||
EFI: "images/efiboot.img",
|
||||
ISOLevel: 3,
|
||||
}
|
||||
|
||||
if isolinux {
|
||||
options.Boot = &osbuild.XorrisofsBoot{
|
||||
Image: "isolinux/isolinux.bin",
|
||||
Catalog: "isolinux/boot.cat",
|
||||
}
|
||||
|
||||
options.IsohybridMBR = "/usr/share/syslinux/isohdpfx.bin"
|
||||
}
|
||||
|
||||
return options
|
||||
}
|
||||
|
||||
func nginxConfigStageOptions(path, htmlRoot, listen string) *osbuild.NginxConfigStageOptions {
|
||||
// configure nginx to work in an unprivileged container
|
||||
cfg := &osbuild.NginxConfig{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue