Skip to content

Commit

Permalink
anaconda: switch container-installer to fixed ks
Browse files Browse the repository at this point in the history
Use a fixed kickstart to cut corners, this needs a PoC as soon as
possible.

We need manual partitioning because we need to set the boot label on the
`/boot` partition. It is possible that this won't be necessary in the
future: rhinstaller/anaconda#5363

We'll remove the kickstart literal once the PR is merged and the options
used are merged into the kickstart stage.
  • Loading branch information
supakeen committed Dec 21, 2023
1 parent 56e4954 commit bac579b
Showing 1 changed file with 40 additions and 10 deletions.
50 changes: 40 additions & 10 deletions pkg/manifest/anaconda_installer_iso_tree.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"path"

"github.com/osbuild/images/pkg/container"
"github.com/osbuild/images/pkg/customizations/fsnode"
"github.com/osbuild/images/pkg/customizations/users"
"github.com/osbuild/images/pkg/disk"
"github.com/osbuild/images/pkg/osbuild"
Expand Down Expand Up @@ -55,6 +56,8 @@ type AnacondaInstallerISOTree struct {

// Enable ISOLinux stage
ISOLinux bool

Files []*fsnode.File
}

func NewAnacondaInstallerISOTree(buildPipeline *Build, anacondaPipeline *AnacondaInstaller, rootfsPipeline *ISORootfsImg, bootTreePipeline *EFIBootTree) *AnacondaInstallerISOTree {
Expand All @@ -76,6 +79,15 @@ func NewAnacondaInstallerISOTree(buildPipeline *Build, anacondaPipeline *Anacond
return p
}

func (p *AnacondaInstallerISOTree) getOSTreeCommitSources() []ostree.SourceSpec {
if p.OSTreeCommitSource == nil {
return []ostree.SourceSpec{}
}
return []ostree.SourceSpec{
*p.OSTreeCommitSource,
}
}

func (p *AnacondaInstallerISOTree) getOSTreeCommits() []ostree.CommitSpec {
if p.ostreeCommitSpec == nil {
return nil
Expand All @@ -99,6 +111,16 @@ func (p *AnacondaInstallerISOTree) getContainerSources() []container.SourceSpec
}
}

func (p *AnacondaInstallerISOTree) getInline() []string {
inlineData := []string{}

// inline data for custom files
for _, file := range p.Files {
inlineData = append(inlineData, string(file.Data()))
}

return inlineData
}
func (p *AnacondaInstallerISOTree) getBuildPackages(_ Distro) []string {
packages := []string{
"squashfs-tools",
Expand Down Expand Up @@ -299,20 +321,28 @@ func (p *AnacondaInstallerISOTree) serialize() osbuild.Pipeline {
images,
manifests))

kickstartOptions, err := osbuild.NewKickstartStageOptionsWithOSTreeContainer(
p.KSPath,
p.Users,
p.Groups,
path.Join("/run/install/repo", p.PayloadPath),
"oci",
"",
"")
kickstartFile, err := fsnode.NewFile(p.KSPath, nil, nil, nil, []byte(`
ostreecontainer --url=/run/install/repo/container --transport=oci --no-signature-verification
rootpw --lock
user --name fedora --groups wheel
lang en_US.UTF-8
keyboard us
timezone UTC
clearpart --all
part /boot/efi --fstype=efi --size=512 --fsoptions="umask=0077"
part /boot --fstype=ext2 --size=1024 --label=boot
part swap --fstype=swap --size=1024
part / --fstype=ext4 --grow
reboot --eject
`))

if err != nil {
panic("failed to create kickstartstage options")
panic(err)
}

pipeline.AddStage(osbuild.NewKickstartStage(kickstartOptions))
p.Files = []*fsnode.File{kickstartFile}

pipeline.AddStages(osbuild.GenFileNodesStages(p.Files)...)
}

if p.OSPipeline != nil {
Expand Down

0 comments on commit bac579b

Please sign in to comment.