Without vconsole.keymap on kernel command line, dracut/plymouth
uses 'us' as keymap in LUKS password prompt.
Signed-off-by: Vratislav Podzimek <vpodzime(a)redhat.com>
---
pyanaconda/bootloader.py | 5 +++--
pyanaconda/install.py | 2 +-
pyanaconda/keyboard.py | 52 ++++++++++++++++++++++++++++++++++++------------
pyanaconda/kickstart.py | 3 +++
4 files changed, 46 insertions(+), 16 deletions(-)
diff --git a/pyanaconda/bootloader.py b/pyanaconda/bootloader.py
index fd68571..1c3bdbc 100644
--- a/pyanaconda/bootloader.py
+++ b/pyanaconda/bootloader.py
@@ -2238,7 +2238,7 @@ def writeSysconfigKernel(storage, version):
f.write("HYPERVISOR_ARGS=logging=vga,serial,memory\n")
f.close()
-def writeBootLoader(storage, payload, instClass):
+def writeBootLoader(storage, payload, instClass, ksdata):
""" Write bootloader configuration to disk.
When we get here, the bootloader will already have a default linux
@@ -2304,7 +2304,8 @@ def writeBootLoader(storage, payload, instClass):
# language=anaconda.instLanguage,
# network=anaconda.network)
storage.bootloader.set_boot_args(storage=storage,
- payload=payload)
+ payload=payload,
+ keyboard=ksdata.keyboard)
try:
storage.bootloader.write()
diff --git a/pyanaconda/install.py b/pyanaconda/install.py
index 1282d74..c652e88 100644
--- a/pyanaconda/install.py
+++ b/pyanaconda/install.py
@@ -133,6 +133,6 @@ def doInstall(storage, payload, ksdata, instClass):
# Do bootloader.
with progress_report(_("Installing bootloader")):
- writeBootLoader(storage, payload, instClass)
+ writeBootLoader(storage, payload, instClass, ksdata)
progress.send_complete()
diff --git a/pyanaconda/keyboard.py b/pyanaconda/keyboard.py
index 828c709..23c6e64 100755
--- a/pyanaconda/keyboard.py
+++ b/pyanaconda/keyboard.py
@@ -130,6 +130,28 @@ def get_layouts_xorg_conf(keyboard):
return ret
+def populate_missing_items(keyboard):
+ """
+ Function that populates keyboard.vc_keymap and keyboard.x_layouts if
+ they are missing. By invoking LocaledWrapper's methods this function
+ MODIFIES CONFIGURATION FILES.
+
+ @type keyboard: ksdata.keyboard object
+
+ """
+
+ localed = LocaledWrapper()
+
+ if keyboard.x_layouts and not keyboard.vc_keymap:
+ keyboard.vc_keymap = localed.set_and_convert_layout(keyboard.x_layouts[0])
+
+ if not keyboard.vc_keymap:
+ keyboard.vc_keymap = "us"
+
+ if not keyboard.x_layouts:
+ c_lay_var = localed.set_and_convert_keymap(keyboard.vc_keymap)
+ keyboard.x_layouts.append(c_lay_var)
+
def write_keyboard_config(keyboard, root, convert=True, weight=0):
"""
Function that writes files with layouts configuration to
@@ -144,20 +166,8 @@ def write_keyboard_config(keyboard, root, convert=True, weight=0):
"""
- localed = LocaledWrapper()
-
if convert:
- # populate vc_keymap and x_layouts if they are missing
- if keyboard.x_layouts and not keyboard.vc_keymap:
- keyboard.vc_keymap = \
- localed.set_and_convert_layout(keyboard.x_layouts[0])
-
- if not keyboard.vc_keymap:
- keyboard.vc_keymap = "us"
-
- if not keyboard.x_layouts:
- c_lay_var = localed.set_and_convert_keymap(keyboard.vc_keymap)
- keyboard.x_layouts.append(c_lay_var)
+ populate_missing_items(keyboard)
xconf_dir = os.path.normpath(root + "/etc/X11/xorg.conf.d")
xconf_file = "%0.2d-anaconda-keyboard.conf" % weight
@@ -191,6 +201,22 @@ def write_keyboard_config(keyboard, root, convert=True, weight=0):
if errors:
raise KeyboardConfigError("\n".join(errors))
+def dracut_setup_args(keyboard):
+ """
+ Function returning dracut setup args for the given keyboard configuration.
+
+ @type keyboard: ksdata.keyboard object
+
+ """
+
+ if not keyboard.vc_keymap:
+ populate_missing_items(keyboard)
+
+ args = set()
+ args.add("vconsole.keymap=%s" % keyboard.vc_keymap)
+
+ return args
+
def _try_to_load_keymap(keymap):
"""
Method that tries to load keymap and returns boolean indicating if it was
diff --git a/pyanaconda/kickstart.py b/pyanaconda/kickstart.py
index 827ef30..789997b 100644
--- a/pyanaconda/kickstart.py
+++ b/pyanaconda/kickstart.py
@@ -1420,6 +1420,9 @@ class Keyboard(commands.keyboard.F18_Keyboard):
def execute(self, *args):
keyboard.write_keyboard_config(self, ROOT_PATH)
+ def dracutSetupArgs(self, *args):
+ return keyboard.dracut_setup_args(self)
+
###
### HANDLERS
###
--
1.7.11.7