pmb.install.setup_keymap: fix fail on X11 setup (MR 1968)

Do not fail in "pmbootstrap setup" if a keymap was selected, but no
/etc/X11/xorg.conf.d path exists in the rootfs chroot. The grep output
is not empty in that case (it would be empty if the directory exists and
there are no matches), so we need to add this extra check:

	(rootfs_nokia-n900) % grep -rl XkbLayout /etc/X11/xorg.conf.d/
	grep: /etc/X11/xorg.conf.d/: No such file or directory
This commit is contained in:
Oliver Smith 2020-08-12 01:16:09 +02:00
parent e233b73949
commit 9718fd294a
No known key found for this signature in database
GPG Key ID: 72D843B89D4DD756
1 changed files with 5 additions and 2 deletions

View File

@ -294,8 +294,11 @@ def setup_keymap(args):
output="interactive")
# Check xorg config
config = pmb.chroot.root(args, ["grep", "-rl", "XkbLayout", "/etc/X11/xorg.conf.d/"],
suffix, check=False, output_return=True)
config = None
if os.path.exists(f"{args.work}/chroot_{suffix}/etc/X11/xorg.conf.d"):
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]