Skip to content

Commit

Permalink
fedora: 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 20, 2023
1 parent b23bc5a commit 41905c9
Showing 1 changed file with 31 additions and 10 deletions.
41 changes: 31 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 @@ -56,6 +57,8 @@ type AnacondaInstallerISOTree struct {

// Enable ISOLinux stage
ISOLinux bool

Files []*fsnode.File
}

func NewAnacondaInstallerISOTree(buildPipeline *Build, anacondaPipeline *AnacondaInstaller, rootfsPipeline *ISORootfsImg, bootTreePipeline *EFIBootTree) *AnacondaInstallerISOTree {
Expand Down Expand Up @@ -100,6 +103,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 @@ -332,20 +345,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 41905c9

Please sign in to comment.