#!/bin/sh
set -e
. /usr/share/debconf/confmodule
db_capb backup
CONFIGFILE=/etc/default/keyboard
OLDCONFIGFILE=/etc/default/console-setup
debconf_toggle=''
debconf_switch=''
debconf_altgr=''
debconf_compose=''
debconf_layout=''
debconf_variant=''
XKBMODEL=''
XKBLAYOUT=''
XKBVARIANT=''
XKBOPTIONS=''
CAPB="$RET"
detect_keyboard=false
case $CAPB in
*plugin-detect-keyboard*)
detect_keyboard=:
;;
esac
if [ -f /usr/share/console-setup/keyboard-configuration.config ]; then
is_debian_installer=yes
is_not_debian_installer=''
else
is_debian_installer=''
is_not_debian_installer=yes
fi
read_config() {
[ -r $1 ] || return 0
. $1 || true
for var in XKBOPTIONS; do
if ! grep "^ *${var}=" $1 >/dev/null; then
eval ${var}=""
fi
done
}
which () {
local IFS
IFS=:
for i in $PATH; do
if [ -f "$i/$1" -a -x "$i/$1" ]; then
echo "$i/$1"
return 0
fi
done
return 1
}
db_default () {
db_get keyboard-configuration/store_defaults_in_debconf_db
if [ "$RET" = true ]; then
db_set $1 "$2"
fi
}
regex_escape () {
sed \
-e 's/[.]/%period%/g' \
-e 's/\[/%lbracket%/g' \
-e 's/\]/%rbracket%/g' \
-e 's/\^/%caret%/g' \
-e 's/\$/%dollar%/g' \
-e 's/\\/%bslash%/g' \
-e 's/[/]/%slash%/g' \
-e 's/[?]/%question%/g' \
-e 's/[+]/%plus%/g'
}
regex_pattern_escape () {
sed \
-e 's/[.]/%period%/g' \
-e 's/\[/%lbracket%/g' \
-e 's/\]/%rbracket%/g' \
-e 's/\^/%caret%/g' \
-e 's/\$/%dollar%/g' \
-e 's/\\/%bslash%/g' \
-e 's/[/]/%slash%/g' \
-e 's/[?]/%question%/g' \
-e 's/[+]/%plus%/g' \
-e 's/[*]/\\*/g'
}
regex_unescape () {
sed \
-e 's/%period%/./g' \
-e 's/%lbracket%/[/g' \
-e 's/%rbracket%/]/g' \
-e 's/%caret%/^/g' \
-e 's/%dollar%/$/g' \
-e 's/%bslash%/\\/g' \
-e 's/%slash%/\//g' \
-e 's/%question%/?/g' \
-e 's/%plus%/+/g'
}
all_kbdnames () {
cat <<'EOF' 
C*layout*af*Afghani
C*variant*af**Afghani
C*variant*af*ps*Afghani - Pashto
C*variant*af*olpc-ps*Afghani - Pashto (Afghanistan, OLPC)
C*variant*af*fa-olpc*Afghani - Persian (Afghanistan, Dari OLPC)
C*variant*af*uz*Afghani - Uzbek (Afghanistan)
C*variant*af*uz-olpc*Afghani - Uzbek (Afghanistan, OLPC)
C*layout*al*Albanian
C*variant*al**Albanian
C*variant*al*plisi*Albanian - Albanian (Plisi)
C*layout*et*Amharic
C*variant*et**Amharic
C*layout*ara*Arabic
C*variant*ara**Arabic
C*variant*ara*azerty*Arabic - Arabic (AZERTY)
C*variant*ara*azerty_digits*Arabic - Arabic (AZERTY/digits)
C*variant*ara*buckwalter*Arabic - Arabic (Buckwalter)
C*variant*ara*mac*Arabic - Arabic (Macintosh)
C*variant*ara*olpc*Arabic - Arabic (OLPC)
C*variant*ara*qwerty*Arabic - Arabic (QWERTY)
C*variant*ara*digits*Arabic - Arabic (digits)
C*variant*ara*qwerty_digits*Arabic - Arabic (qwerty/digits)
C*layout*ma*Arabic (Morocco)
C*variant*ma**Arabic (Morocco)
C*variant*ma*tifinagh-alt-phonetic*Arabic (Morocco) - Berber (Morocco, Tifinagh alt. phonetic)
C*variant*ma*tifinagh-alt*Arabic (Morocco) - Berber (Morocco, Tifinagh alt.)
C*variant*ma*tifinagh-extended-phonetic*Arabic (Morocco) - Berber (Morocco, Tifinagh extended phonetic)
C*variant*ma*tifinagh-extended*Arabic (Morocco) - Berber (Morocco, Tifinagh extended)
C*variant*ma*tifinagh-phonetic*Arabic (Morocco) - Berber (Morocco, Tifinagh phonetic)
C*variant*ma*tifinagh*Arabic (Morocco) - Berber (Morocco, Tifinagh)
C*variant*ma*french*Arabic (Morocco) - French (Morocco)
C*layout*sy*Arabic (Syria)
C*variant*sy**Arabic (Syria)
C*variant*sy*ku_f*Arabic (Syria) - Kurdish (Syria, F)
C*variant*sy*ku_alt*Arabic (Syria) - Kurdish (Syria, Latin Alt-Q)
C*variant*sy*ku*Arabic (Syria) - Kurdish (Syria, Latin Q)
C*variant*sy*syc*Arabic (Syria) - Syriac
C*variant*sy*syc_phonetic*Arabic (Syria) - Syriac (phonetic)
C*layout*am*Armenian
C*variant*am**Armenian
C*variant*am*eastern-alt*Armenian - Armenian (alt. eastern)
C*variant*am*phonetic-alt*Armenian - Armenian (alt. phonetic)
C*variant*am*eastern*Armenian - Armenian (eastern)
C*variant*am*phonetic*Armenian - Armenian (phonetic)
C*variant*am*western*Armenian - Armenian (western)
C*layout*az*Azerbaijani
C*variant*az**Azerbaijani
C*variant*az*cyrillic*Azerbaijani - Azerbaijani (Cyrillic)
C*layout*ml*Bambara
C*variant*ml**Bambara
C*variant*ml*us-mac*Bambara - English (Mali, US, Macintosh)
C*variant*ml*us-intl*Bambara - English (Mali, US, intl.)
C*variant*ml*fr-oss*Bambara - French (Mali, alt.)
C*layout*bd*Bangla
C*variant*bd**Bangla
C*variant*bd*probhat*Bangla - Bangla (Probhat)
C*layout*by*Belarusian
C*variant*by**Belarusian
C*variant*by*latin*Belarusian - Belarusian (Latin)
C*variant*by*legacy*Belarusian - Belarusian (legacy)
C*layout*be*Belgian
C*variant*be**Belgian
C*variant*be*wang*Belgian - Belgian (Wang 724 AZERTY)
C*variant*be*iso-alternate*Belgian - Belgian (alt. ISO)
C*variant*be*oss*Belgian - Belgian (alt.)
C*variant*be*oss_latin9*Belgian - Belgian (alt., Latin-9 only)
C*variant*be*oss_sundeadkeys*Belgian - Belgian (alt., with Sun dead keys)
C*variant*be*nodeadkeys*Belgian - Belgian (no dead keys)
C*variant*be*sundeadkeys*Belgian - Belgian (with Sun dead keys)
C*layout*dz*Berber (Algeria, Latin)
C*variant*dz**Berber (Algeria, Latin)
C*variant*dz*ar*Berber (Algeria, Latin) - Arabic (Algeria)
C*variant*dz*ber*Berber (Algeria, Latin) - Berber (Algeria, Tifinagh)
C*layout*ba*Bosnian
C*variant*ba**Bosnian
C*variant*ba*unicodeus*Bosnian - Bosnian (US, with Bosnian digraphs)
C*variant*ba*us*Bosnian - Bosnian (US, with Bosnian letters)
C*variant*ba*unicode*Bosnian - Bosnian (with Bosnian digraphs)
C*variant*ba*alternatequotes*Bosnian - Bosnian (with guillemets)
C*layout*brai*Braille
C*variant*brai**Braille
C*variant*brai*left_hand*Braille - Braille (left-handed)
C*variant*brai*right_hand*Braille - Braille (right-handed)
C*layout*bg*Bulgarian
C*variant*bg**Bulgarian
C*variant*bg*bas_phonetic*Bulgarian - Bulgarian (new phonetic)
C*variant*bg*phonetic*Bulgarian - Bulgarian (traditional phonetic)
C*layout*mm*Burmese
C*variant*mm**Burmese
C*layout*cn*Chinese
C*variant*cn**Chinese
C*variant*cn*tib*Chinese - Tibetan
C*variant*cn*tib_asciinum*Chinese - Tibetan (with ASCII numerals)
C*variant*cn*ug*Chinese - Uyghur
C*layout*hr*Croatian
C*variant*hr**Croatian
C*variant*hr*unicodeus*Croatian - Croatian (US, with Croatian digraphs)
C*variant*hr*us*Croatian - Croatian (US, with Croatian letters)
C*variant*hr*unicode*Croatian - Croatian (with Croatian digraphs)
C*variant*hr*alternatequotes*Croatian - Croatian (with guillemets)
C*layout*cz*Czech
C*variant*cz**Czech
C*variant*cz*qwerty*Czech - Czech (QWERTY)
C*variant*cz*qwerty_bksl*Czech - Czech (QWERTY, extended backslash)
C*variant*cz*ucw*Czech - Czech (UCW, only accented letters)
C*variant*cz*dvorak-ucw*Czech - Czech (US, Dvorak, UCW support)
C*variant*cz*bksl*Czech - Czech (with <\|> key)
C*variant*cz*rus*Czech - Russian (Czech, phonetic)
C*layout*dk*Danish
C*variant*dk**Danish
C*variant*dk*dvorak*Danish - Danish (Dvorak)
C*variant*dk*mac*Danish - Danish (Macintosh)
C*variant*dk*mac_nodeadkeys*Danish - Danish (Macintosh, no dead keys)
C*variant*dk*winkeys*Danish - Danish (Win keys)
C*variant*dk*nodeadkeys*Danish - Danish (no dead keys)
C*layout*mv*Dhivehi
C*variant*mv**Dhivehi
C*layout*nl*Dutch
C*variant*nl**Dutch
C*variant*nl*mac*Dutch - Dutch (Macintosh)
C*variant*nl*std*Dutch - Dutch (standard)
C*variant*nl*sundeadkeys*Dutch - Dutch (with Sun dead keys)
C*layout*bt*Dzongkha
C*variant*bt**Dzongkha
C*layout*au*English (Australian)
C*variant*au**English (Australian)
C*layout*cm*English (Cameroon)
C*variant*cm**English (Cameroon)
C*variant*cm*azerty*English (Cameroon) - Cameroon Multilingual (AZERTY)
C*variant*cm*dvorak*English (Cameroon) - Cameroon Multilingual (Dvorak)
C*variant*cm*qwerty*English (Cameroon) - Cameroon Multilingual (QWERTY)
C*variant*cm*french*English (Cameroon) - French (Cameroon)
C*variant*cm*mmuock*English (Cameroon) - Mmuock
C*layout*gh*English (Ghana)
C*variant*gh**English (Ghana)
C*variant*gh*akan*English (Ghana) - Akan
C*variant*gh*avn*English (Ghana) - Avatime
C*variant*gh*gillbt*English (Ghana) - English (Ghana, GILLBT)
C*variant*gh*generic*English (Ghana) - English (Ghana, multilingual)
C*variant*gh*ewe*English (Ghana) - Ewe
C*variant*gh*fula*English (Ghana) - Fula
C*variant*gh*ga*English (Ghana) - Ga
C*variant*gh*hausa*English (Ghana) - Hausa (Ghana)
C*layout*ng*English (Nigeria)
C*variant*ng**English (Nigeria)
C*variant*ng*hausa*English (Nigeria) - Hausa (Nigeria)
C*variant*ng*igbo*English (Nigeria) - Igbo
C*variant*ng*yoruba*English (Nigeria) - Yoruba
C*layout*za*English (South Africa)
C*variant*za**English (South Africa)
C*layout*gb*English (UK)
C*variant*gb**English (UK)
C*variant*gb*colemak*English (UK) - English (UK, Colemak)
C*variant*gb*dvorak*English (UK) - English (UK, Dvorak)
C*variant*gb*dvorakukp*English (UK) - English (UK, Dvorak, with UK punctuation)
C*variant*gb*mac*English (UK) - English (UK, Macintosh)
C*variant*gb*extd*English (UK) - English (UK, extended, with Win keys)
C*variant*gb*mac_intl*English (UK) - English (UK, intl., Macintosh)
C*variant*gb*intl*English (UK) - English (UK, intl., with dead keys)
C*layout*us*English (US)
C*variant*us**English (US)
C*variant*us*chr*English (US) - Cherokee
C*variant*us*colemak*English (US) - English (Colemak)
C*variant*us*dvorak*English (US) - English (Dvorak)
C*variant*us*dvorak-alt-intl*English (US) - English (Dvorak, alt. intl.)
C*variant*us*dvorak-intl*English (US) - English (Dvorak, intl., with dead keys)
C*variant*us*dvorak-l*English (US) - English (Dvorak, left-handed)
C*variant*us*dvorak-r*English (US) - English (Dvorak, right-handed)
C*variant*us*mac*English (US) - English (Macintosh)
C*variant*us*alt-intl*English (US) - English (US, alt. intl.)
C*variant*us*euro*English (US) - English (US, euro on 5)
C*variant*us*intl*English (US) - English (US, intl., with dead keys)
C*variant*us*workman*English (US) - English (Workman)
C*variant*us*workman-intl*English (US) - English (Workman, intl., with dead keys)
C*variant*us*dvorak-classic*English (US) - English (classic Dvorak)
C*variant*us*altgr-intl*English (US) - English (intl., with AltGr dead keys)
C*variant*us*dvp*English (US) - English (programmer Dvorak)
C*variant*us*olpc2*English (US) - English (the divide/multiply keys toggle the layout)
C*variant*us*rus*English (US) - Russian (US, phonetic)
C*variant*us*hbs*English (US) - Serbo-Croatian (US)
C*layout*epo*Esperanto
C*variant*epo**Esperanto
C*variant*epo*legacy*Esperanto - Esperanto (displaced semicolon and quote, obsolete)
C*layout*ee*Estonian
C*variant*ee**Estonian
C*variant*ee*dvorak*Estonian - Estonian (Dvorak)
C*variant*ee*us*Estonian - Estonian (US, with Estonian letters)
C*variant*ee*nodeadkeys*Estonian - Estonian (no dead keys)
C*layout*fo*Faroese
C*variant*fo**Faroese
C*variant*fo*nodeadkeys*Faroese - Faroese (no dead keys)
C*layout*ph*Filipino
C*variant*ph**Filipino
C*variant*ph*capewell-dvorak-bay*Filipino - Filipino (Capewell-Dvorak, Baybayin)
C*variant*ph*capewell-dvorak*Filipino - Filipino (Capewell-Dvorak, Latin)
C*variant*ph*capewell-qwerf2k6-bay*Filipino - Filipino (Capewell-QWERF 2006, Baybayin)
C*variant*ph*capewell-qwerf2k6*Filipino - Filipino (Capewell-QWERF 2006, Latin)
C*variant*ph*colemak-bay*Filipino - Filipino (Colemak, Baybayin)
C*variant*ph*colemak*Filipino - Filipino (Colemak, Latin)
C*variant*ph*dvorak-bay*Filipino - Filipino (Dvorak, Baybayin)
C*variant*ph*dvorak*Filipino - Filipino (Dvorak, Latin)
C*variant*ph*qwerty-bay*Filipino - Filipino (QWERTY, Baybayin)
C*layout*fi*Finnish
C*variant*fi**Finnish
C*variant*fi*mac*Finnish - Finnish (Macintosh)
C*variant*fi*winkeys*Finnish - Finnish (Winkeys)
C*variant*fi*classic*Finnish - Finnish (classic)
C*variant*fi*nodeadkeys*Finnish - Finnish (classic, no dead keys)
C*variant*fi*smi*Finnish - Northern Saami (Finland)
C*layout*fr*French
C*variant*fr**French
C*variant*fr*azerty*French - French (AZERTY)
C*variant*fr*bepo*French - French (Bepo, ergonomic, Dvorak way)
C*variant*fr*bepo_latin9*French - French (Bepo, ergonomic, Dvorak way, Latin-9 only)
C*variant*fr*bre*French - French (Breton)
C*variant*fr*dvorak*French - French (Dvorak)
C*variant*fr*mac*French - French (Macintosh)
C*variant*fr*oss*French - French (alt.)
C*variant*fr*oss_latin9*French - French (alt., Latin-9 only)
C*variant*fr*oss_nodeadkeys*French - French (alt., no dead keys)
C*variant*fr*oss_sundeadkeys*French - French (alt., with Sun dead keys)
C*variant*fr*latin9*French - French (legacy, alt.)
C*variant*fr*latin9_nodeadkeys*French - French (legacy, alt., no dead keys)
C*variant*fr*latin9_sundeadkeys*French - French (legacy, alt., with Sun dead keys)
C*variant*fr*nodeadkeys*French - French (no dead keys)
C*variant*fr*sundeadkeys*French - French (with Sun dead keys)
C*variant*fr*geo*French - Georgian (France, AZERTY Tskapo)
C*variant*fr*oci*French - Occitan
C*layout*ca*French (Canada)
C*variant*ca**French (Canada)
C*variant*ca*multix*French (Canada) - Canadian Multilingual
C*variant*ca*multi*French (Canada) - Canadian Multilingual (1st part)
C*variant*ca*multi-2gr*French (Canada) - Canadian Multilingual (2nd part)
C*variant*ca*eng*French (Canada) - English (Canada)
C*variant*ca*fr-dvorak*French (Canada) - French (Canada, Dvorak)
C*variant*ca*fr-legacy*French (Canada) - French (Canada, legacy)
C*variant*ca*ike*French (Canada) - Inuktitut
C*layout*cd*French (Democratic Republic of the Congo)
C*variant*cd**French (Democratic Republic of the Congo)
C*layout*gn*French (Guinea)
C*variant*gn**French (Guinea)
C*layout*tg*French (Togo)
C*variant*tg**French (Togo)
C*layout*ge*Georgian
C*variant*ge**Georgian
C*variant*ge*mess*Georgian - Georgian (MESS)
C*variant*ge*ergonomic*Georgian - Georgian (ergonomic)
C*variant*ge*os*Georgian - Ossetian (Georgia)
C*variant*ge*ru*Georgian - Russian (Georgia)
C*layout*de*German
C*variant*de**German
C*variant*de*dvorak*German - German (Dvorak)
C*variant*de*mac*German - German (Macintosh)
C*variant*de*mac_nodeadkeys*German - German (Macintosh, no dead keys)
C*variant*de*neo*German - German (Neo 2)
C*variant*de*qwerty*German - German (QWERTY)
C*variant*de*T3*German - German (T3)
C*variant*de*deadacute*German - German (dead acute)
C*variant*de*deadgraveacute*German - German (dead grave acute)
C*variant*de*deadtilde*German - German (dead tilde)
C*variant*de*nodeadkeys*German - German (no dead keys)
C*variant*de*sundeadkeys*German - German (with Sun dead keys)
C*variant*de*dsb*German - Lower Sorbian
C*variant*de*dsb_qwertz*German - Lower Sorbian (QWERTZ)
C*variant*de*ro*German - Romanian (Germany)
C*variant*de*ro_nodeadkeys*German - Romanian (Germany, no dead keys)
C*variant*de*ru*German - Russian (Germany, phonetic)
C*variant*de*tr*German - Turkish (Germany)
C*layout*at*German (Austria)
C*variant*at**German (Austria)
C*variant*at*mac*German (Austria) - German (Austria, Macintosh)
C*variant*at*nodeadkeys*German (Austria) - German (Austria, no dead keys)
C*variant*at*sundeadkeys*German (Austria) - German (Austria, with Sun dead keys)
C*layout*gr*Greek
C*variant*gr**Greek
C*variant*gr*extended*Greek - Greek (extended)
C*variant*gr*nodeadkeys*Greek - Greek (no dead keys)
C*variant*gr*polytonic*Greek - Greek (polytonic)
C*variant*gr*simple*Greek - Greek (simple)
C*layout*il*Hebrew
C*variant*il**Hebrew
C*variant*il*biblical*Hebrew - Hebrew (Biblical, Tiro)
C*variant*il*lyx*Hebrew - Hebrew (lyx)
C*variant*il*phonetic*Hebrew - Hebrew (phonetic)
C*layout*hu*Hungarian
C*variant*hu**Hungarian
C*variant*hu*101_qwerty_comma_dead*Hungarian - Hungarian (101/QWERTY/comma/dead keys)
C*variant*hu*101_qwerty_comma_nodead*Hungarian - Hungarian (101/QWERTY/comma/no dead keys)
C*variant*hu*101_qwerty_dot_dead*Hungarian - Hungarian (101/QWERTY/dot/dead keys)
C*variant*hu*101_qwerty_dot_nodead*Hungarian - Hungarian (101/QWERTY/dot/no dead keys)
C*variant*hu*101_qwertz_comma_dead*Hungarian - Hungarian (101/QWERTZ/comma/dead keys)
C*variant*hu*101_qwertz_comma_nodead*Hungarian - Hungarian (101/QWERTZ/comma/no dead keys)
C*variant*hu*101_qwertz_dot_dead*Hungarian - Hungarian (101/QWERTZ/dot/dead keys)
C*variant*hu*101_qwertz_dot_nodead*Hungarian - Hungarian (101/QWERTZ/dot/no dead keys)
C*variant*hu*102_qwerty_comma_dead*Hungarian - Hungarian (102/QWERTY/comma/dead keys)
C*variant*hu*102_qwerty_comma_nodead*Hungarian - Hungarian (102/QWERTY/comma/no dead keys)
C*variant*hu*102_qwerty_dot_dead*Hungarian - Hungarian (102/QWERTY/dot/dead keys)
C*variant*hu*102_qwerty_dot_nodead*Hungarian - Hungarian (102/QWERTY/dot/no dead keys)
C*variant*hu*102_qwertz_comma_dead*Hungarian - Hungarian (102/QWERTZ/comma/dead keys)
C*variant*hu*102_qwertz_comma_nodead*Hungarian - Hungarian (102/QWERTZ/comma/no dead keys)
C*variant*hu*102_qwertz_dot_dead*Hungarian - Hungarian (102/QWERTZ/dot/dead keys)
C*variant*hu*102_qwertz_dot_nodead*Hungarian - Hungarian (102/QWERTZ/dot/no dead keys)
C*variant*hu*qwerty*Hungarian - Hungarian (QWERTY)
C*variant*hu*nodeadkeys*Hungarian - Hungarian (no dead keys)
C*variant*hu*standard*Hungarian - Hungarian (standard)
C*layout*is*Icelandic
C*variant*is**Icelandic
C*variant*is*dvorak*Icelandic - Icelandic (Dvorak)
C*variant*is*mac*Icelandic - Icelandic (Macintosh)
C*variant*is*mac_legacy*Icelandic - Icelandic (Macintosh, legacy)
C*variant*is*nodeadkeys*Icelandic - Icelandic (no dead keys)
C*variant*is*Sundeadkeys*Icelandic - Icelandic (with Sun dead keys)
C*layout*in*Indian
C*variant*in**Indian
C*variant*in*ben*Indian - Bangla (India)
C*variant*in*ben_inscript*Indian - Bangla (India, Baishakhi Inscript)
C*variant*in*ben_baishakhi*Indian - Bangla (India, Baishakhi)
C*variant*in*ben_bornona*Indian - Bangla (India, Bornona)
C*variant*in*ben_probhat*Indian - Bangla (India, Probhat)
C*variant*in*ben_gitanjali*Indian - Bangla (India, Uni Gitanjali)
C*variant*in*eng*Indian - English (India, with rupee)
C*variant*in*guj*Indian - Gujarati
C*variant*in*bolnagri*Indian - Hindi (Bolnagri)
C*variant*in*hin-kagapa*Indian - Hindi (KaGaPa phonetic)
C*variant*in*hin-wx*Indian - Hindi (Wx)
C*variant*in*kan*Indian - Kannada
C*variant*in*kan-kagapa*Indian - Kannada (KaGaPa phonetic)
C*variant*in*mal*Indian - Malayalam
C*variant*in*mal_lalitha*Indian - Malayalam (Lalitha)
C*variant*in*mal_enhanced*Indian - Malayalam (enhanced Inscript, with rupee)
C*variant*in*eeyek*Indian - Manipuri (Eeyek)
C*variant*in*mar-kagapa*Indian - Marathi (KaGaPa phonetic)
C*variant*in*olck*Indian - Ol Chiki
C*variant*in*ori*Indian - Oriya
C*variant*in*jhelum*Indian - Punjabi (Gurmukhi Jhelum)
C*variant*in*guru*Indian - Punjabi (Gurmukhi)
C*variant*in*san-kagapa*Indian - Sanskrit (KaGaPa phonetic)
C*variant*in*tam*Indian - Tamil
C*variant*in*tam_TAB*Indian - Tamil (TAB typewriter)
C*variant*in*tam_TSCII*Indian - Tamil (TSCII typewriter)
C*variant*in*tam_unicode*Indian - Tamil (Unicode)
C*variant*in*tam_keyboard_with_numerals*Indian - Tamil (keyboard with numerals)
C*variant*in*tel*Indian - Telugu
C*variant*in*tel-kagapa*Indian - Telugu (KaGaPa phonetic)
C*variant*in*tel-sarala*Indian - Telugu (Sarala)
C*variant*in*urd-winkeys*Indian - Urdu (Win keys)
C*variant*in*urd-phonetic3*Indian - Urdu (alt. phonetic)
C*variant*in*urd-phonetic*Indian - Urdu (phonetic)
C*layout*id*Indonesian (Jawi)
C*variant*id**Indonesian (Jawi)
C*layout*iq*Iraqi
C*variant*iq**Iraqi
C*variant*iq*ku_ara*Iraqi - Kurdish (Iraq, Arabic-Latin)
C*variant*iq*ku_f*Iraqi - Kurdish (Iraq, F)
C*variant*iq*ku_alt*Iraqi - Kurdish (Iraq, Latin Alt-Q)
C*variant*iq*ku*Iraqi - Kurdish (Iraq, Latin Q)
C*layout*ie*Irish
C*variant*ie**Irish
C*variant*ie*CloGaelach*Irish - CloGaelach
C*variant*ie*UnicodeExpert*Irish - Irish (UnicodeExpert)
C*variant*ie*ogam*Irish - Ogham
C*variant*ie*ogam_is434*Irish - Ogham (IS434)
C*layout*it*Italian
C*variant*it**Italian
C*variant*it*geo*Italian - Georgian (Italy)
C*variant*it*ibm*Italian - Italian (IBM 142)
C*variant*it*mac*Italian - Italian (Macintosh)
C*variant*it*us*Italian - Italian (US, with Italian letters)
C*variant*it*winkeys*Italian - Italian (Winkeys)
C*variant*it*intl*Italian - Italian (intl., with dead keys)
C*variant*it*nodeadkeys*Italian - Italian (no dead keys)
C*variant*it*scn*Italian - Sicilian
C*layout*jp*Japanese
C*variant*jp**Japanese
C*variant*jp*dvorak*Japanese - Japanese (Dvorak)
C*variant*jp*kana86*Japanese - Japanese (Kana 86)
C*variant*jp*kana*Japanese - Japanese (Kana)
C*variant*jp*mac*Japanese - Japanese (Macintosh)
C*variant*jp*OADG109A*Japanese - Japanese (OADG 109A)
C*layout*nec_vndr/jp*Japanese (PC-98)
C*variant*nec_vndr/jp**Japanese (PC-98)
C*layout*kz*Kazakh
C*variant*kz**Kazakh
C*variant*kz*ext*Kazakh - Kazakh (extended)
C*variant*kz*kazrus*Kazakh - Kazakh (with Russian)
C*variant*kz*ruskaz*Kazakh - Russian (Kazakhstan, with Kazakh)
C*layout*kh*Khmer (Cambodia)
C*variant*kh**Khmer (Cambodia)
C*layout*kr*Korean
C*variant*kr**Korean
C*variant*kr*kr104*Korean - Korean (101/104 key compatible)
C*layout*kg*Kyrgyz
C*variant*kg**Kyrgyz
C*variant*kg*phonetic*Kyrgyz - Kyrgyz (phonetic)
C*layout*la*Lao
C*variant*la**Lao
C*variant*la*stea*Lao - Lao (STEA proposed standard layout)
C*layout*lv*Latvian
C*variant*lv**Latvian
C*variant*lv*fkey*Latvian - Latvian (F)
C*variant*lv*adapted*Latvian - Latvian (adapted)
C*variant*lv*apostrophe*Latvian - Latvian (apostrophe)
C*variant*lv*ergonomic*Latvian - Latvian (ergonomic, ŪGJRMV)
C*variant*lv*modern*Latvian - Latvian (modern)
C*variant*lv*tilde*Latvian - Latvian (tilde)
C*layout*lt*Lithuanian
C*variant*lt**Lithuanian
C*variant*lt*ibm*Lithuanian - Lithuanian (IBM LST 1205-92)
C*variant*lt*lekp*Lithuanian - Lithuanian (LEKP)
C*variant*lt*lekpa*Lithuanian - Lithuanian (LEKPa)
C*variant*lt*us*Lithuanian - Lithuanian (US, with Lithuanian letters)
C*variant*lt*std*Lithuanian - Lithuanian (standard)
C*layout*mk*Macedonian
C*variant*mk**Macedonian
C*variant*mk*nodeadkeys*Macedonian - Macedonian (no dead keys)
C*layout*my*Malay (Jawi, Arabic Keyboard)
C*variant*my**Malay (Jawi, Arabic Keyboard)
C*variant*my*phonetic*Malay (Jawi, Arabic Keyboard) - Malay (Jawi, phonetic)
C*layout*mt*Maltese
C*variant*mt**Maltese
C*variant*mt*us*Maltese - Maltese (with US layout)
C*layout*mao*Maori
C*variant*mao**Maori
C*layout*md*Moldavian
C*variant*md**Moldavian
C*variant*md*gag*Moldavian - Moldavian (Gagauz)
C*layout*mn*Mongolian
C*variant*mn**Mongolian
C*layout*me*Montenegrin
C*variant*me**Montenegrin
C*variant*me*cyrillicalternatequotes*Montenegrin - Montenegrin (Cyrillic with guillemets)
C*variant*me*cyrillic*Montenegrin - Montenegrin (Cyrillic)
C*variant*me*cyrillicyz*Montenegrin - Montenegrin (Cyrillic, ZE and ZHE swapped)
C*variant*me*latinalternatequotes*Montenegrin - Montenegrin (Latin with guillemets)
C*variant*me*latinyz*Montenegrin - Montenegrin (Latin, QWERTY)
C*variant*me*latinunicode*Montenegrin - Montenegrin (Latin, Unicode)
C*variant*me*latinunicodeyz*Montenegrin - Montenegrin (Latin, Unicode, QWERTY)
C*layout*np*Nepali
C*variant*np**Nepali
C*layout*no*Norwegian
C*variant*no**Norwegian
C*variant*no*smi*Norwegian - Northern Saami (Norway)
C*variant*no*smi_nodeadkeys*Norwegian - Northern Saami (Norway, no dead keys)
C*variant*no*colemak*Norwegian - Norwegian (Colemak)
C*variant*no*dvorak*Norwegian - Norwegian (Dvorak)
C*variant*no*mac*Norwegian - Norwegian (Macintosh)
C*variant*no*mac_nodeadkeys*Norwegian - Norwegian (Macintosh, no dead keys)
C*variant*no*winkeys*Norwegian - Norwegian (Win keys)
C*variant*no*nodeadkeys*Norwegian - Norwegian (no dead keys)
C*layout*ir*Persian
C*variant*ir**Persian
C*variant*ir*ku_ara*Persian - Kurdish (Iran, Arabic-Latin)
C*variant*ir*ku_f*Persian - Kurdish (Iran, F)
C*variant*ir*ku_alt*Persian - Kurdish (Iran, Latin Alt-Q)
C*variant*ir*ku*Persian - Kurdish (Iran, Latin Q)
C*variant*ir*pes_keypad*Persian - Persian (with Persian keypad)
C*layout*pl*Polish
C*variant*pl**Polish
C*variant*pl*csb*Polish - Kashubian
C*variant*pl*dvorak*Polish - Polish (Dvorak)
C*variant*pl*dvorak_altquotes*Polish - Polish (Dvorak, with Polish quotes on key 1)
C*variant*pl*dvorak_quotes*Polish - Polish (Dvorak, with Polish quotes on quotemark key)
C*variant*pl*qwertz*Polish - Polish (QWERTZ)
C*variant*pl*legacy*Polish - Polish (legacy)
C*variant*pl*dvp*Polish - Polish (programmer Dvorak)
C*variant*pl*ru_phonetic_dvorak*Polish - Russian (Poland, phonetic Dvorak)
C*variant*pl*szl*Polish - Silesian
C*layout*pt*Portuguese
C*variant*pt**Portuguese
C*variant*pt*nativo-epo*Portuguese - Esperanto (Portugal, Nativo)
C*variant*pt*mac*Portuguese - Portuguese (Macintosh)
C*variant*pt*mac_nodeadkeys*Portuguese - Portuguese (Macintosh, no dead keys)
C*variant*pt*mac_sundeadkeys*Portuguese - Portuguese (Macintosh, with Sun dead keys)
C*variant*pt*nativo-us*Portuguese - Portuguese (Nativo for US keyboards)
C*variant*pt*nativo*Portuguese - Portuguese (Nativo)
C*variant*pt*nodeadkeys*Portuguese - Portuguese (no dead keys)
C*variant*pt*sundeadkeys*Portuguese - Portuguese (with Sun dead keys)
C*layout*br*Portuguese (Brazil)
C*variant*br**Portuguese (Brazil)
C*variant*br*nativo-epo*Portuguese (Brazil) - Esperanto (Brazil, Nativo)
C*variant*br*dvorak*Portuguese (Brazil) - Portuguese (Brazil, Dvorak)
C*variant*br*thinkpad*Portuguese (Brazil) - Portuguese (Brazil, IBM/Lenovo ThinkPad)
C*variant*br*nativo-us*Portuguese (Brazil) - Portuguese (Brazil, Nativo for US keyboards)
C*variant*br*nativo*Portuguese (Brazil) - Portuguese (Brazil, Nativo)
C*variant*br*nodeadkeys*Portuguese (Brazil) - Portuguese (Brazil, no dead keys)
C*layout*ro*Romanian
C*variant*ro**Romanian
C*variant*ro*winkeys*Romanian - Romanian (Win keys)
C*variant*ro*cedilla*Romanian - Romanian (cedilla)
C*variant*ro*std_cedilla*Romanian - Romanian (standard cedilla)
C*variant*ro*std*Romanian - Romanian (standard)
C*layout*ru*Russian
C*variant*ru**Russian
C*variant*ru*bak*Russian - Bashkirian
C*variant*ru*cv*Russian - Chuvash
C*variant*ru*cv_latin*Russian - Chuvash (Latin)
C*variant*ru*xal*Russian - Kalmyk
C*variant*ru*kom*Russian - Komi
C*variant*ru*chm*Russian - Mari
C*variant*ru*os_winkeys*Russian - Ossetian (Win keys)
C*variant*ru*os_legacy*Russian - Ossetian (legacy)
C*variant*ru*dos*Russian - Russian (DOS)
C*variant*ru*mac*Russian - Russian (Macintosh)
C*variant*ru*legacy*Russian - Russian (legacy)
C*variant*ru*phonetic*Russian - Russian (phonetic)
C*variant*ru*phonetic_azerty*Russian - Russian (phonetic, AZERTY)
C*variant*ru*phonetic_dvorak*Russian - Russian (phonetic, Dvorak)
C*variant*ru*phonetic_fr*Russian - Russian (phonetic, French)
C*variant*ru*phonetic_winkeys*Russian - Russian (phonetic, with Win keys)
C*variant*ru*typewriter*Russian - Russian (typewriter)
C*variant*ru*typewriter-legacy*Russian - Russian (typewriter, legacy)
C*variant*ru*srp*Russian - Serbian (Russia)
C*variant*ru*tt*Russian - Tatar
C*variant*ru*udm*Russian - Udmurt
C*variant*ru*sah*Russian - Yakut
C*layout*rs*Serbian
C*variant*rs**Serbian
C*variant*rs*rue*Serbian - Pannonian Rusyn
C*variant*rs*alternatequotes*Serbian - Serbian (Cyrillic with guillemets)
C*variant*rs*yz*Serbian - Serbian (Cyrillic, ZE and ZHE swapped)
C*variant*rs*latinalternatequotes*Serbian - Serbian (Latin with guillemets)
C*variant*rs*latin*Serbian - Serbian (Latin)
C*variant*rs*latinyz*Serbian - Serbian (Latin, QWERTY)
C*variant*rs*latinunicode*Serbian - Serbian (Latin, Unicode)
C*variant*rs*latinunicodeyz*Serbian - Serbian (Latin, Unicode, QWERTY)
C*layout*lk*Sinhala (phonetic)
C*variant*lk**Sinhala (phonetic)
C*variant*lk*us*Sinhala (phonetic) - Sinhala (US, with Sinhala letters)
C*variant*lk*tam_TAB*Sinhala (phonetic) - Tamil (Sri Lanka, TAB Typewriter)
C*variant*lk*tam_unicode*Sinhala (phonetic) - Tamil (Sri Lanka, Unicode)
C*layout*sk*Slovak
C*variant*sk**Slovak
C*variant*sk*qwerty*Slovak - Slovak (QWERTY)
C*variant*sk*qwerty_bksl*Slovak - Slovak (QWERTY, extended backslash)
C*variant*sk*bksl*Slovak - Slovak (extended backslash)
C*layout*si*Slovenian
C*variant*si**Slovenian
C*variant*si*us*Slovenian - Slovenian (US, with Slovenian letters)
C*variant*si*alternatequotes*Slovenian - Slovenian (with guillemets)
C*layout*es*Spanish
C*variant*es**Spanish
C*variant*es*ast*Spanish - Asturian (Spain, with bottom-dot H and bottom-dot L)
C*variant*es*cat*Spanish - Catalan (Spain, with middle-dot L)
C*variant*es*dvorak*Spanish - Spanish (Dvorak)
C*variant*es*mac*Spanish - Spanish (Macintosh)
C*variant*es*winkeys*Spanish - Spanish (Win keys)
C*variant*es*deadtilde*Spanish - Spanish (dead tilde)
C*variant*es*nodeadkeys*Spanish - Spanish (no dead keys)
C*variant*es*sundeadkeys*Spanish - Spanish (with Sun dead keys)
C*layout*latam*Spanish (Latin American)
C*variant*latam**Spanish (Latin American)
C*variant*latam*dvorak*Spanish (Latin American) - Spanish (Latin American, Dvorak)
C*variant*latam*deadtilde*Spanish (Latin American) - Spanish (Latin American, dead tilde)
C*variant*latam*nodeadkeys*Spanish (Latin American) - Spanish (Latin American, no dead keys)
C*variant*latam*sundeadkeys*Spanish (Latin American) - Spanish (Latin American, with Sun dead keys)
C*layout*ke*Swahili (Kenya)
C*variant*ke**Swahili (Kenya)
C*variant*ke*kik*Swahili (Kenya) - Kikuyu
C*layout*tz*Swahili (Tanzania)
C*variant*tz**Swahili (Tanzania)
C*layout*se*Swedish
C*variant*se**Swedish
C*variant*se*smi*Swedish - Northern Saami (Sweden)
C*variant*se*rus*Swedish - Russian (Sweden, phonetic)
C*variant*se*rus_nodeadkeys*Swedish - Russian (Sweden, phonetic, no dead keys)
C*variant*se*dvorak*Swedish - Swedish (Dvorak)
C*variant*se*mac*Swedish - Swedish (Macintosh)
C*variant*se*svdvorak*Swedish - Swedish (Svdvorak)
C*variant*se*us_dvorak*Swedish - Swedish (based on US Intl. Dvorak)
C*variant*se*nodeadkeys*Swedish - Swedish (no dead keys)
C*variant*se*swl*Swedish - Swedish Sign Language
C*layout*ch*Switzerland
C*variant*ch**Switzerland
C*variant*ch*fr*Switzerland - French (Switzerland)
C*variant*ch*fr_mac*Switzerland - French (Switzerland, Macintosh)
C*variant*ch*fr_nodeadkeys*Switzerland - French (Switzerland, no dead keys)
C*variant*ch*fr_sundeadkeys*Switzerland - French (Switzerland, with Sun dead keys)
C*variant*ch*de_mac*Switzerland - German (Switzerland, Macintosh)
C*variant*ch*legacy*Switzerland - German (Switzerland, legacy)
C*variant*ch*de_nodeadkeys*Switzerland - German (Switzerland, no dead keys)
C*variant*ch*de_sundeadkeys*Switzerland - German (Switzerland, with Sun dead keys)
C*layout*tw*Taiwanese
C*variant*tw**Taiwanese
C*variant*tw*saisiyat*Taiwanese - Saisiyat (Taiwan)
C*variant*tw*indigenous*Taiwanese - Taiwanese (indigenous)
C*layout*tj*Tajik
C*variant*tj**Tajik
C*variant*tj*legacy*Tajik - Tajik (legacy)
C*layout*th*Thai
C*variant*th**Thai
C*variant*th*pat*Thai - Thai (Pattachote)
C*variant*th*tis*Thai - Thai (TIS-820.2538)
C*layout*bw*Tswana
C*variant*bw**Tswana
C*layout*tr*Turkish
C*variant*tr**Turkish
C*variant*tr*crh_alt*Turkish - Crimean Tatar (Turkish Alt-Q)
C*variant*tr*crh_f*Turkish - Crimean Tatar (Turkish F)
C*variant*tr*crh*Turkish - Crimean Tatar (Turkish Q)
C*variant*tr*ku_f*Turkish - Kurdish (Turkey, F)
C*variant*tr*ku_alt*Turkish - Kurdish (Turkey, Latin Alt-Q)
C*variant*tr*ku*Turkish - Kurdish (Turkey, Latin Q)
C*variant*tr*alt*Turkish - Turkish (Alt-Q)
C*variant*tr*f*Turkish - Turkish (F)
C*variant*tr*intl*Turkish - Turkish (intl., with dead keys)
C*variant*tr*sundeadkeys*Turkish - Turkish (with Sun dead keys)
C*layout*tm*Turkmen
C*variant*tm**Turkmen
C*variant*tm*alt*Turkmen - Turkmen (Alt-Q)
C*layout*ua*Ukrainian
C*variant*ua**Ukrainian
C*variant*ua*rstu_ru*Ukrainian - Russian (Ukraine, standard RSTU)
C*variant*ua*winkeys*Ukrainian - Ukrainian (Win keys)
C*variant*ua*homophonic*Ukrainian - Ukrainian (homophonic)
C*variant*ua*legacy*Ukrainian - Ukrainian (legacy)
C*variant*ua*phonetic*Ukrainian - Ukrainian (phonetic)
C*variant*ua*rstu*Ukrainian - Ukrainian (standard RSTU)
C*variant*ua*typewriter*Ukrainian - Ukrainian (typewriter)
C*layout*pk*Urdu (Pakistan)
C*variant*pk**Urdu (Pakistan)
C*variant*pk*ara*Urdu (Pakistan) - Arabic (Pakistan)
C*variant*pk*snd*Urdu (Pakistan) - Sindhi
C*variant*pk*urd-crulp*Urdu (Pakistan) - Urdu (Pakistan, CRULP)
C*variant*pk*urd-nla*Urdu (Pakistan) - Urdu (Pakistan, NLA)
C*layout*uz*Uzbek
C*variant*uz**Uzbek
C*variant*uz*latin*Uzbek - Uzbek (Latin)
C*layout*vn*Vietnamese
C*variant*vn**Vietnamese
C*layout*sn*Wolof
C*variant*sn**Wolof
EOF
[ ! -f /usr/share/console-setup/kbdnames.gz ] || zcat /usr/share/console-setup/kbdnames.gz 
}
keyboard_present () {
local kern kbdpattern class subclass protocol
kern=`uname -r`
case "$kern" in
1*|2.0*|2.1*|2.2*|2.3*|2.4*|2.5*)
return 0; 
;;
esac
[ -d /sys/bus/usb/devices ] || return 0
for d in /sys/bus/usb/devices/*:*; do
[ -d "$d" ] || continue
class=$(cat "$d/bInterfaceClass") # 03 = Human Interface Device
subclass=$(cat "$d/bInterfaceSubClass") # 01 = Boot Interface Subclass
protocol=$(cat "$d/bInterfaceProtocol") # 01 = Keyboard
case "$class:$subclass:$protocol" in
03:01:01)
return 0
;;
esac
done
[ -f /proc/bus/input/devices ] || return 0
kbdpattern="AT Set \|AT Translated Set\|AT Raw Set"
kbdpattern="$kbdpattern\|Atari Keyboard"
kbdpattern="$kbdpattern\|Amiga Keyboard"
kbdpattern="$kbdpattern\|HIL keyboard"
kbdpattern="$kbdpattern\|ADB keyboard"
kbdpattern="$kbdpattern\|Sun Type"
kbdpattern="$kbdpattern\|bluetooth.*keyboard"
if grep -i "$kbdpattern" /proc/bus/input/devices >/dev/null; then
return 0
fi
return 1
}
ask_debconf () {
local template priority prefix default_code default_description choices add
template="$1"
priority="$2"
prefix="$(echo "$3"|regex_pattern_escape)"
default_code="$(echo "$4"|regex_pattern_escape)"
add="$(echo "$5"|regex_escape)"
add="
$add"
choices1=`echo "$kbdnames" | grep "^$prefix\*" | 
sed -e "s/^$prefix\*[^\*]*\*//" -e 's/,/\\\\,/g' | sort`
choices2=`echo "$add" | grep "^$prefix\*" | 
sed -e "s/^$prefix\*[^\*]*\*//" -e 's/,/\\\\,/g'`
choices=`echo "$choices1
$choices2" | sed -e 's/$/,/'`
choices=`echo $choices | sed 's/, *$//' | regex_unescape`
choices=`echo $choices | sed 's/,$//'`
if echo "$choices" | grep '[^\\\\],' >/dev/null; then
db_subst $template CHOICES "$choices"
default_description=`echo "$kbdnames$add" |  
grep "^$prefix\*${default_code}\*" |
sed -e "s/^$prefix\*${default_code}\*//" |
regex_unescape`
if [ -z "$default_description" ]; then
default_description=`echo "$kbdnames$add" |  
grep "^$prefix\*\*" |
sed -e "s/^$prefix\*\*//" |
regex_unescape `
fi
if [ -n "$default_description" ]; then
db_default $template "$default_description"
elif [ -n "$default_code" ]; then
priority=critical
fi
db_input $priority $template || true
db_go || return 255
db_get $template
else
[ $STATE -gt $old_state ] || return 255
RET=$(echo "$choices"|sed 's/ *$//')
fi
RET=`echo "$RET" | regex_pattern_escape`
RET=`echo "$kbdnames$add" | grep "^$prefix\*[^\*]*\*" |
sed 's/  */ /g' |
grep "\*$RET\$" |
sed -e "s/^$prefix\*\([^\*]*\)\*.*/\1/" |
regex_unescape`
return 0
}
guess_arch () {
local arch subarch line
if which archdetect 2>/dev/null >/dev/null; then
archdetect
return 0
fi
arch=`dpkg --print-architecture`
if [ "$arch" = 'powerpc' -o "$arch" = 'm68k' ]; then
if [ "$arch" = powerpc ]; then
line=`sed -n 's/^platform.*: *//p' /proc/cpuinfo`
if [ "$line" = PS3 ] || [ "$line" = Cell ]; then
subarch=`echo $line|tr A-Z a-z`
else
line=`sed -n 's/^machine.*: *//p' /proc/cpuinfo`
if [ "$line" = '' ]; then
echo unknown
return 0
fi
subarch=`echo $line|tr A-Z a-z`
fi
elif [ "$arch" = m68k ]; then
line=`sed -n 's/^Model.*: *//p' /proc/hardware`
if [ "$line" = '' ]; then
echo unknown
return 0
fi
subarch=`echo $line|tr A-Z a-z`
fi
case "$subarch" in
*amiga*)
subarch=amiga
;;
*chrp*)
subarch=chrp
;;
*prep*)
subarch=prep
;;
*macintosh*|*powermac*|*powerbook*|*power*|*imac*|*powermac1*)
subarch=mac
;;
*atari*)
subarch=atari
;;
*motorola*)
subarch=mvme
;;
*bvme*)
subarch=bvme
;;
*)
subarch=`echo $subarch|sed  's/^\s*//'`
;;
esac
arch="$arch/$subarch"
fi
echo $arch
return 0
}
if which locale 2>/dev/null >/dev/null; then
eval `locale`
fi
if [ "$LC_CTYPE"  -a "$LC_CTYPE" != C ]; then
locale=$LC_CTYPE
elif db_get debian-installer/locale && [ "$RET" ]; then
locale="$RET"
else
locale=C
fi
langcountry="$locale"
if ! type locale >/dev/null 2>&1 || [ "$OVERRIDE_USE_DEBCONF_LOCALE" ]; then
if db_get localechooser/languagelist && [ "$RET" ]; then
lang="$RET"
if db_get debian-installer/country && [ "$RET" ]; then
langcountry="${lang}_$RET"
fi
fi
fi
if [ "$LC_MESSAGES"  -a "$LC_MESSAGES" != C ]; then
messages=$LC_MESSAGES
elif db_get debian-installer/locale && [ "$RET" ]; then
messages="$RET"
else
messages=C
fi
messages_lang=$(echo $messages | sed 's/_.*//')
messages_country=$(echo $messages | sed 's/.*_//;s/\..*//;s/@.*//')
messages_modif=
echo $messages | grep -v -q @ || messages_modif=$(echo $messages | sed 's/.*@//')
lang_kbdnames () {
all_kbdnames | \
regex_escape | \
grep "^$1[*]" | \
sed "s/^$1[*]//"
}
kbdnames=$(lang_kbdnames ${messages_lang}_${messages_country}__${messages_modif})
[ -n "$kbdnames" ] || kbdnames=$(lang_kbdnames ${messages_lang}_${messages_country}__${messages_modif})
[ -n "$kbdnames" ] || kbdnames=$(lang_kbdnames ${messages_lang}_${messages_country})
[ -n "$kbdnames" ] || kbdnames=$(lang_kbdnames ${messages_lang})
[ -n "$kbdnames" ] || kbdnames=$(lang_kbdnames C)
if [ "$is_not_debian_installer" ]; then
if \
! which iconv >/dev/null \
|| ! kbdnames="$(echo "$kbdnames" |
iconv -f UTF-8 -t $(locale charmap)//TRANSLIT)"
then
kbdnames=$(lang_kbdnames C)
fi
fi
arch=`guess_arch`
case "$arch" in
alpha*)
XKBMODEL=pc105
model_priority=medium
;;
amd64*)
XKBMODEL=pc105
model_priority=medium
;;
arm*)
XKBMODEL=pc105
model_priority=medium
;;
i386*)
XKBMODEL=pc105
model_priority=medium
;;
hppa*)
XKBMODEL=pc105
model_priority=medium
;;
ia64*)
XKBMODEL=pc105
model_priority=medium
;;
m68k/amiga)
XKBMODEL=amiga
model_priority=medium
;;
m68k/atari)
XKBMODEL=ataritt
model_priority=medium
;;
m68k/mac)
XKBMODEL=macintosh_old
model_priority=medium
;;
m68k/sun*)
XKBMODEL=pc105 # UNKNOWN: sun4, sun5 or pc105
model_priority=critical
;;
m68k/*vme*)
XKBMODEL=pc105
model_priority=medium
;;
mips*)
XKBMODEL=pc105
model_priority=medium
;;
powerpc/amiga)
XKBMODEL=amiga
model_priority=medium
;;
powerpc/apus)
XKBMODEL=amiga
model_priority=medium
;;
powerpc/chrp*)
XKBMODEL=pc105 # UNKNOWN: pc105, macintosh_old or maybe amiga
model_priority=critical
;;
powerpc/mac)
XKBMODEL=pc105
model_priority=medium
;;
powerpc/pasemi)
XKBMODEL=pc105
model_priority=medium
;;
powerpc/powermac*)
XKBMODEL=pc105
model_priority=medium
;;
powerpc/prep)
XKBMODEL=pc105
model_priority=medium
;;
powerpc/ps3|powerpc/cell)
XKBMODEL=pc105
model_priority=medium
;;
ppc64el/*)
XKBMODEL=pc105
model_priority=medium
;;
sparc*)
XKBMODEL=pc105 # sun4 or sun5 on older kernels
model_priority=medium
;;
s390*)
XKBMODEL=pc105
model_priority=medium
;;
*)
XKBMODEL=pc105 # UNKNOWN
model_priority=critical
;;
esac    
layout_priority=high
case "$langcountry" in
*_AL*)
XKBLAYOUT=al  # Albania
;;
*_AZ*)
XKBLAYOUT=az  # Azerbaijan
;;
*_BD*)
XKBLAYOUT=us,bd  # Bangladesh
;;
*_BE*)
XKBLAYOUT=be  # Belgium
;;
*_BG*)
XKBLAYOUT=us,bg  # Bulgaria
layout_priority=critical
;;
*_BR*)
XKBLAYOUT=br  # Brazil
;;
*_BT*)
XKBLAYOUT=us,bt  # Bhutan
;;
*_BY*)
XKBLAYOUT=us,by  # Belarus
;;
fr_CA*)
XKBLAYOUT=ca  # Canada
;;
*_CA*)
XKBLAYOUT=us  # U.S. English
;;
de_CH*)
XKBLAYOUT=ch  # Switzerland
;;
fr_CH*)
XKBLAYOUT=ch  # Switzerland
XKBVARIANT=fr # French
;;
*_CH*)
XKBLAYOUT=ch  # Switzerland
layout_priority=critical
;;
*_CZ*)
XKBLAYOUT=cz  # Czechia
layout_priority=critical
;;
*_DK*)
XKBLAYOUT=dk  # Denmark
;;
*_EE*)
XKBLAYOUT=ee  # Estonia
;;
ast_ES*)
XKBLAYOUT=es  # Spain
XKBVARIANT=ast # Asturian
;;
bo_*)
XKBLAYOUT=us,cn  # China
XKBVARIANT=,tib # Tibetan
;;
ca_ES*)
XKBLAYOUT=es  # Spain
XKBVARIANT=cat # Catalan
;;
*_ES*)
XKBLAYOUT=es  # Spain
;;
*_ET*)
XKBLAYOUT=us,et  # Ethiopia
;;
se_FI*)
XKBLAYOUT=fi  # Finland
XKBVARIANT=smi # Northern Saami
;;
*_FI*)
XKBLAYOUT=fi  # Finland
;;
*_FR*)
XKBLAYOUT=fr  # French
XKBVARIANT=latin9
;;
*_GB*)
XKBLAYOUT=gb  # United Kingdom
;;
*_GG*)
XKBLAYOUT=gb  # United Kingdom
;;
*_HU*)
XKBLAYOUT=hu  # Hungary
;;
*_IE*)
XKBLAYOUT=ie  # Ireland
;;
*_IL*)
XKBLAYOUT=us,il  # Israel
layout_priority=critical
;;
*_IM*)
XKBLAYOUT=gb  # United Kingdom
;;
*_IR*)
XKBLAYOUT=us,ir  # Iran
;;
*_IS*)
XKBLAYOUT=is  # Iceland
;;
*_IT*)
XKBLAYOUT=it  # Italy
;;
*_JE*)
XKBLAYOUT=gb  # United Kingdom
;;
*_JP*)
XKBLAYOUT=jp  # Japan
;;
*_LT*)
XKBLAYOUT=lt  # Lithuania
layout_priority=critical
;;
*_LV*)
XKBLAYOUT=lv  # Latvia
;;
*_KG*)
XKBLAYOUT=us,kg  # Kyrgyzstan
;;
*_KH*)
XKBLAYOUT=us,kh  # Cambodia
;;
*_KR*)
XKBLAYOUT=kr      # South Korea
XKBVARIANT=kr104  # pc104 compatible mode, safe choice
;;
*_KZ*)
XKBLAYOUT=us,kz  # Kazakhstan
;;
*_LK*)
XKBLAYOUT=us,lk  # Sri Lanka
;;
*_MA*)
XKBLAYOUT=us,ma  # Morocco
;;
*_MK*)
XKBLAYOUT=us,mk  # Macedonia
;;
*_NL*)
XKBLAYOUT=us  # Netherlands
XKBVARIANT=intl # International (with dead keys)
;;
*_MM*)
XKBLAYOUT=us,mm  # Myanmar
;;
*_MN*)
XKBLAYOUT=us,mn  # Mongolia
;;
*_MT*)
XKBLAYOUT=mt  # Malta
layout_priority=critical
;;
se_NO*)
XKBLAYOUT=no  # Norway
XKBVARIANT=smi # Northern Saami
;;
*_NO*)
XKBLAYOUT=no  # Norway (se_NO is not in this case)
;;
*_NP*)
XKBLAYOUT=us,np  # Nepal
;;
*_PH*)
XKBLAYOUT=ph  # Philipines
;;
*_PL*)
XKBLAYOUT=pl  # Poland
;;
*_PT*)
XKBLAYOUT=pt  # Portugal
;;
*_RO*)
XKBLAYOUT=ro  # Romania
;;
*_RU*)
XKBLAYOUT=us,ru  # Russia
layout_priority=critical
;;
se_SE*)
XKBLAYOUT=se  # Sweden
XKBVARIANT=smi # Northern Saami
;;
*_SK*)
XKBLAYOUT=sk  # Slovakia
;;
*_SI*)
XKBLAYOUT=si  # Slovenia
;;
tg_*)
XKBLAYOUT=us,tj  # Tajik
;;
*_TJ*)
XKBLAYOUT=us,tj  # Tajikistan
;;
*_TH*)
XKBLAYOUT=us,th  # Thailand
layout_priority=critical
;;
ku_TR*)
XKBLAYOUT=tr  # Turkish
XKBVARIANT=ku # Kurdish, Latin Q
;;
*_TR*)
XKBLAYOUT=tr  # Turkish
layout_priority=critical
;;
*_UA*)
XKBLAYOUT=us,ua  # Ukraine
;;
en_US*)
XKBLAYOUT=us  # U.S. English
;;
*_VN*)
XKBLAYOUT=us  # Vietnam
;;
*_ZA*)
XKBLAYOUT=za  # South Africa
;;
*_AR*|*_BO*|*_CL*|*_CO*|*_CR*|*_DO*|*_EC*|*_GT*|*_HN*|*_MX*|*_NI*|*_PA*|*_PE*|es_PR*|*_PY*|*_SV*|es_US*|*_UY*|*_VE*)
XKBLAYOUT=latam # Latin American
;;
ar_*)
XKBLAYOUT=us,ara # Arabic
;;
bn_*)
XKBLAYOUT=us,in  # India
XKBVARIANT=,ben # Bengali
;;
bs_*)
XKBLAYOUT=ba  # Bosnia and Herzegovina
;;
de_LI*)
XKBLAYOUT=ch  # Liechtenstein
;;
de_*)
XKBLAYOUT=de  # Germany
;;
el_*)
XKBLAYOUT=us,gr  # Greece
;;
eo|eo.*|eo_*|eo\@*)
XKBLAYOUT=epo  # Esperanto
layout_priority=critical
;;
fr_*)
XKBLAYOUT=fr  # France
XKBVARIANT=latin9
layout_priority=critical
;;
gu_*)
XKBLAYOUT=us,in  # India
XKBVARIANT=,guj # Gujarati
;;
hi_*)
XKBLAYOUT=us,in  # India
;;
hr_*)
XKBLAYOUT=hr  # Croatia
;;
hy_*)
XKBLAYOUT=us,am  # Armenia
;;
ka_*)
XKBLAYOUT=us,ge  # Georgia
layout_priority=critical
;;
kn_*)
XKBLAYOUT=us,in  # India
XKBVARIANT=,kan # Kannada
;;
ku_*)
XKBLAYOUT=tr  # Turkish
XKBVARIANT=ku # Kurdish
layout_priority=critical
;;
lo_*)
XKBLAYOUT=us,la  # Laos
;;
mr_*)
XKBLAYOUT=us,in  # India
;;
ml_*)
XKBLAYOUT=us,in  # India
XKBVARIANT=,mal # Malayalam
;;
my_*)
XKBLAYOUT=us,mm  # Burmese
;;
ne_*)
XKBLAYOUT=us,np  # Nepali
;;
os_*)
XKBLAYOUT=ru  # Russia
XKBVARIANT=os  # Ossetian
;;
pa_*)
XKBLAYOUT=us,in  # India
XKBVARIANT=,guru # Gurmukhi
;;
si_*)
XKBLAYOUT=us,si  # Sri Lanka
XKBVARIANT=,sin_phonetic # Sinhala
;;
sr_*)
XKBLAYOUT=rs,rs  # Serbia and Montenegro
XKBVARIANT=latin,
layout_priority=critical
;;
sv_*)
XKBLAYOUT=se  # Sweden
;;
ta_*)
XKBLAYOUT=us,in  # India
XKBVARIANT=,tam # Tamil
;;
te_*)
XKBLAYOUT=us,in  # India
XKBVARIANT=,tel # Telugu
;;
tg_*)
XKBLAYOUT=us,tj  # Tajikistan
;;
the_*)
XKBLAYOUT=us,np  # Nepali keymap for Tharu
;;
tl_*)
XKBLAYOUT=ph  # Philipines
;;
ug_*)
XKBLAYOUT=us,cn  # China
XKBVARIANT=,ug # Uyghur
;;
zh_*)
XKBLAYOUT=cn  # Chinese
;;
*)
XKBLAYOUT=us
;;
esac
if db_get keyboard-configuration/modelcode && [ "$RET" ]; then
XKBMODEL="$RET"
fi
if db_get keyboard-configuration/layoutcode && [ "$RET" ]; then
if [ "$RET" != "$XKBLAYOUT" ]; then
XKBVARIANT=''
fi
XKBLAYOUT="$RET"
if db_fget keyboard-configuration/layoutcode seen && [ "$RET" = true ]; then
layout_priority=medium
db_set console-setup/ask_detect false
db_fset console-setup/ask_detect seen true
fi
fi
if db_get keyboard-configuration/variantcode && [ "$RET" ]; then
XKBVARIANT="$RET"
fi
if db_get keyboard-configuration/optionscode && [ "$RET" ]; then
XKBOPTIONS="$RET"
fi
if db_get debian-installer/keymap && [ "$RET" ]; then
di_keymap="${RET##mac-usb-}"
di_keymap="${di_keymap%%-latin1}"
old_xkbvariant="$XKBVARIANT"
XKBVARIANT=''
old_layout_priority=$layout_priority
layout_priority=medium
case "$di_keymap" in
be2) XKBLAYOUT="be";;
bg) XKBLAYOUT="us,bg";;
br) XKBLAYOUT="us"; XKBVARIANT="intl";;
br-abnt2) XKBLAYOUT="br"; XKBVARIANT="abnt2";;
by) XKBLAYOUT="us,by";;
cf) XKBLAYOUT="ca"; XKBVARIANT="fr";;
croat) XKBLAYOUT="hr";;
cz-lat2) XKBLAYOUT="cz";;
de-latin1-nodeadkeys) XKBLAYOUT="de"; XKBVARIANT="nodeadkeys";;
de) XKBLAYOUT="de";;
dvorak) XKBLAYOUT="us"; XKBVARIANT="dvorak";;
dk) XKBLAYOUT="dk";;
es) XKBLAYOUT="es";;
et) XKBLAYOUT="ee";;
'fi') XKBLAYOUT="fi";;
fr-latin9) XKBLAYOUT="fr"; XKBVARIANT="latin9";;
fr_CH) XKBLAYOUT="ch"; XKBVARIANT="fr";;
fr) XKBLAYOUT="fr";;
hebrew) XKBLAYOUT="us,il";;
hu) XKBLAYOUT="hu";;
gb) XKBLAYOUT="gb";;
is) XKBLAYOUT="is";;
it) XKBLAYOUT="it";;
jp106) XKBLAYOUT="jp"; XKBVARIANT="106";;
kr|kr106) XKBLAYOUT="kr"; XKBVARIANT='';;
kr104) XKBLAYOUT="kr"; XKBVARIANT="kr104";;
la) XKBLAYOUT="latam";;
lt) XKBLAYOUT="lt";; 
lv-latin4) XKBLAYOUT="lv";;
mac-us-std) XKBLAYOUT="us";;
mac-de2-ext) XKBLAYOUT="de"; XKBVARIANT="nodeadkeys";;
mac-fr2-ext) XKBLAYOUT="fr";;
mac-fr3) XKBLAYOUT="fr";;
mac-es) XKBLAYOUT="es";;
ky) XKBLAYOUT="us,kg";;
mk) XKBLAYOUT="us,mk";;
nl) XKBLAYOUT="nl";;
no) XKBLAYOUT="no";;
pl) XKBLAYOUT="pl";;
pt) XKBLAYOUT="pt";;
ro) XKBLAYOUT="ro";;
ru) XKBLAYOUT="us,ru";;
se) XKBLAYOUT="se";;
sg) XKBLAYOUT="ch"; XKBVARIANT="de";;
sk-qwerty) XKBLAYOUT="sk"; XKBVARIANT="qwerty";;
slovene) XKBLAYOUT="si";;
sr-cy) XKBLAYOUT="rs,rs"; XKBVARIANT="latin," ;;
trf|trfu) XKBLAYOUT="tr"; XKBVARIANT="f";;
trq|trqu) XKBLAYOUT="tr";;
ua) XKBLAYOUT="us,ua";;
uk) XKBLAYOUT="gb";;
us) XKBLAYOUT="us";;
*) 
XKBVARIANT="$old_xkbvariant"
layout_priority=$old_layout_priority
;;
esac
fi
if \
[ -f /etc/X11/xorg.conf -a ! -e $CONFIGFILE ] \
&& which awk 2>/dev/null >/dev/null
then
awk_expr='
{
sub("#.*","")
line = $0;
$0 = tolower($0);
xkb = "";
}
/^[ \t]*section[ \t]+"inputdevice"/,/^[ \t]*endsection/ {
if ($1 == "option") {
if ($2 == "\"xkbmodel\"") {
xkb = "XKBMODEL";
} else if ($2 == "\"xkblayout\"") {
xkb = "XKBLAYOUT";
print "layout_priority=medium";
} else if ($2 == "\"xkbvariant\"") {
xkb = "XKBVARIANT";
} else if ($2 == "\"xkboptions\"") {
xkb = "XKBOPTIONS"; 
}
$0 = line;
$1 = "";
$2 = "";
}
}
xkb != "" && /^[ \t]*\"[^"]+\"[ \t]*$/ {
sub("^[ \t]*\"", "");
sub("\".*", "");
gsub("[ \t]", "");
if ($1 !~ /[()]/) {
print xkb "=\"" $0 "\"";
} else {
if (xkb == "XKBLAYOUT" && $1 ~ /^[^()]+\([^()]+\)$/) {
l=$1;                      # us(intl),cz(qwerty)
gsub(/\([^()]*\)/,"",l);   # us,cz
v=$1;                      # us(intl),cz(qwerty)     us,bg
gsub(/\)/,"",v);           # us(intl,cz(qwerty       us,bg
gsub(/^[^(,]*,/,",",v);    # us(intl,cz(qwerty       ,bg
gsub(/^[^(,]*$/,"",v);     # us(intl,cz(qwerty       ,bg
gsub(/^[^(,]*\(/,"",v);    # intl,cz(qwerty          ,bg
gsub(/,[^(,]*,/,",,",v);   # intl,cz(qwerty          ,bg
gsub(/,[^(,]*$/,",",v);    # intl,cz(qwerty          ,
gsub(/,[^(,]*\(/,",",v);   # intl,qwerty             ,
print "XKBLAYOUT=" l;
print "XKBVARIANT=" v;
}
}
}
'
eval $(awk "$awk_expr" < /etc/X11/xorg.conf)
fi
read_config $OLDCONFIGFILE
read_config $CONFIGFILE
XKBMODEL=$(echo $XKBMODEL | sed 's/ *//g')
XKBLAYOUT=$(echo $XKBLAYOUT | sed 's/ *//g')
XKBVARIANT=$(echo $XKBVARIANT | sed 's/ *//g')
if [ -z "$XKBMODEL" ]; then
model_priority=critical
XKBMODEL=pc105
db_fset keyboard-configuration/model seen false
fi
if [ -z "$XKBLAYOUT" ]; then
layout_priority=critical
XKBLAYOUT=us
db_fset keyboard-configuration/layout seen false
db_fset keyboard-configuration/variant seen false
fi
if ! keyboard_present; then
db_set keyboard-configuration/modelcode "$XKBMODEL"
db_set keyboard-configuration/layoutcode "$XKBLAYOUT"
db_set keyboard-configuration/variantcode "$XKBVARIANT"
if [ -z "$XKBOPTIONS" -a ! -f $CONFIGFILE ]; then
case "$XKBLAYOUT" in
*,*) XKBOPTIONS="grp_led:scroll";;
us) XKBOPTIONS="";;
*) XKBOPTIONS="lv3:ralt_switch";;
esac
fi
db_set keyboard-configuration/optionscode "$XKBOPTIONS"
exit 0
fi
debconf_model="$XKBMODEL"
if [ "$XKBLAYOUT" ]; then
migrate_layout () {
case "$1" in
cs)
echo rs
;;
*)
echo "$1"
;;
esac
}
migrate_variant () {
case "$1" in
jp)
case "$2" in
latin)
echo 106
;;
jp106)
echo kana
;;
*)
echo "$2"
;;
esac
;;
*)
echo "$2"
;;
esac
}
case "$XKBLAYOUT" in
*,*)
layout1="${XKBLAYOUT%%,*}"
layout2="${XKBLAYOUT#*,}"
variant1="${XKBVARIANT%%,*}"
variant2="${XKBVARIANT#*,}"
XKBLAYOUT="$(migrate_layout "$layout1"),$(migrate_layout "$layout2")"
XKBVARIANT="$(migrate_variant "$layout1" "$variant1"),$(migrate_variant "$layout2" "$variant2")"
;;
*)
XKBLAYOUT="$(migrate_layout "$XKBLAYOUT")"
XKBVARIANT="$(migrate_variant "$XKBLAYOUT" "$XKBVARIANT")"
;;
esac
case "$XKBLAYOUT" in
lt,lt)
debconf_layout="${XKBLAYOUT%,*}"
debconf_variant="${XKBVARIANT%,*}"
unsupported_layout=no
;;
rs,rs|us,rs|jp,jp|us,jp)
debconf_layout="${XKBLAYOUT#*,}"
debconf_variant="${XKBVARIANT#*,}"
unsupported_layout=no
;;
us,am|us,af|us,ara|us,ben|us,bd|us,bg|us,bt|us,by|us,cn|us,et|us,ge|us,gh|us,gr|us,guj|us,guru|us,il|us,in|us,ir|us,iku|us,iq|us,ir|us,kan|us,kh|us,kz|us,la|us,lao|us,lk|us,lt|us,kg|us,ma|us,mal|us,mk|us,mm|us,mn|us,mv|us,np|us,ori|us,pk|us,ru|us,scc|us,sy|us,syr|us,tel|us,th|us,tj|us,tam|us,tib|us,ua|us,ug|us,uz)
if [ "${XKBVARIANT%,*}" = '' ]; then
debconf_layout="${XKBLAYOUT#*,}"
debconf_variant="${XKBVARIANT#*,}"
unsupported_layout=no
else
unsupported_layout=yes
fi
;;	    
*,*)
unsupported_layout=yes
;;
*)
debconf_layout="$XKBLAYOUT"
debconf_variant="$XKBVARIANT"
unsupported_layout=no
;;
esac
fi
if \
! echo "$kbdnames" \
| grep "variant[*]$debconf_layout[*]$debconf_variant[*]" >/dev/null
then
unsupported_layout=yes
debconf_variant=''
if \
! echo "$kbdnames" \
| grep "layout[*]$debconf_layout[*]" >/dev/null
then
debconf_layout=us
fi
fi
debconf_toggle='No toggling'
debconf_switch='No temporary switch'
debconf_altgr='The default for the keyboard layout'
debconf_compose='No compose key'
debconf_ctrl_alt_bksp=false
if [ "$XKBOPTIONS" ]; then
debconf_toggle='No toggling'
debconf_switch='No temporary switch'
debconf_altgr='The default for the keyboard layout'
debconf_compose='No compose key'
for option in `echo $XKBOPTIONS | sed 's/,/ /g'`; do
case "$option" in
compose:caps)
debconf_compose='Caps Lock';;
compose:lwin)
debconf_compose='Left Logo key';;
compose:menu)
debconf_compose='Menu key';;
compose:ralt)
debconf_compose='Right Alt (AltGr)';;
compose:rctrl)
debconf_compose='Right Control';;
compose:rwin)
debconf_compose='Right Logo key';;
grp:alt_caps_toggle)
debconf_toggle='Alt+Caps Lock';;
grp:alt_shift_toggle)
debconf_toggle='Alt+Shift';;
grp:caps_toggle)
debconf_toggle='Caps Lock';;
grp:ctrl_alt_toggle)
debconf_toggle='Control+Alt';;
grp:ctrl_shift_toggle)
debconf_toggle='Control+Shift';;
grp:lalt_toggle)
debconf_toggle='Left Alt';;
grp:lctrl_lshift_toggle)
debconf_toggle='Left Control+Left Shift';;
grp:lctrl_toggle)
debconf_toggle='Left Control';;
grp:lshift_toggle)
debconf_toggle='Left Shift';;
grp:lswitch)
debconf_switch='Left Alt';;
grp:lwin_switch)
debconf_switch='Left Logo key';;
grp:lwin_toggle)
debconf_toggle='Left Logo key';;
grp:menu_toggle)
debconf_toggle='Menu key';;
grp:rctrl_toggle)
debconf_toggle='Right Control';;
grp:rshift_toggle)
debconf_toggle='Right Shift';;
grp:rwin_switch)
debconf_switch='Right Logo key';;
grp:rwin_toggle)
debconf_toggle='Right Logo key';;
grp:sclk_toggle)
debconf_toggle='Scroll Lock key';;
grp:switch)
debconf_switch='Right Alt (AltGr)';;
grp:toggle)
debconf_toggle='Right Alt (AltGr)';;
grp:win_switch)
debconf_switch='Both Logo keys';;
lv3:ralt_alt)
debconf_altgr='No AltGr key';;
lv3:alt_switch)
debconf_altgr='Both Alt keys';;
lv3:enter_switch)
debconf_altgr='Keypad Enter key';;
lv3:lalt_switch)
debconf_altgr='Left Alt';;
lv3:lwin_switch)
debconf_altgr='Left Logo key';;
lv3:menu_switch)
debconf_altgr='Menu key';;
lv3:ralt_switch)
debconf_altgr='Right Alt (AltGr)';;
lv3:rwin_switch)
debconf_altgr='Right Logo key';;
lv3:switch)
debconf_altgr='Right Control';;
lv3:win_switch)
debconf_altgr='Both Logo keys';;
terminate:ctrl_alt_bksp)
debconf_ctrl_alt_bksp=true;;
grp_led:scroll)
;;
*)
unsupported_options=yes
;;
esac
done
fi
db_default keyboard-configuration/toggle "$debconf_toggle"
db_default keyboard-configuration/switch "$debconf_switch"
db_default keyboard-configuration/altgr "$debconf_altgr"
db_default keyboard-configuration/compose "$debconf_compose"
db_default keyboard-configuration/ctrl_alt_bksp "$debconf_ctrl_alt_bksp"
STATE=1
old_state=0
while :; do
starting_state=$STATE
case "$STATE" in
1)
if [ "$is_debian_installer" ]; then
db_set keyboard-configuration/modelcode "$debconf_model"
db_fset keyboard-configuration/model seen true
STATE=$(( $STATE + $STATE - $old_state ))
else
if \
ask_debconf keyboard-configuration/model $model_priority \
model "$debconf_model"
then
debconf_model="$RET"
db_set keyboard-configuration/modelcode "$RET"
STATE=$(($STATE + 1))
else
STATE=$(($STATE - 1))
fi
fi
;;
2)
if \
$detect_keyboard \
&& [ "$XKBMODEL" != SKIP ] \
&& [ -e "/usr/share/console-setup-mini/$XKBMODEL.tree" ]
then
db_input high console-setup/ask_detect || true
if db_go; then
STATE=$(($STATE + 1))
else
STATE=$(($STATE - 1))
fi
else
STATE=$(($STATE + $STATE - $old_state))
fi
;;
3)
if \
[ "$STATE" -ge "$old_state" ] \
&& $detect_keyboard \
&& [ "$XKBMODEL" != SKIP ] \
&& [ -e "/usr/share/console-setup-mini/$XKBMODEL.tree" ] \
&& db_get console-setup/ask_detect \
&& [ "$RET" = true ]
then
db_subst console-setup/detect FILENAME \
"/usr/share/console-setup-mini/$XKBMODEL.tree"
if db_input critical console-setup/detect && db_go; then
db_get console-setup/detect
detected_keyboard="$RET"
db_subst console-setup/detected LAYOUT "$detected_keyboard"
db_input high console-setup/detected || true
if db_go; then
unsupported_layout=no
STATE=$(($STATE + 1))
else
detected_keyboard=
STATE=$(($STATE - 1))
fi
else
STATE=$(($STATE - 1))
fi
else
detected_keyboard=
STATE=$(($STATE + $STATE - $old_state))
fi
;;
4)
if [ "$detected_keyboard" ] || [ "$XKBMODEL" = SKIP ]; then
STATE=$(( $STATE + $STATE - $old_state ))
elif [ "$unsupported_layout" = yes ]; then
if [ -f $CONFIGFILE ]; then
template=keyboard-configuration/unsupported_config_layout
else
template=keyboard-configuration/unsupported_layout
case "$XKBVARIANT" in
,|,,|,,,|'')
db_subst $template XKBLAYOUTVARIANT "$XKBLAYOUT"
;;
*)
db_subst $template XKBLAYOUTVARIANT \
"$XKBLAYOUT/$XKBVARIANT"
;;
esac
fi
db_subst $template XKBLAYOUT "$XKBLAYOUT"
db_subst $template XKBVARIANT "$XKBVARIANT"
db_input medium $template || true
if db_go; then
STATE=$(($STATE + 1))
else
db_reset $template || true
db_fset $template seen false
STATE=$(($STATE - 1))
fi
db_get $template
if [ "$RET" != true ]; then
unsupported_layout=no
fi
else
db_reset keyboard-configuration/unsupported_config_layout || true
db_fset keyboard-configuration/unsupported_config_layout seen false
db_reset keyboard-configuration/unsupported_layout || true
db_fset keyboard-configuration/unsupported_layout seen false
STATE=$(( $STATE + $STATE - $old_state ))
fi
;;
5)
if [ "$detected_keyboard" ]; then
XKBLAYOUT="${detected_keyboard%%:*}"
debconf_layout="$XKBLAYOUT"
db_set keyboard-configuration/layoutcode "$XKBLAYOUT"
STATE=$(( $STATE + $STATE - $old_state ))
elif [ "$XKBMODEL" = SKIP ]; then
STATE=$(( $STATE + $STATE - $old_state ))
elif [ "$unsupported_layout" = yes ]; then
STATE=$(( $STATE + $STATE - $old_state ))
elif \
ask_debconf keyboard-configuration/layout "$layout_priority" \
layout "$debconf_layout"
then
debconf_layout="$RET"
STATE=$(($STATE + 1)) 
else
STATE=$(($STATE + 1))
fi
;;
6)
adjust_layout=false
if [ "$detected_keyboard" ]; then
case $detected_keyboard in
*:*)
variant="${detected_keyboard#*:}"
;;
*)
variant=
;;
esac
debconf_variant="$variant"
adjust_layout=:
STATE=$(( $STATE + $STATE - $old_state ))
elif [ "$XKBMODEL" = SKIP ]; then
STATE=$(( $STATE + $STATE - $old_state ))
elif [ "$unsupported_layout" = yes ]; then
STATE=$(( $STATE + $STATE - $old_state ))
elif \
! ask_debconf keyboard-configuration/variant \
"$layout_priority" \
"variant*${debconf_layout}" \
"$debconf_variant"
then
starting_state=$(($STATE - 1))
STATE=$(($STATE - 2))
else
debconf_variant="$RET"
variant="$RET"
adjust_layout=:
STATE=$(($STATE + 1))
fi
if $adjust_layout; then
case "$debconf_layout" in
rs)
case "$debconf_variant" in
latin*)
XKBLAYOUT=$debconf_layout
;;
*)
XKBLAYOUT=rs,rs
;;
esac
;;
jp)
case "$debconf_variant" in
106|common|OADG109A|nicola_f_bs|'')
XKBLAYOUT=$debconf_layout
;;
*)
XKBLAYOUT=jp,jp
;;
esac
;;
lt)
XKBLAYOUT=lt,lt
;;
me)
case "$debconf_variant" in
basic|latin*)
XKBLAYOUT=$debconf_layout
;;
*)
XKBLAYOUT=me,me
;;
esac
;;
af|am|ara|ben|bd|bg|bt|by|et|ge|gh|gr|guj|guru|il|'in'|iq|ir|iku|kan|kh|kz|la|lao|lk|kg|ma|mk|mm|mn|mv|mal|np|ori|pk|ru|scc|sy|syr|tel|th|tj|tam|tib|ua|ug|uz)
XKBLAYOUT=us,$debconf_layout
;;
*)
XKBLAYOUT=$debconf_layout
;;
esac
case "$XKBLAYOUT" in
rs,rs)
case "$debconf_variant" in
yz)
XKBVARIANT="latinyz,$debconf_variant" ;;
alternatequotes)
XKBVARIANT="latinalternatequotes,$debconf_variant" ;;
*)
XKBVARIANT="latin,$debconf_variant" ;;
esac
;;
lt,lt)
case "$debconf_variant" in
us)
XKBVARIANT="us," ;;
*)
XKBVARIANT="$debconf_variant,us" ;;
esac
;;
*,*)
XKBVARIANT=",$debconf_variant"
;;
*)
XKBVARIANT="$debconf_variant"
;;
esac
fi
db_set keyboard-configuration/layoutcode "$XKBLAYOUT"
db_set keyboard-configuration/variantcode "$XKBVARIANT"
;;
7)
if \
[ "$unsupported_options" = yes -a "$is_not_debian_installer" ]
then
if [ -f $CONFIGFILE ]; then
template=keyboard-configuration/unsupported_config_options
else
template=keyboard-configuration/unsupported_options
fi
db_subst $template XKBOPTIONS "$XKBOPTIONS"
db_input medium $template || true
if db_go; then
STATE=$(($STATE + 1))
else
db_reset $template || true
db_fset $template seen false
STATE=$(($STATE - 1))
fi
db_get $template
if [ "$RET" != true ]; then
unsupported_options=no
fi
else
db_reset keyboard-configuration/unsupported_config_options || true
db_fset keyboard-configuration/unsupported_config_options seen false
db_reset keyboard-configuration/unsupported_options || true
db_fset keyboard-configuration/unsupported_options seen false
STATE=$(( $STATE + $STATE - $old_state ))
fi
;;
8)
if [ "$unsupported_options" = yes ]; then
db_set keyboard-configuration/optionscode "$XKBOPTIONS"
STATE=$(( $STATE + $STATE - $old_state ))
elif [ "$XKBMODEL" = SKIP ]; then
STATE=$(( $STATE + $STATE - $old_state ))
else
caps_allocated=no
lalt_allocated=no
lctrl_allocated=no
lshift_allocated=no
lwin_allocated=no
menu_allocated=no
ralt_allocated=no
rctrl_allocated=no
rshift_allocated=no
rwin_allocated=no
case "$XKBLAYOUT" in
*,*)
;;
*)
db_set keyboard-configuration/toggle 'No toggling'
db_set keyboard-configuration/switch 'No temporary switch'
;;
esac
db_beginblock
case "$XKBLAYOUT" in
*,*)
db_input high keyboard-configuration/toggle || true
if [ "$is_not_debian_installer" ]; then
db_input medium keyboard-configuration/switch || true
fi
;;
*)
;;
esac
if [ "$is_not_debian_installer" ]; then
db_input medium keyboard-configuration/altgr || true
db_input medium keyboard-configuration/compose || true
fi
if [ -f /usr/bin/X ]; then
db_input medium keyboard-configuration/ctrl_alt_bksp || true
fi
db_endblock
if db_go; then
STATE=$(($STATE + 1))
else
STATE=$(($STATE - 1))
fi
db_get keyboard-configuration/toggle
case "$RET" in
Caps\ Lock)
caps_allocated=yes
toggle=caps_toggle;;
Right\ Alt*)
ralt_allocated=yes
toggle=toggle;;
Right\ Control)
rctrl_allocated=yes
toggle=rctrl_toggle;;
Right\ Shift)
rshift_allocated=yes
toggle=rshift_toggle;;
Right\ Logo?key)
rwin_allocated=yes
toggle=rwin_toggle;;
Menu?key)
menu_allocated=yes
toggle=menu_toggle;;
Alt+Shift)
toggle=alt_shift_toggle;;
Control+Shift)
toggle=ctrl_shift_toggle;;
Left\ Control+Left\ Shift)
toggle=lctrl_lshift_toggle;;
Scroll\ Lock\ key)
toggle=sclk_toggle;;
Alt+Caps\ Lock)
toggle=alt_caps_toggle;;
Control+Alt)
toggle=ctrl_alt_toggle;;
Left\ Alt)
lalt_allocated=yes
toggle=lalt_toggle;;
Left\ Control)
lctrl_allocated=yes
toggle=lctrl_toggle;;
Left\ Shift)
lshift_allocated=yes
toggle=lshift_toggle;;
Left\ Logo?key)
lwin_allocated=yes
toggle=lwin_toggle;;
No\ toggling)
toggle='';;
*)
echo Unknown toggle key option
exit 1
;;
esac
if [ "$toggle" ]; then
toggle=grp:$toggle
fi
db_get keyboard-configuration/switch
switch=''
case "$RET" in
Right\ Alt*)
if [ "$ralt_allocated" != yes ]; then
switch=switch
ralt_allocated=yes
fi;;
Left\ Alt)
if [ "$lalt_allocated" != yes ]; then
switch=lswitch
lalt_allocated=yes
fi;;
Right\ Logo?key)
if [ "$rwin_allocated" != yes ]; then
switch=rwin_switch
rwin_allocated=yes
fi;;
Left\ Logo?key)
if [ "$lwin_allocated" != yes ]; then
switch=lwin_switch
lwin_allocated=yes
fi;;
Both\ Logo?keys)
if \
[ "$rwin_allocated" != yes ] \
&& [ "$lwin_allocated" != yes ]
then
switch=win_switch
rwin_allocated=yes
lwin_allocated=yes
fi;;
No\ temporary\ switch)
switch='';;
*)
echo Unknown switch key option
exit 1
;;
esac
if [ "$switch" ]; then
switch=grp:$switch
fi
db_get keyboard-configuration/altgr
altgr=''
case "$RET" in
The?default?for?the?keyboard?layout)
altgr='';;
No?AltGr?key)
if [ "$ralt_allocated" != yes ]; then
altgr=ralt_alt
fi;;
Right?Alt*)
if [ "$ralt_allocated" != yes ]; then
altgr=ralt_switch
ralt_allocated=yes
fi;;
Right?Control)
if [ "$rctrl_allocated" != yes ]; then
altgr=switch
rctrl_allocated=yes
fi;;
Menu?key)
if [ "$menu_allocated" != yes ]; then
altgr=menu_switch
menu_allocated=yes
fi;;
Keypad?Enter?key)
altgr=enter_switch;;
Right?Logo?key)
if [ "$rwin_allocated" != yes ]; then
altgr=rwin_switch
rwin_allocated=yes
fi;;
Left?Logo?key)
if [ "$lwin_allocated" != yes ]; then
altgr=lwin_switch
lwin_allocated=yes
fi;;
Both?Logo?keys)
if \
[ "$rwin_allocated" != yes ] \
&& [ "$lwin_allocated" != yes ]
then
altgr=win_switch
rwin_allocated=yes
lwin_allocated=yes
fi;;
Both?Alt?keys)
if \
[ "$lalt_allocated" != yes ] \
&& [ "$ralt_allocated" != yes ]
then
altgr=alt_switch
ralt_allocated=yes
lalt_allocated=yes
fi;;
Left?Alt)
if [ "$lalt_allocated" != yes ]; then
altgr=lalt_switch
lalt_allocated=yes
fi;;
*)
echo Unknown altgr key option
exit 1
;;
esac
if [ "$altgr" ]; then
altgr=lv3:$altgr
fi
db_get keyboard-configuration/compose
compose=''
case "$RET" in
No?compose?key)
compose='';;
Right?Alt*)
if [ "$ralt_allocated" != yes ]; then
compose=ralt
ralt_allocated=yes
fi;;
Right?Logo?key)
if [ "$rwin_allocated" != yes ]; then
compose=rwin
rwin_allocated=yes
fi;;
Left?Logo?key)
if [ "$lwin_allocated" != yes ]; then
compose=lwin 
lwin_allocated=yes
fi;;
Right?Control)
if [ "$rctrl_allocated" != yes ]; then
compose=rctrl 
rctrl_allocated=yes
fi;;
Menu?key)
if [ "$menu_allocated" != yes ]; then
compose=menu
menu_allocated=yes
fi;;
Caps?Lock)
if [ "$caps_allocated" != yes ]; then
compose=caps
caps_allocated=yes
fi;;
*)
echo Unknown compose key option
exit 1
;;
esac
if [ "$compose" ]; then
compose=compose:$compose
fi
db_get keyboard-configuration/ctrl_alt_bksp
if [ "$RET" = true ]; then
terminate=terminate:ctrl_alt_bksp
else
terminate=''
fi
if [ "$ralt_allocated" = yes -a "$altgr" = lv3:ralt_alt ]; then
altgr=''
fi
case "$XKBLAYOUT" in
*,*)
leds=grp_led:scroll;;
*)
leds='';;
esac
options=$(
echo $toggle $switch $altgr $compose $terminate $leds \
| sed -e 's/^ *//' -e 's/ *$//' -e 's/  */,/g'
)
db_set keyboard-configuration/optionscode "$options"
fi
;;
*)
break
;;
esac
old_state=$starting_state
done
if [ $STATE -eq 0 ]; then
exit 10
else
db_set keyboard-configuration/store_defaults_in_debconf_db false
fi
exit 0
