Skip to content

Commit

Permalink
anaconda/ostree: Ensure we set target image reference
Browse files Browse the repository at this point in the history
Basically anaconda/kickstart lacks support for `--target-image`
which we need when installing from a container image embedded
in the ISO.  Work around it with an injected `%post`.

Closes: #380
  • Loading branch information
cgwalters committed Feb 7, 2024
1 parent 7ef2ffa commit f98e064
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions pkg/manifest/anaconda_installer_iso_tree.go
Original file line number Diff line number Diff line change
Expand Up @@ -381,8 +381,19 @@ func (p *AnacondaInstallerISOTree) serialize() osbuild.Pipeline {
pipeline.AddStage(osbuild.NewKickstartStage(kickstartOptions))

// and what we can't do in a separate kickstart that we include
targetContainerTransport := "registry"
if p.containerSpec.ContainersTransport != nil {
targetContainerTransport = *p.containerSpec.ContainersTransport
}
// Canonicalize to registry, as that's what the bootc stack wants
if targetContainerTransport == "docker://" {
targetContainerTransport = "registry"
}

kickstartFile, err := fsnode.NewFile(p.KSPath, nil, nil, nil, []byte(`
// Because osbuild core only supports a subset of options, we append to the
// base here with some more hardcoded defaults
// that should very likely become configurable.
hardcodedKickstartBits := `
%include /run/install/repo/osbuild-base.ks
rootpw --lock
Expand All @@ -399,7 +410,15 @@ part swap --fstype=swap --size=1024
part / --fstype=ext4 --grow
reboot --eject
`))
`

// Workaround for lack of --target-imgref in Anaconda, xref https://github.com/osbuild/images/issues/380
hardcodedKickstartBits += fmt.Sprintf(`%%post
bootc switch --mutate-in-place --transport %s %s
%%end
`, targetContainerTransport, p.containerSpec.LocalName)

kickstartFile, err := fsnode.NewFile(p.KSPath, nil, nil, nil, []byte(hardcodedKickstartBits))

if err != nil {
panic(err)
Expand Down

0 comments on commit f98e064

Please sign in to comment.