In https://bugzilla.redhat.com/show_bug.cgi?id=1933873 a keymap was set without the package that provides it being installed (it2 is in kbd-legacy, which is not installed by default). Setting a non-installed keymap is problematic, because it results in nasty failures afterward (*). So let's to the same as e.g. for locale data, and refuse a setting if the definition doesn't exists in the filesystem. The implementation using nftw() is not the most efficient, but I think it's OK in this case. This is definitely not in any kind of hot path, and I prefer not to duplicate the filename manipulation logic in a second function. (*) If the keymap is not found, vconsole-setup.service will fail. dracut-cmdline-ask.service has Requires=vconsole-setup.service, so it will also fail, and this breaks boot. dracut-cmdline-ask.service having a hard dependency is appropriate though: we sadly don't display what the keymap is, and with a wrong keymap, any attempts to enter a password are likely to fail.
22 lines
637 B
C
22 lines
637 B
C
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
|
#pragma once
|
|
|
|
#include <stdbool.h>
|
|
|
|
#if HAVE_SPLIT_USR
|
|
#define KBD_KEYMAP_DIRS \
|
|
"/usr/share/keymaps/\0" \
|
|
"/usr/share/kbd/keymaps/\0" \
|
|
"/usr/lib/kbd/keymaps/\0" \
|
|
"/lib/kbd/keymaps/\0"
|
|
#else
|
|
#define KBD_KEYMAP_DIRS \
|
|
"/usr/share/keymaps/\0" \
|
|
"/usr/share/kbd/keymaps/\0" \
|
|
"/usr/lib/kbd/keymaps/\0"
|
|
#endif
|
|
|
|
int get_keymaps(char ***l);
|
|
bool keymap_is_valid(const char *name);
|
|
int keymap_exists(const char *name);
|