manifest: support X11KeymapLayouts in OS pipeline

In the OSCustomizations, we only apply the X11KeymapLayouts from the
image config if the keyboard customization is not specified.
Although we don't support specifying X11KeymapLayouts in the
customizations, it's related to the base Keymap and we should override
both settings in the image config if the base Keymap is specified.
This commit is contained in:
Achilleas Koutsou 2022-11-02 15:56:19 +01:00 committed by Christian Kellner
parent 2541a2219f
commit e2f7e1aed4
2 changed files with 9 additions and 1 deletions

View file

@ -73,6 +73,9 @@ func osCustomizations(
osc.Keyboard = keyboard
} else if imageConfig.Keyboard != nil {
osc.Keyboard = &imageConfig.Keyboard.Keymap
if imageConfig.Keyboard.X11Keymap != nil {
osc.X11KeymapLayouts = imageConfig.Keyboard.X11Keymap.Layouts
}
}
if hostname := c.GetHostname(); hostname != nil {

View file

@ -45,6 +45,7 @@ type OSCustomizations struct {
GPGKeyFiles []string
Language string
Keyboard *string
X11KeymapLayouts []string
Hostname string
Timezone string
EnabledServices []string
@ -256,7 +257,11 @@ func (p *OS) serialize() osbuild.Pipeline {
pipeline.AddStage(osbuild.NewLocaleStage(&osbuild.LocaleStageOptions{Language: p.Language}))
if p.Keyboard != nil {
pipeline.AddStage(osbuild.NewKeymapStage(&osbuild.KeymapStageOptions{Keymap: *p.Keyboard}))
keymapOptions := &osbuild.KeymapStageOptions{Keymap: *p.Keyboard}
if len(p.X11KeymapLayouts) > 0 {
keymapOptions.X11Keymap = &osbuild.X11KeymapOptions{Layouts: p.X11KeymapLayouts}
}
pipeline.AddStage(osbuild.NewKeymapStage(keymapOptions))
}
if p.Hostname != "" {