This set of patches introduce separate handling of X layouts and VConsole keymaps. It is supposed to work, but for some reason, systemd-localed is not doing what it is supposed to do in the installation environment and also X server does not load our configuration file correctly. I'll further investigate these issues. For now, I'm sending this patches for a review of the idea and way of implementation.
Most of the work is done in PATCH 3/3.
Vratislav Podzimek (3): Add comment to the begining of generated xorg.conf file Add class wrapping systemd-localed functionality Work with VConsole keymap and X layouts separately
anaconda | 16 +-- anaconda.spec.in | 2 +- pyanaconda/keyboard.py | 260 +++++++++++++++++++++++++++++------ pyanaconda/kickstart.py | 3 +- pyanaconda/ui/gui/spokes/keyboard.py | 8 +- pyanaconda/ui/gui/spokes/welcome.py | 6 +- 6 files changed, 230 insertions(+), 65 deletions(-)
We should indicate where does this file come from. Moreover, without this comment vim doesn't turn on the syntax highlighting automatically.
Signed-off-by: Vratislav Podzimek vpodzime@redhat.com --- pyanaconda/keyboard.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/pyanaconda/keyboard.py b/pyanaconda/keyboard.py index fb3f7ef..78cf393 100755 --- a/pyanaconda/keyboard.py +++ b/pyanaconda/keyboard.py @@ -79,10 +79,13 @@ def get_layouts_xorg_conf(keyboard): layouts.append(layout) variants.append(variant)
+ #comment + ret = "#This file was generated by the Anaconda installer\n" + #section header - ret = 'Section "InputClass"\n'\ - '\tIdentifier\t"kickstart"\n'\ - '\tMatchIsKeyboard\t"on"\n' + ret += 'Section "InputClass"\n'\ + '\tIdentifier\t"anaconda-keyboard"\n'\ + '\tMatchIsKeyboard\t"on"\n'
#layouts ret += '\tOption\t"XkbLayout"\t'
Signed-off-by: Vratislav Podzimek vpodzime@redhat.com --- pyanaconda/keyboard.py | 112 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 112 insertions(+)
diff --git a/pyanaconda/keyboard.py b/pyanaconda/keyboard.py index 78cf393..30a9de9 100755 --- a/pyanaconda/keyboard.py +++ b/pyanaconda/keyboard.py @@ -32,11 +32,16 @@ for listing and various modifications of keyboard layouts settings.
import os import re +import dbus from pyanaconda import iutil
import logging log = logging.getLogger("anaconda")
+LOCALED_SERVICE = "org.freedesktop.locale1" +LOCALED_OBJECT_PATH = "/org/freedesktop/locale1" +LOCALED_IFACE = "org.freedesktop.locale1" + class KeyboardConfigError(Exception): """Exception class for keyboard configuration related problems"""
@@ -62,6 +67,23 @@ def _parse_layout_variant(layout):
return (layout, variant)
+def _join_layout_variant(layout, variant=""): + """ + Join layout and variant to form the commonly used 'layout (variant)' + of 'layout' (if variant is missing) format. + + @type layout: string + @type variant: string + @return: 'layout (variant)' or 'layout' string + @rtype: string + + """ + + if variant: + return "%s (%s)" % (layout, variant) + else: + return layout + def get_layouts_xorg_conf(keyboard): """ Get the xorg.conf content setting up layouts in the ksdata. @@ -229,6 +251,7 @@ class XklWrapper(object): return XklWrapper._instance
def __init__(self): + # pylint: disable-msg=E0611 from gi.repository import Xkl, GdkX11
#initialize Xkl-related stuff @@ -399,3 +422,92 @@ class XklWrapper(object): if not self._rec.activate(self._engine): msg = "Failed to replace layouts with: %s" % ",".join(layouts_list) raise XklWrapperError(msg) + +class LocaledWrapperError(KeyboardConfigError): + """Exception class for reporting Localed-related problems""" + pass + +class LocaledWrapper(object): + """ + Class wrapping systemd-localed daemon functionality. + + """ + + def __init__(self): + bus = dbus.SystemBus() + + try: + localed = bus.get_object(LOCALED_SERVICE, LOCALED_OBJECT_PATH) + except dbus.DBusException: + raise LocaledWrapperError("Failed to get locale object") + + try: + self._locale_iface = dbus.Interface(localed, LOCALED_IFACE) + except dbus.DBusException: + raise LocaledWrapperError("Failed to get locale interface") + + try: + self._props_iface = dbus.Interface(localed, dbus.PROPERTIES_IFACE) + except dbus.DBusException: + raise LocaledWrapperError("Failed to get properties interface") + + def set_and_convert_keymap(self, keymap): + """ + Method that sets VConsole keymap and returns X11 layout and + variant that (systemd-localed thinks) match given keymap best. + + @return: string containing "layout (variant)" or "layout" if variant + is missing + @rtype: string + + """ + + # args: keymap, keymap_toggle, convert, user_interaction + # where convert indicates whether the keymap should be converted + # to X11 layout and user_interaction indicates whether PolicyKit + # should ask for credentials or not + try: + self._locale_iface.SetVConsoleKeyboard(keymap, "", True, False) + except dbus.DBusException: + msg = "Failed to call SetVConsoleKeyboard method" + raise LocaledWrapperError(msg) + + try: + layout = self._props_iface.Get(LOCALED_IFACE, "X11Layout") + except dbus.DBusException: + raise LocaledWrapperError("locale has no X11Layout property") + + try: + variant = self._props_iface.Get(LOCALED_IFACE, "X11Variant") + except dbus.DBusException: + raise LocaledWrapperError("locale has no X11Variant property") + + return _join_layout_variant(layout, variant) + + def set_and_convert_layout(self, layout_variant): + """ + Method that sets X11 layout and variant (for later X sessions) + and returns VConsole keymap that (systemd-localed thinks) matches + given layout and variant best. + + @return: a keymap matching layout and variant best + @rtype: string + + """ + + (layout, variant) = _parse_layout_variant(layout_variant) + + # args: layout, model, variant, options, convert, user_interaction + # where convert indicates whether the keymap should be converted + # to X11 layout and user_interaction indicates whether PolicyKit + # should ask for credentials or not + try: + self._locale_iface.SetX11Keyboard(layout, "", variant, "", True, False) + except dbus.DBusException: + msg = "Failed to call SetX11Keyboard method" + raise LocaledWrapperError(msg) + + try: + return self._props_iface.Get(LOCALED_IFACE, "VConsoleKeymap") + except dbus.DBusException: + raise LocaledWrapperError("locale has no VConsoleKeymap property")
We need to set VConsole keymap and X layouts separately. We may get them all from kickstart, but if not, we have to convert the given one to the missing one and save the configuration. If X11 configuration is written before the server is started, it is loaded. This way we can get rid of using XklWrapper in main anaconda script.
Also we need to write one more configuration file. And it's better to try to write all configuration files ignoring errors and in case some error(s) appeared, raise exception at the end of the procedure.
Resolves: rhbz#853877 Resolves: rhbz#856362 Resolves: rhbz#859867
Signed-off-by: Vratislav Podzimek vpodzime@redhat.com --- anaconda | 16 +--- anaconda.spec.in | 2 +- pyanaconda/keyboard.py | 139 +++++++++++++++++++++++++---------- pyanaconda/kickstart.py | 3 +- pyanaconda/ui/gui/spokes/keyboard.py | 8 +- pyanaconda/ui/gui/spokes/welcome.py | 6 +- 6 files changed, 112 insertions(+), 62 deletions(-)
diff --git a/anaconda b/anaconda index 411bb07..f9a6fab 100755 --- a/anaconda +++ b/anaconda @@ -577,20 +577,6 @@ def setupDisplay(anaconda, opts): # with X running we can initialize the UI interface anaconda.initInterface()
- # setup layouts - if anaconda.displayMode == 'g' and anaconda.ksdata.keyboard.layouts_list: - from pyanaconda.keyboard import XklWrapper, XklWrapperError - - layouts = anaconda.ksdata.keyboard.layouts_list - xklwrapper = XklWrapper.get_instance() - - try: - xklwrapper.replace_layouts(layouts) - - except XklWrapperError as xklerr: - msg = "Failed to activate layouts %s" % ",".join(layouts) - log.error(msg) - anaconda.instClass.configure(anaconda)
def prompt_for_ssh(): @@ -853,7 +839,7 @@ if __name__ == "__main__": ksdata.keyboard.keyboard = opts.keymap
if ksdata.keyboard.keyboard: - keyboard.activate_console_keymap(ksdata.keyboard.keyboard) + keyboard.activate_keyboard(ksdata.keyboard)
# Some post-install parts of anaconda are implemented as kickstart # scripts. Add those to the ksdata now. diff --git a/anaconda.spec.in b/anaconda.spec.in index 861d87d..0722064 100644 --- a/anaconda.spec.in +++ b/anaconda.spec.in @@ -26,7 +26,7 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) %define intltoolver 0.31.2-3 %define libnlver 1.0 %define libselinuxver 1.6 -%define pykickstartver 1.99.18 +%define pykickstartver 1.99.20 %define rpmpythonver 4.2-0.61 %define slangver 2.0.6-2 %define yumver 3.4.3-32 diff --git a/pyanaconda/keyboard.py b/pyanaconda/keyboard.py index 30a9de9..21cb3a5 100755 --- a/pyanaconda/keyboard.py +++ b/pyanaconda/keyboard.py @@ -31,7 +31,6 @@ for listing and various modifications of keyboard layouts settings. """
import os -import re import dbus from pyanaconda import iutil
@@ -96,7 +95,7 @@ def get_layouts_xorg_conf(keyboard): layouts = list() variants = list()
- for layout_variant in keyboard.layouts_list: + for layout_variant in keyboard.x_layouts: (layout, variant) = _parse_layout_variant(layout_variant) layouts.append(layout) variants.append(variant) @@ -128,83 +127,149 @@ def get_layouts_xorg_conf(keyboard):
return ret
-def write_layouts_config(keyboard, root): +def write_keyboard_config(keyboard, root, convert=True, weight=0): """ Function that writes files with layouts configuration to - $root/etc/X11/xorg.conf.d/01-anaconda-layouts.conf and - $root/etc/sysconfig/keyboard. + $root/etc/X11/xorg.conf.d/01-anaconda-layouts.conf, + $root/etc/sysconfig/keyboard and $root/etc/vconsole.conf.
@param keyboard: ksdata.keyboard object @param root: path to the root of the installed system + @param convert: whether to convert specified values to get the missing + ones + @param weight: weight (prefix) of the xorg.conf file written out
"""
+ 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) + xconf_dir = os.path.normpath(root + "/etc/X11/xorg.conf.d") - xconf_file = "01-anaconda-keyboard.conf" + xconf_file = "%0.2d-anaconda-keyboard.conf" % weight
sysconf_dir = os.path.normpath(root + "/etc/sysconfig") sysconf_file = "keyboard"
+ vcconf_dir = os.path.normpath(root + "/etc") + vcconf_file = "vconsole.conf" + + errors = [] + try: if not os.path.isdir(xconf_dir): os.makedirs(xconf_dir)
except OSError as oserr: - raise KeyboardConfigError("Cannot create directory xorg.conf.d") + errors.append("Cannot create directory xorg.conf.d")
- try: - with open(os.path.join(xconf_dir, xconf_file), "w") as fobj: - fobj.write(get_layouts_xorg_conf(keyboard)) + if keyboard.x_layouts: + try: + with open(os.path.join(xconf_dir, xconf_file), "w") as fobj: + fobj.write(get_layouts_xorg_conf(keyboard)) + except IOError as ioerr: + errors.append("Cannot write X keyboard configuration file") + + if keyboard.vc_keymap: + try: + with open(os.path.join(sysconf_dir, sysconf_file), "w") as fobj: + fobj.write('vconsole.keymap="%s"\n' % keyboard.vc_keymap)
- with open(os.path.join(sysconf_dir, sysconf_file), "w") as fobj: - fobj.write('vconsole.keymap="%s"\n' % keyboard.keyboard) + except IOError as ioerr: + errors.append("Cannot write sysconfig keyboard configuration file")
- except IOError as ioerr: - raise KeyboardConfigError("Cannot write keyboard configuration files") + try: + with open(os.path.join(vcconf_dir, vcconf_file), "w") as fobj: + fobj.write('KEYMAP="%s"\n' % keyboard.vc_keymap) + except IOError as ioerr: + errors.append("Cannot write vconsole configuration file")
-def activate_console_keymap(keymap): + if errors: + raise KeyboardConfigError("\n".join(errors)) + +def _try_to_load_keymap(keymap): """ - Try to setup a given keymap as a console keymap. If there is no such - keymap, try to setup a basic variant (e.g. 'cz' instead of 'cz (qwerty)'). + Method that tries to load keymap and returns boolean indicating if it was + successfull or not. It can be used to test if given string is VConsole + keymap or not, but in case it is given valid keymap, IT REALLY LOADS IT!.
- @param keymap: a keymap @type keymap: string @raise KeyboardConfigError: if loadkeys command is not available - @return: False if failed to activate both the given keymap and its basic - variant, True otherwise + @return: True if given string was a valid keymap and thus was loaded, + False otherwise
"""
+ # BUG: systemd-localed should be able to tell us if we are trying to + # activate invalid keymap. Then we will be able to get rid of this + # fuction + + ret = 0 + try: - #TODO: replace with calling systemd-localed methods once it can load - # X layouts ret = iutil.execWithRedirect("loadkeys", [keymap], stdout="/dev/tty5", stderr="/dev/tty5") except OSError as oserr: msg = "'loadkeys' command not available (%s)" % oserr.strerror raise KeyboardConfigError(msg)
- if ret != 0: - log.error("Failed to activate keymap %s" % keymap) + return ret == 0
- #failed to activate the given keymap, extract and try - #the basic keymap -- e.g. 'cz-cp1250' -> 'cz' - parts = re.split(r'[- _(]', keymap, 1) - if len(parts) == 0: - log.error("Failed to extract basic keymap from: %s" % keymap) - return False +def activate_keyboard(keyboard): + """ + Try to setup VConsole keymap and X11 layouts as specified in kickstart.
- keymap = parts[0] + @param keyboard: ksdata.keyboard object + @type keyboard: ksdata.keyboard object
- ret = iutil.execWithRedirect("loadkeys", [keymap], stdout="/dev/tty5", - stderr="/dev/tty5") + """ + + localed = LocaledWrapper() + c_lay_var = "" + c_keymap = ""
- if ret != 0: - log.error("Failed to activate basic variant %s" % keymap) + if keyboard._keyboard and not (keyboard.vc_keymap or keyboard.x_layouts): + # we were give only one value in old format of the keyboard command + # try to guess if we were given VConsole keymap or X11 layout + is_keymap = _try_to_load_keymap(keyboard._keyboard) + + if is_keymap: + keyboard.vc_keymap = keyboard._keyboard else: - log.error("Activated basic variant %s, instead" % keymap) + keyboard.x_layouts.append(keyboard._keyboard)
- return ret == 0 + if keyboard.vc_keymap: + valid_keymap = _try_to_load_keymap(keyboard.vc_keymap) + if not valid_keymap: + log.error("'%s' is not a valid VConsole keymap, not loading" % \ + keyboard.vc_keymap) + else: + # activate VConsole keymap and get converted layout and variant + c_lay_var = localed.set_and_convert_keymap(keyboard.vc_keymap) + + if not keyboard.x_layouts and c_lay_var: + keyboard.x_layouts.append(c_lay_var) + + if keyboard.x_layouts: + c_keymap = localed.set_and_convert_layout(keyboard.x_layouts[0]) + + if not keyboard.vc_keymap: + keyboard.vc_keymap = c_keymap + + # write out full configuration that will be loaded by X server + # (systemd-localed writes configuration with only one layout) + write_keyboard_config(keyboard, root="/", convert=False, weight=99)
def item_str(s): """Convert a zero-terminated byte array to a proper str""" diff --git a/pyanaconda/kickstart.py b/pyanaconda/kickstart.py index 18b04c0..03bc5b9 100644 --- a/pyanaconda/kickstart.py +++ b/pyanaconda/kickstart.py @@ -1367,8 +1367,7 @@ class ZFCP(commands.zfcp.F14_ZFCP):
class Keyboard(commands.keyboard.F18_Keyboard): def execute(self, *args): - if self.layouts_list: - keyboard.write_layouts_config(self, ROOT_PATH) + keyboard.write_keyboard_config(self, ROOT_PATH)
### ### HANDLERS diff --git a/pyanaconda/ui/gui/spokes/keyboard.py b/pyanaconda/ui/gui/spokes/keyboard.py index c2e9b86..1147244 100644 --- a/pyanaconda/ui/gui/spokes/keyboard.py +++ b/pyanaconda/ui/gui/spokes/keyboard.py @@ -174,9 +174,9 @@ class KeyboardSpoke(NormalSpoke):
def apply(self): # Clear and repopulate self.data with actual values - self.data.keyboard.layouts_list = list() + self.data.keyboard.x_layouts = list() for row in self._store: - self.data.keyboard.layouts_list.append(row[0]) + self.data.keyboard.x_layouts.append(row[0]) # FIXME: Set the keyboard layout here, too.
@property @@ -391,8 +391,8 @@ class KeyboardSpoke(NormalSpoke): self._downButton.set_sensitive(True)
def _add_data_layouts(self): - if self.data.keyboard.layouts_list: - for layout in self.data.keyboard.layouts_list: + if self.data.keyboard.x_layouts: + for layout in self.data.keyboard.x_layouts: self._addLayout(self._store, layout) else: self._addLayout(self._store, "us") diff --git a/pyanaconda/ui/gui/spokes/welcome.py b/pyanaconda/ui/gui/spokes/welcome.py index 0bd5d90..2dcad10 100644 --- a/pyanaconda/ui/gui/spokes/welcome.py +++ b/pyanaconda/ui/gui/spokes/welcome.py @@ -64,7 +64,7 @@ class LanguageMixIn(object): if lang_timezone: self.data.timezone.timezone = lang_timezone
- if self.data.keyboard.layouts_list: + if self.data.keyboard.x_layouts: #do not add layouts if there are any specified in the kickstart return
@@ -80,8 +80,8 @@ class LanguageMixIn(object): new_layouts.append(language_layout)
for layout in new_layouts: - if layout not in self.data.keyboard.layouts_list: - self.data.keyboard.layouts_list.append(layout) + if layout not in self.data.keyboard.x_layouts: + self.data.keyboard.x_layouts.append(layout) if flags.can_touch_runtime_system("add runtime X layout"): self._xklwrapper.add_layout(layout)
We want to allow user specify which VConsole keymap and X layouts they want to set on the system and during installation. Moreover, we need to store these values during the installation and output them in final kickstart file produced.
Signed-off-by: Vratislav Podzimek vpodzime@redhat.com --- pykickstart/commands/keyboard.py | 71 ++++++++++++++++++++++++++++++++-------- tests/commands/keyboard.py | 14 ++++++-- 2 files changed, 68 insertions(+), 17 deletions(-)
diff --git a/pykickstart/commands/keyboard.py b/pykickstart/commands/keyboard.py index c5f67bc..e54bbf5 100644 --- a/pykickstart/commands/keyboard.py +++ b/pykickstart/commands/keyboard.py @@ -56,38 +56,81 @@ class FC3_Keyboard(KickstartCommand):
class F18_Keyboard(FC3_Keyboard): def __init__(self, writePriority=0, *args, **kwargs): - FC3_Keyboard.__init__(self, writePriority, *args, **kwargs) + KickstartCommand.__init__(self, writePriority, *args, **kwargs) self.op = self._getParser() - self.layouts_list = kwargs.get("layouts_list", []) + self._keyboard = kwargs.get("keyboard", "") + self.vc_keymap = kwargs.get("vc_keymap", "") + self.x_layouts = kwargs.get("x_layouts", [])
def __str__(self): - if not self.layouts_list: + if not any((self._keyboard, self.x_layouts, self.vc_keymap)): return ""
- retval = "# Keyboard layouts\nkeyboard" - for layout in self.layouts_list: - retval += " '%s'" % layout + retval = "# Keyboard layouts\n" + if self._keyboard: + retval += "# old format: keyboard %s\n" % self._keyboard + retval += "# new format:\n" + retval += "keyboard" + self._getArgsAsStr() + "\n" + + return retval + + def _getArgsAsStr(self): + retval = "" + + if self.vc_keymap: + retval += " --vckeymap=%s" % self.vc_keymap + + if self.x_layouts: + layouts_str = "'%s'" % self.x_layouts[0] + for layout in self.x_layouts[1:]: + layouts_str += ",'%s'" % layout + retval += " --xlayouts=%s" % layouts_str
return retval
+ def _getParser(self): + def x_layouts_callback(option, opt_str, value, parser): + for layout in value.split(","): + if layout: + parser.values.ensure_value(option.dest, []).append(layout) + + op = FC3_Keyboard._getParser(self) + op.add_option("--vckeymap", dest="vc_keymap", action="store", default="") + op.add_option("--xlayouts", dest="x_layouts", action="callback", + callback=x_layouts_callback, nargs=1, type="string") + + return op + def parse(self, args): (opts, extra) = self.op.parse_args(args=args, lineno=self.lineno) + self._setToSelf(self.op, opts) + + if len(extra) > 1: + message = _("A single argument is expected for the %s command") % \ + "keyboard" + raise KickstartValueError(formatErrorMsg(self.lineno, msg=message)) + + elif len(extra) == 0 and not self.vc_keymap and not self.x_layouts: + message = _("One of --xlayouts, --vckeymap options with value(s) " + "or argument is expected for the keyboard command") + raise KickstartValueError(formatErrorMsg(self.lineno, msg=message)) + + if len(extra) > 0: + self._keyboard = extra[0]
- if len(extra) < 1: - raise KickstartValueError, formatErrorMsg(self.lineno, msg=_("Kickstart command %s requires at least"\ - "one argument") % "keyboard") - self.layouts_list = extra return self
+ # property for backwards compatibility # pylint: disable-msg=E0202 @property def keyboard(self): - if self.layouts_list: - return self.layouts_list[0] + if self.x_layouts: + return self._keyboard or self.vc_keymap or self.x_layouts[0] else: - return "" + return self._keyboard or self.vc_keymap or ""
# pylint: disable-msg=E0102,E1101 @keyboard.setter def keyboard(self, value): - self.layouts_list = [value] + self._keyboard = value + diff --git a/tests/commands/keyboard.py b/tests/commands/keyboard.py index a21b4d3..a847233 100644 --- a/tests/commands/keyboard.py +++ b/tests/commands/keyboard.py @@ -40,13 +40,21 @@ class F18_TestCase(FC3_TestCase): command = "keyboard"
def runTest(self): + # pass self.assert_parse("keyboard us") - - # we now support defining multiple layouts - self.assert_parse("keyboard us cz") + self.assert_parse("keyboard --vckeymap=us") + self.assert_parse("keyboard --vckeymap=us sk") + self.assert_parse("keyboard --xlayouts='cz (qwerty)'") + self.assert_parse("keyboard --xlayouts=cz,'cz (qwerty)'") + self.assert_parse("keyboard --xlayouts=cz sk") + self.assert_parse("keyboard --vckeymap=us --xlayouts=cz") + self.assert_parse("keyboard --vckeymap=us --xlayouts=cz,'cz (qwerty)' sk")
# fail self.assert_parse_error("keyboard", KickstartValueError) + self.assert_parse_error("keyboard cz sk", KickstartValueError) + self.assert_parse_error("keyboard --vckeymap=us --xlayouts=cz," + "'cz (qwerty)' cz sk", KickstartValueError) self.assert_parse_error("keyboard --foo us", KickstartParseError)
if __name__ == "__main__":
On Thu, 2012-10-04 at 22:50 +0200, Vratislav Podzimek wrote:
We want to allow user specify which VConsole keymap and X layouts they want to set on the system and during installation. Moreover, we need to store these values during the installation and output them in final kickstart file produced.
I don't understand this. We need to know which keymap is in use during installation when we set a new encryption passphrase. Now that everything is a list I have no idea how to know which keymap is actually in use. Can you help me out?
On Thu, 2012-10-04 at 16:22 -0500, David Lehman wrote:
On Thu, 2012-10-04 at 22:50 +0200, Vratislav Podzimek wrote:
We want to allow user specify which VConsole keymap and X layouts they want to set on the system and during installation. Moreover, we need to store these values during the installation and output them in final kickstart file produced.
I don't understand this. We need to know which keymap is in use during installation when we set a new encryption passphrase. Now that everything is a list I have no idea how to know which keymap is actually in use. Can you help me out?
What do we need it for? Do we write it somewhere?
The problem these patches try to resolve is that VConsole keymap is something different from X server layouts. We need to store and write both VConsole keymap configuration and X layouts configuration. For this we need to store and process them separately.
On Fri, 2012-10-05 at 10:13 +0200, Vratislav Podzimek wrote:
On Thu, 2012-10-04 at 16:22 -0500, David Lehman wrote:
On Thu, 2012-10-04 at 22:50 +0200, Vratislav Podzimek wrote:
We want to allow user specify which VConsole keymap and X layouts they want to set on the system and during installation. Moreover, we need to store these values during the installation and output them in final kickstart file produced.
I don't understand this. We need to know which keymap is in use during installation when we set a new encryption passphrase. Now that everything is a list I have no idea how to know which keymap is actually in use. Can you help me out?
What do we need it for? Do we write it somewhere?
Now that I've seen your patches for encrypted devices, I understand your point. There two problems:
1) In the GUI, X layouts are active and user enters the password using X layout whereas during boot VConsole keymap is active. This results (and always resulted) in potential problems, because X layouts and VConsole keymaps don't match. Please see [1] for some more information about the "progress" in resolving this issue. I myself had to add one more password to my encrypted /home partition because the entry in Plymouth didn't allow me to enter the right characters (even though they were all ascii).
2) Since we allow user to set up multiple X layouts and switch between them, reading ksdata is useless to get the current layout if there are multiple X layouts. I'm trying to find a way to get current X layout from the X server (hope libxklavier can help here), but maybe the best solution for now would be to add a simple text box that would allow user to test the layout before entering their password.
[1] https://bugzilla.redhat.com/show_bug.cgi?id=837292
On Thu, 2012-10-04 at 22:48 +0200, Vratislav Podzimek wrote:
This set of patches introduce separate handling of X layouts and VConsole keymaps. It is supposed to work, but for some reason, systemd-localed is not doing what it is supposed to do in the installation environment and also X server does not load our configuration file correctly. I'll further investigate these issues. For now, I'm sending this patches for a review of the idea and way of implementation.
Okay, I've finally figured out where the problems are and I'm sending new version of these patches with some fixes. X server was ignoring our configuration file because we were writing out also empty strings. systemd-localed works, but fails to convert 'cz' keymap to 'cz' layout. However, e.g. 'cz-lat2' works.
anaconda-patches@lists.fedorahosted.org