From d31e3ebb65550ecd20652c2c11c941945bb45274 Mon Sep 17 00:00:00 2001 From: Tom Gundersen Date: Sat, 13 Jun 2020 18:39:50 +0200 Subject: [PATCH] distro: add groups before users If a user is added to a group, then the group must be added first. --- internal/distro/fedora31/distro.go | 8 ++++---- internal/distro/fedora32/distro.go | 8 ++++---- internal/distro/rhel8/distro.go | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/distro/fedora31/distro.go b/internal/distro/fedora31/distro.go index d3b651acd..3a1338429 100644 --- a/internal/distro/fedora31/distro.go +++ b/internal/distro/fedora31/distro.go @@ -448,6 +448,10 @@ func (t *imageType) pipeline(c *blueprint.Customizations, repos []rpmmd.RepoConf p.AddStage(osbuild.NewChronyStage(&osbuild.ChronyStageOptions{ntpServers})) } + if groups := c.GetGroups(); len(groups) > 0 { + p.AddStage(osbuild.NewGroupsStage(t.groupStageOptions(groups))) + } + if users := c.GetUsers(); len(users) > 0 { options, err := t.userStageOptions(users) if err != nil { @@ -456,10 +460,6 @@ func (t *imageType) pipeline(c *blueprint.Customizations, repos []rpmmd.RepoConf p.AddStage(osbuild.NewUsersStage(options)) } - if groups := c.GetGroups(); len(groups) > 0 { - p.AddStage(osbuild.NewGroupsStage(t.groupStageOptions(groups))) - } - if t.bootable { p.AddStage(osbuild.NewFSTabStage(t.fsTabStageOptions(t.arch.uefi))) p.AddStage(osbuild.NewGRUB2Stage(t.grub2StageOptions(t.kernelOptions, c.GetKernel(), t.arch.uefi))) diff --git a/internal/distro/fedora32/distro.go b/internal/distro/fedora32/distro.go index 838f5397e..cf659edd6 100644 --- a/internal/distro/fedora32/distro.go +++ b/internal/distro/fedora32/distro.go @@ -252,6 +252,10 @@ func (t *imageType) pipeline(c *blueprint.Customizations, options distro.ImageOp p.AddStage(osbuild.NewChronyStage(&osbuild.ChronyStageOptions{Timeservers: ntpServers})) } + if groups := c.GetGroups(); len(groups) > 0 { + p.AddStage(osbuild.NewGroupsStage(t.groupStageOptions(groups))) + } + if users := c.GetUsers(); len(users) > 0 { options, err := t.userStageOptions(users) if err != nil { @@ -260,10 +264,6 @@ func (t *imageType) pipeline(c *blueprint.Customizations, options distro.ImageOp p.AddStage(osbuild.NewUsersStage(options)) } - if groups := c.GetGroups(); len(groups) > 0 { - p.AddStage(osbuild.NewGroupsStage(t.groupStageOptions(groups))) - } - if t.bootable { p.AddStage(osbuild.NewFSTabStage(t.fsTabStageOptions(t.arch.uefi))) p.AddStage(osbuild.NewGRUB2Stage(t.grub2StageOptions(t.kernelOptions, c.GetKernel(), t.arch.uefi))) diff --git a/internal/distro/rhel8/distro.go b/internal/distro/rhel8/distro.go index 24188d70f..a43f4fceb 100644 --- a/internal/distro/rhel8/distro.go +++ b/internal/distro/rhel8/distro.go @@ -273,6 +273,10 @@ func (t *imageType) pipeline(c *blueprint.Customizations, options distro.ImageOp p.AddStage(osbuild.NewChronyStage(&osbuild.ChronyStageOptions{Timeservers: ntpServers})) } + if groups := c.GetGroups(); len(groups) > 0 { + p.AddStage(osbuild.NewGroupsStage(t.groupStageOptions(groups))) + } + if users := c.GetUsers(); len(users) > 0 { options, err := t.userStageOptions(users) if err != nil { @@ -281,10 +285,6 @@ func (t *imageType) pipeline(c *blueprint.Customizations, options distro.ImageOp p.AddStage(osbuild.NewUsersStage(options)) } - if groups := c.GetGroups(); len(groups) > 0 { - p.AddStage(osbuild.NewGroupsStage(t.groupStageOptions(groups))) - } - if services := c.GetServices(); services != nil || t.enabledServices != nil { p.AddStage(osbuild.NewSystemdStage(t.systemdStageOptions(t.enabledServices, t.disabledServices, services, t.defaultTarget))) }