Hi, since recently Debian based distributions store keymap information in /etc/default/console-setup. The attached patch parses this file if no keymap is found in xorg.conf. Cheers, -- Guido
# HG changeset patch # User Guido Günther <agx@xxxxxxxxxxx> # Date 1242311916 -7200 # Node ID e80c5ef403b61b7631847df73981d07f23a6f48b # Parent 2450a9dcaa03514d16daf73a05b58cd5020994cb Parse /etc/default/console-setup for keymap as used on Debian based distributions. diff -r 2450a9dcaa03 -r e80c5ef403b6 virtinst/util.py --- a/virtinst/util.py Thu May 07 17:09:09 2009 -0400 +++ b/virtinst/util.py Thu May 14 16:38:36 2009 +0200 @@ -43,6 +43,7 @@ KEYBOARD_DIR = "/etc/sysconfig/keyboard" XORG_CONF = "/etc/X11/xorg.conf" +CONSOLE_SETUP_CONF = "/etc/default/console-setup" def default_route(nic = None): if platform.system() == 'SunOS': @@ -354,6 +355,27 @@ f.close() return kt +def _console_setup_keymap(): + """Look in /etc/default/console-setup for the host machine's keymap, and attempt to + map it to a keymap supported by qemu""" + + kt = None + try: + f = open(CONSOLE_SETUP_CONF, "r") + except IOError, e: + logging.debug('Could not open "%s": %s ' % (CONSOLE_SETUP_CONF, str(e))) + else: + keymap_re = re.compile(r'\s*XKBLAYOUT="(?P<kt>[a-z-]+)"') + for line in f: + m = keymap_re.match(line) + if m: + kt = m.group('kt') + break + else: + logging.debug("Didn't find keymap in '%s'!" % XORG_CONF) + f.close() + return kt + def default_keymap(): """Look in /etc/sysconfig for the host machine's keymap, and attempt to map it to a keymap supported by qemu""" @@ -368,6 +390,8 @@ except IOError, e: logging.debug('Could not open "/etc/sysconfig/keyboard" ' + str(e)) kt = _xorg_keymap() + if not kt: + kt = _console_setup_keymap() else: while 1: s = f.readline()
_______________________________________________ et-mgmt-tools mailing list et-mgmt-tools@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/et-mgmt-tools