image: always enable users module in anaconda

Unconditionally enable the users module in Anaconda.
The module serves two purposes:
- It will create a user that's defined in the blueprint by adding the
  user creation stage in the kickstart file.
- It allows users to create user accounts interactively during
  installation.
This commit is contained in:
Achilleas Koutsou 2022-11-22 17:27:37 +01:00 committed by Christian Kellner
parent 11b08da7a5
commit cb0280c8c9
3 changed files with 18 additions and 12 deletions

View file

@ -67,7 +67,8 @@ func (img *ImageInstaller) InstantiateManifest(m *manifest.Manifest,
anacondaPipeline.ExtraPackages = img.ExtraBasePackages.Include anacondaPipeline.ExtraPackages = img.ExtraBasePackages.Include
anacondaPipeline.ExtraRepos = img.ExtraBasePackages.Repositories anacondaPipeline.ExtraRepos = img.ExtraBasePackages.Repositories
anacondaPipeline.Users = len(img.Users)+len(img.Groups) > 0 anacondaPipeline.Users = img.Users
anacondaPipeline.Groups = img.Groups
anacondaPipeline.Variant = img.Variant anacondaPipeline.Variant = img.Variant
anacondaPipeline.Biosdevname = (img.Platform.GetArch() == platform.ARCH_X86_64) anacondaPipeline.Biosdevname = (img.Platform.GetArch() == platform.ARCH_X86_64)
anacondaPipeline.InteractiveDefaults = interactiveDefaults anacondaPipeline.InteractiveDefaults = interactiveDefaults

View file

@ -57,7 +57,8 @@ func (img *OSTreeInstaller) InstantiateManifest(m *manifest.Manifest,
img.OSVersion) img.OSVersion)
anacondaPipeline.ExtraPackages = img.ExtraBasePackages.Include anacondaPipeline.ExtraPackages = img.ExtraBasePackages.Include
anacondaPipeline.ExtraRepos = img.ExtraBasePackages.Repositories anacondaPipeline.ExtraRepos = img.ExtraBasePackages.Repositories
anacondaPipeline.Users = len(img.Users)+len(img.Groups) > 0 anacondaPipeline.Users = img.Users
anacondaPipeline.Groups = img.Groups
anacondaPipeline.Variant = img.Variant anacondaPipeline.Variant = img.Variant
anacondaPipeline.Biosdevname = (img.Platform.GetArch() == platform.ARCH_X86_64) anacondaPipeline.Biosdevname = (img.Platform.GetArch() == platform.ARCH_X86_64)
anacondaPipeline.Checkpoint() anacondaPipeline.Checkpoint()

View file

@ -6,27 +6,30 @@ import (
"github.com/osbuild/osbuild-composer/internal/osbuild" "github.com/osbuild/osbuild-composer/internal/osbuild"
"github.com/osbuild/osbuild-composer/internal/platform" "github.com/osbuild/osbuild-composer/internal/platform"
"github.com/osbuild/osbuild-composer/internal/rpmmd" "github.com/osbuild/osbuild-composer/internal/rpmmd"
"github.com/osbuild/osbuild-composer/internal/users"
) )
// An Anaconda represents the installer tree as found on an ISO. // An Anaconda represents the installer tree as found on an ISO.
type Anaconda struct { type Anaconda struct {
Base Base
// Packages to install in addition to the ones required by the // Packages to install in addition to the ones required by the
// pipeline. // pipeline.
ExtraPackages []string ExtraPackages []string
// Extra repositories to install packages from // Extra repositories to install packages from
ExtraRepos []rpmmd.RepoConfig ExtraRepos []rpmmd.RepoConfig
// Users indicate whether or not the user spoke should be enabled in
// anaconda. If it is, users specified in a kickstart will be configured, // Users and Groups to create during installation.
// and in case no users are provided in a kickstart the user will be // If empty, then the user can interactively create users at install time.
// prompted to configure them at install time. If this is set to false Users []users.User
// any kickstart provided users are ignored and the user is never Groups []users.Group
// prompted to configure users during installation.
Users bool
// Biosdevname indicates whether or not biosdevname should be used to // Biosdevname indicates whether or not biosdevname should be used to
// name network devices when booting the installer. This may affect // name network devices when booting the installer. This may affect
// the naming of network devices on the target system. // the naming of network devices on the target system.
Biosdevname bool Biosdevname bool
// Variant is the variant of the product being installed, if applicable. // Variant is the variant of the product being installed, if applicable.
Variant string Variant string
@ -191,7 +194,8 @@ func (p *Anaconda) serialize() osbuild.Pipeline {
} }
pipeline.AddStage(osbuild.NewUsersStage(usersStageOptions)) pipeline.AddStage(osbuild.NewUsersStage(usersStageOptions))
pipeline.AddStage(osbuild.NewAnacondaStage(osbuild.NewAnacondaStageOptions(p.Users, p.AdditionalModules))) // always enable users module in anaconda
pipeline.AddStage(osbuild.NewAnacondaStage(osbuild.NewAnacondaStageOptions(true, p.AdditionalModules)))
pipeline.AddStage(osbuild.NewLoraxScriptStage(&osbuild.LoraxScriptStageOptions{ pipeline.AddStage(osbuild.NewLoraxScriptStage(&osbuild.LoraxScriptStageOptions{
Path: "99-generic/runtime-postinstall.tmpl", Path: "99-generic/runtime-postinstall.tmpl",
BaseArch: p.platform.GetArch().String(), BaseArch: p.platform.GetArch().String(),
@ -213,8 +217,8 @@ func (p *Anaconda) serialize() osbuild.Pipeline {
kickstartOptions, err := osbuild.NewKickstartStageOptions( kickstartOptions, err := osbuild.NewKickstartStageOptions(
"/usr/share/anaconda/interactive-defaults.ks", "/usr/share/anaconda/interactive-defaults.ks",
p.InteractiveDefaults.TarPath, p.InteractiveDefaults.TarPath,
nil, p.Users,
nil, p.Groups,
"", "",
"", "",
"", "",