Fix autodetection of UNICODE keymap
PATCH 1/1 Fix autodetection of UNICODE keymap
Original console_init from RH initscripts supports KEYTABLE variable which dynamically determines whether to load UNICODE keymap depending on current LANG value.
Scripts from 10i18n are more simplistic and assume the right keymap is statically defined in configuration files.
Mandriva depends on console_init behavior and is using KEYTABLE exclusively, so under new 10i18n non-UNICDE keymap is always loaded.
Add support for KEYTABLE to dynamically determine whether to install UNICODE or non-UNICODE keymap version. This should probably go into run-time 10i18n/console_init instead to be fully compatible.
---
modules.d/10i18n/README | 2 ++ modules.d/10i18n/install | 54 +++++++++++++++++++++++++++++----------------- 2 files changed, 36 insertions(+), 20 deletions(-)
modules.d/10i18n/README +2 -0
@@ -47,6 +47,8 @@ The following variables are used by i18n install script and at initramfs runtime: KEYMAP - keyboard translation table loaded by loadkeys + KEYTABLE - base name for keyboard translation table; if UNICODE is + true, Unicode version will be loaded. Overrides KEYMAP. EXT_KEYMAPS - list of extra keymaps to bo loaded (sep. by space) UNICODE - boolean, indicating UTF-8 mode SYSFONT - console font
modules.d/10i18n/install +34 -20
83 lines not on this page · raw message
modules.d/10i18n/install install_all_kbd() { · line 128
Quoted 11 lines · Andrey Borzenkov
modules.d/10i18n/install +11
-0+ + # KEYTABLE is a bit special - it defines base keymap name and UNICODE + # determines whether non-UNICODE or UNICODE version is used + + if [[ ${KEYTABLE} ]]; then + if [[ ${UNICODE} == 1 ]]; then + [[ ${KEYTABLE} =~ .*\.uni.* ]] || KEYTABLE=${KEYTABLE%.map*}.uni + fi + + KEYMAP=${KEYTABLE} + fi
On Fedora we would end with:
KEYTABLE="de-latin1-nodeadkeys"
at
KEYMAP="de-latin1-nodeadkeys.uni"
which does not exist.
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 15 lines · Harald Hoyer
modules.d/10i18n/install install_all_kbd() { · line 128
Quoted 11 lines · Andrey Borzenkov
modules.d/10i18n/install +11
-0+ + # KEYTABLE is a bit special - it defines base keymap name and UNICODE + # determines whether non-UNICODE or UNICODE version is used + + if [[ ${KEYTABLE} ]]; then + if [[ ${UNICODE} == 1 ]]; then + [[ ${KEYTABLE} =~ .*\.uni.* ]] || KEYTABLE=${KEYTABLE%.map*}.uni + fi + + KEYMAP=${KEYTABLE} + fiOn Fedora we would end with:
Quoted 7 lines
KEYTABLE="de-latin1-nodeadkeys"
at
KEYMAP="de-latin1-nodeadkeys.uni"
which does not exist.
Fedora's console_init calls "loadkeys" with "-u", if its LANG has .UTF-8
A message that is not in the archive (sent off-list or not yet received): [email protected]
Thu, 12 Aug 2010 13:08:25 +0200 письмо от Harald Hoyer <[email protected]>:
Quoted 16 lines · Harald Hoyer
Quoted 15 lines · Andrey Borzenkov
modules.d/10i18n/install install_all_kbd() { · line 128
Quoted 11 lines
modules.d/10i18n/install +11
-0+ + # KEYTABLE is a bit special - it defines base keymap name and UNICODE + # determines whether non-UNICODE or UNICODE version is used + + if [[ ${KEYTABLE} ]]; then + if [[ ${UNICODE} == 1 ]]; then + [[ ${KEYTABLE} =~ .*\.uni.* ]] || KEYTABLE=${KEYTABLE%.map*}.uni + fi + + KEYMAP=${KEYTABLE} + fiOn Fedora we would end with:
Quoted 8 lines
Quoted 7 lines
KEYTABLE="de-latin1-nodeadkeys"
at
KEYMAP="de-latin1-nodeadkeys.uni"
which does not exist.
Could you send me your /etc/sysconfig/keyboard (or where these are defined)?
So, in other words - you have UTF-8 environment but load non-UNICODE keyboard?
Quoted 1 line
Fedora's
console_initcalls "loadkeys" with "-u", if its LANG has .UTF-8
It does not help here, unfortunately. Which version of initscripts is it?
A message that is not in the archive (sent off-list or not yet received): E1OjWGr-0004HZ-00.arvidjaar-mail-ru-KwwT3n/ykh4edp2WBT/[email protected]
Quoted 28 lines · Andrey Borzenkov
Thu, 12 Aug 2010 13:08:25 +0200 письмо от Harald Hoyer<[email protected]>:
Quoted 16 lines · Harald Hoyer
Quoted 15 lines · Andrey Borzenkov
Review
Quoted 11 lines
(quoted diff) +11
-0+ + # KEYTABLE is a bit special - it defines base keymap name and UNICODE + # determines whether non-UNICODE or UNICODE version is used + + if [[ ${KEYTABLE} ]]; then + if [[ ${UNICODE} == 1 ]]; then + [[ ${KEYTABLE} =~ .*\.uni.* ]] || KEYTABLE=${KEYTABLE%.map*}.uni + fi + + KEYMAP=${KEYTABLE} + fiOn Fedora we would end with:
Quoted 8 lines
Quoted 7 lines
KEYTABLE="de-latin1-nodeadkeys"
at
KEYMAP="de-latin1-nodeadkeys.uni"
which does not exist.
Quoted 9 lines
Could you send me your
/etc/sysconfig/keyboard(or where these are defined)?So, in other words - you have UTF-8 environment but load non-UNICODE keyboard?
Quoted 1 line
Fedora's
console_initcalls "loadkeys" with "-u", if its LANG has .UTF-8It does not help here, unfortunately. Which version of initscripts is it? --
http://git.fedorahosted.org/git/?p=initscripts.git;a=blob;f=src/console_init.c
It's been like this forever...
http://git.fedorahosted.org/git/?p=initscripts.git;a=history;f=src/console_init.c
# loadkeys -u de-latin1-nodeadkeys Loading /lib/kbd/keymaps/i386/qwertz/de-latin1-nodeadkeys.map.gz
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 2 lines · On Thursday 12 of August 2010 16:28:28 Harald Hoyer wrote:
Quoted 1 line · Andrey Borzenkov
Thu, 12 Aug 2010 13:08:25 +0200 письмо от Harald
Hoyer<[email protected]>:
Quoted 39 lines
Quoted 27 lines
Quoted 16 lines · Harald Hoyer
Quoted 15 lines · Andrey Borzenkov
Quoted 11 lines
+
+ # KEYTABLE is a bit special - it defines base keymap name and UNICODE + # determines whether non-UNICODE or UNICODE version is used +
+ if [[ ${KEYTABLE} ]]; then
+ if [[ ${UNICODE} == 1 ]]; then
+ [[ ${KEYTABLE} =~ .*\.uni.* ]] || KEYTABLE=${KEYTABLE%.map*}.uni + fi
+
+ KEYMAP=${KEYTABLE}
+ fiOn Fedora we would end with:
Quoted 7 lines
Quoted 7 lines
KEYTABLE="de-latin1-nodeadkeys"
at
KEYMAP="de-latin1-nodeadkeys.uni"
which does not exist.
Could you send me your
/etc/sysconfig/keyboard(or where these are defined)?Quoted 8 lines
So, in other words - you have UTF-8 environment but load non-UNICODE keyboard?
Quoted 2 lines
Fedora's
console_initcalls "loadkeys" with "-u", if its LANG has .UTF-8It does not help here, unfortunately. Which version of initscripts is it? --
http://git.fedorahosted.org/git/?p=initscripts.git;a=blob;f=src/conso
le_init.c
Quoted 7 lines
It's been like this forever...
http://git.fedorahosted.org/git/?p=initscripts.git;a=history;f=src/co
nsole_init.c# loadkeys -u de-latin1-nodeadkeys Loading /lib/kbd/keymaps/i386/qwertz/de-latin1-nodeadkeys.map.gz
OK, so
- KEYTABLE handling is Mandriva specific patch. Sorry for confusion
- loadkeys -u fails misereably for all Russian keymaps that use 8 bit character set. This is generic kbd issue that is not easy to fix (in short - loadkeys treats all single byte characters as latin1. So it converts into UNICODE just fine - but not Russian UNICODE, rather Latin one ...).
This means there is no way to have single Russian keymap that works either in 8 bit or UTF-8 character sets. But Mandriva tools use single KEYTABLE for defining keyboard layout ...
I think I just leave it as distro-specific patch for now then.
Hello Andrey,
Andrey Borzenkov <arvidjaar-JGs/[email protected]>:
Quoted 6 lines
Original
console_initfrom RH initscripts supports KEYTABLE variable which dynamically determines whether to load UNICODE keymap depending on current LANG value.Scripts from 10i18n are more simplistic and assume the right keymap is statically defined in configuration files.
10i18n install script determines UTF-8 mode in basis of UNICODE variable value or LANG value. console_init doesn't have to perform any auto-detection again, although it might be useful to check LANG again instead of or additionally to checking UNICODE kernel cmdline arg. Maybe I'll add sth like this.
Quoted 3 lines
Add support for KEYTABLE to dynamically determine whether to install UNICODE or non-UNICODE keymap version. This should probably go into run-time 10i18n/console_init instead to be fully compatible.
-- CUT --
modules.d/10i18n/README The following variables are used by i18n install script and at initramfs · line 51
Quoted 3 lines
+ KEYTABLE - base name for keyboard translation table; if UNICODE
ismodules.d/10i18n/README +1
-0+ true, Unicode version will be loaded. Overrides KEYMAP.
-- CUT --
modules.d/10i18n/install install_all_kbd() { · line 129
Quoted 13 lines
+ # KEYTABLE is a bit special - it defines base keymap name and
UNICODEmodules.d/10i18n/install +5
-0+ # determines whether non-UNICODE or UNICODE version is used + + if [[ ${KEYTABLE} ]]; then + if [[ ${UNICODE} == 1 ]]; then + [[ ${KEYTABLE} =~ .*\.uni.* ]] ||KEYTABLE=${KEYTABLE%.map*}.uni
modules.d/10i18n/install +5
-0+ fi + + KEYMAP=${KEYTABLE} + fi +
What does *.uni* have to do with KEYMAP? Maybe I misunderstand it, but we set up keyboard with two things:
1) loadkeys to which we provide map from keymaps directory (where are no *.uni* files) and optionally '-u' which is UTF-8 switch;
2) kbd_mode to which we provide '-u' (UTF-8) or '-a' (ASCII).
*.uni* files are in unimaps directory. Those files are used by setfont.
Please explain me what is really the KEYTABLE variable and please check out if you can achieve what you want with mappings in config file. Have you read the README file?
If you have to resist with KEYTABLE, please publish archive with configs where those vars are set up in your system, kbd dirs and init scripts which set up those things.
Cheers,
Amadeusz Żołnowski
Signature · 1 line
PGP key: 1024D/C284750D