install: setup xorg keymap (!1833)

With the nokia N900 the user can choose between different keyboard
layouts and during the install the setup-keymap installs the choosen
layout.

This only changes the keyboard layout of the console, while installing
a UI using xorg, the layout was hardcoded to "us".

With a simple check for the existence of an xorg config containing
XkbLayout, this will run sed to replace the default with the layout
chosen by the user.

Tested with a clean install of the nokia N900 with the xfce4 UI.
This commit is contained in:
Daniele Debernardi 2019-11-19 00:45:10 +01:00 committed by Oliver Smith
parent 228ca1f127
commit 8326025c27
No known key found for this signature in database
GPG Key ID: 5AE7F5513E0885CB
1 changed files with 11 additions and 0 deletions

View File

@ -260,6 +260,17 @@ def setup_keymap(args):
layout, variant = args.keymap.split("/")
pmb.chroot.root(args, ["setup-keymap", layout, variant], suffix,
output="interactive")
# Check xorg config
config = pmb.chroot.root(args, ["grep", "-rl", "XkbLayout", "/etc/X11/xorg.conf.d/"],
suffix, check=False, output_return=True)
if config:
# Multiple files can contain the keyboard layout, take last
config = config.splitlines()[-1]
old_text = "Option *\\\"XkbLayout\\\" *\\\".*\\\""
new_text = "Option \\\"XkbLayout\\\" \\\"" + layout + "\\\""
pmb.chroot.root(args, ["sed", "-i", "s/" + old_text + "/" + new_text + "/", config],
suffix)
else:
logging.info("NOTE: No valid keymap specified for device")