From e2f7e1aed427113996cbb3d51bdb05784c8faf60 Mon Sep 17 00:00:00 2001 From: Achilleas Koutsou Date: Wed, 2 Nov 2022 15:56:19 +0100 Subject: [PATCH] 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. --- internal/distro/rhel9/images.go | 3 +++ internal/manifest/os.go | 7 ++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/internal/distro/rhel9/images.go b/internal/distro/rhel9/images.go index 1f1694339..006afc008 100644 --- a/internal/distro/rhel9/images.go +++ b/internal/distro/rhel9/images.go @@ -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 { diff --git a/internal/manifest/os.go b/internal/manifest/os.go index 8016d4a67..e91c7db97 100644 --- a/internal/manifest/os.go +++ b/internal/manifest/os.go @@ -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 != "" {