Author: alexander
Date: 2005-12-06 22:40:21 -0700 (Tue, 06 Dec 2005)
New Revision: 1236

Added:
   trunk/packages/lfs-bootscripts/font-errors.dat
   trunk/packages/lfs-bootscripts/font.dat
   trunk/packages/lfs-bootscripts/lang.dat
Modified:
   trunk/packages/lfs-bootscripts/Makefile
   trunk/packages/lfs-bootscripts/console
Log:
Merged UTF-8 related changes to LFS bootscripts


Modified: trunk/packages/lfs-bootscripts/Makefile
===================================================================
--- trunk/packages/lfs-bootscripts/Makefile     2005-12-07 05:22:18 UTC (rev 
1235)
+++ trunk/packages/lfs-bootscripts/Makefile     2005-12-07 05:40:21 UTC (rev 
1236)
@@ -21,6 +21,7 @@
        cp $(SRC)/$(FILE) $(LFSSRC)
 
 compile-stage2:
+       sed -i s/sane/cooked/ lfs/init.d/functions
        make install-livecd
        install -m 755 lfs/init.d/mountkernfs /etc/rc.d/init.d
        ln -sf ../init.d/mountkernfs /etc/rc.d/rcsysinit.d/S00mountkernfs
@@ -32,6 +33,8 @@
        ln -sf ../init.d/clkconf /etc/rc.d/rcsysinit.d/S59clkconf
        install -m 755 ../langconf /etc/rc.d/init.d/
        ln -sf ../init.d/langconf /etc/rc.d/rcsysinit.d/S69langconf
+       mkdir -p /etc/langconf
+       install -m 644 ../*.dat /etc/langconf
        install -m 755 ../console /etc/rc.d/init.d/
        rm -f /etc/rc.d/rc0.d/S99halt
        rm -f /etc/rc.d/rc6.d/S99reboot

Modified: trunk/packages/lfs-bootscripts/console
===================================================================
--- trunk/packages/lfs-bootscripts/console      2005-12-07 05:22:18 UTC (rev 
1235)
+++ trunk/packages/lfs-bootscripts/console      2005-12-07 05:40:21 UTC (rev 
1236)
@@ -2,15 +2,14 @@
 ########################################################################
 # Begin $rc_base/init.d/console
 #
-# Description : Sets keymap and screen font (LiveCD version)
+# Description : Sets keymap and screen font
 #
 # Authors     : Gerard Beekmans - [EMAIL PROTECTED]
 #              Alexander E. Patrakov
 #
-# Version     : 00.00-livecd
+# Version     : 00.03
 #
-# Notes       : Unlike the stock "console" script, this version guesses
-#               the correct font based on the user's locale.
+# Notes       :
 #
 ########################################################################
 
@@ -18,96 +17,86 @@
 . ${rc_functions}
 
 # Native English speakers probably don't have /etc/sysconfig/console at all
-if [ -f /etc/sysconfig/console ]; then
+if [ -f /etc/sysconfig/console ]
+then
        . /etc/sysconfig/console
 fi
 
-
-guess_font() {
-        CHARMAP=`locale charmap`
-
-       FONTTABLE='
-#Charset:FONT:ERROR_FLAG:CAVEAT
-ANSI_X3.4-1968:default-8x16:0:You forgot to (correctly) set your locale!
-BIG5:default-8x16:1:Chinese is not supported by this Live CD. Sorry.
-BIG5-HKSCS:default-8x16:1:Chinese is not supported by this Live CD. Sorry.
-CP1251:cyr-sun16 -m cp1251:0:
-CP1255:LatArCyrHeb-16 -m 8859-8:0:The "kbd" package does not support CP1255 
encoding, using ISO-8859-8 instead.
-EUC-JP:default-8x16:1:Japanese is not supported by this Live CD. Sorry.
-EUC-KR:default-8x16:1:Korean is not supported by this Live CD. Sorry.
-EUC-TW:default-8x16:1:Chinese is not supported by this Live CD. Sorry.
-GB18030:default-8x16:1:Chinese is not supported by this Live CD. Sorry.
-GB2312:default-8x16:1:Chinese is not supported by this Live CD. Sorry.
-GBK:default-8x16:1:Chinese is not supported by this Live CD. Sorry.
-GEORGIAN-PS:default-8x16:1:Georgian is not supported by this Live CD. Sorry.
-ISO-8859-1:lat1-16 -m 8859-1:0:
-ISO-8859-2:lat2a-16 -m 8859-2:0:
-#ISO-8859-3:iso03.16 -m 8859-3:0:Line drawing characters are not available 
with this font.
-ISO-8859-3:LatArCyrHeb-16 -m 8859-3:0:Bright colors are not available with 
this font.
-#ISO-8859-5:iso05.16 -m 8859-5:0:Line drawing characters are not available 
with this font.
-ISO-8859-5:LatArCyrHeb-16 -m 8859-5:0:Bright colors are not available with 
this font.
-#ISO-8859-6:iso06.16 -m 8859-6:0:Line drawing characters are not available 
with this font.
-ISO-8859-6:LatArCyrHeb-16 -m 8859-6:0:Bright colors are not available with 
this font.
-ISO-8859-7:iso07u-16 -m 8859-7:0:
-ISO-8859-8:LatArCyrHeb-16 -m 8859-8:0:Bright colors are not available with 
this font.
-ISO-8859-9:cp857.16 -u /usr/share/kbd/consoletrans/cp857_to_uni.trans -m 
8859-9:0:
-#ISO-8859-10:iso10.16 -m 8859-10:0:Line drawing characters are not available 
with this font.
-ISO-8859-10:LatArCyrHeb-16 -m 8859-10:0:Bright colors are not available with 
this font.
-#ISO-8859-13:lat7-14 -m 8859-13:0:Line drawing characters are not available 
with this font.
-ISO-8859-13:LatArCyrHeb-16 -m 8859-13:0:Bright colors are not available with 
this font.
-ISO-8859-14:default-8x16:1:Welsh is not supported by this Live CD. Sorry.
-ISO-8859-15:lat0-16 -m 8859-15:0:
-#KOI8-R:koi8r-8x16 -u koi8r -m koi8-r:0:This font is ugly.
-KOI8-R:cyr-sun16 -m koi8-r:0:
-KOI8-T:cyr-sun16 -m koi8-r:0:The "kbd" package does not support KOI8-T 
encoding, using KOI8-R instead.
-KOI8-U:cyr-sun16 -m koi8-u:0:
-PT154:cyr-sun16 -m cp1251:0:The "kbd" package does not support PT154 encoding, 
using CP1251 instead.
-TCVN5712-1:default-8x16:1:Vietnamese is not supported by this Live CD. Sorry.
-TIS-620:default-8x16:1:Thai is not supported by this Live CD. Sorry.
-UTF-8:LatArCyrHeb-16:0:\033%GThis Live CD does not officially support UTF-8.
-'
-
-       FONTLINE=`echo "$FONTTABLE" | egrep "^$CHARMAP:"`
-       FONT=`echo "$FONTLINE" | cut -d ":" -f 2`
-       ERROR=`echo "$FONTLINE" | cut -d ":" -f 3`
-       FONT_PROBLEM=`echo "$FONTLINE" | cut -d ":" -f 4`
-
-       return $ERROR
+is_true() {
+       [ "$1" = "1" ] || [ "$1" = "yes" ] || [ "$1" = "true" ]
 }
 
+failed=0
+trap failed=1 ERR
+
 case "${1}" in
        start)
-               if [ -n "${KEYMAP}" ]; then
-                       boot_mesg "Loading keymap: ${KEYMAP}..."
-                       loadkeys ${KEYMAP} &>/dev/null
-                       evaluate_retval
-               fi
+               boot_mesg "Setting up Linux console..."
+               # There should be no bogus failures below this line!
+               
+               # Figure out if a framebuffer console is used
+               [ -d /sys/class/graphics/fb0 ] && USE_FB=1 || USE_FB=0
+               
+               # Figure out the command to set the console into the
+               # desired mode
+               is_true "${UNICODE}" &&
+                       MODE_COMMAND="echo -en '\033%G' && kbd_mode -u" ||
+                       MODE_COMMAND="echo -en '[EMAIL PROTECTED](K' && 
kbd_mode -a"
+               
+               # On framebuffer consoles, font has to be set for each vt in
+               # UTF-8 mode. This doesn't hurt in non-UTF-8 mode also.
+               
+               ! is_true "${USE_FB}" || [ -z "${FONT}" ] ||
+                       MODE_COMMAND="${MODE_COMMAND} && setfont ${FONT}"
 
-               if [ -n "${KEYMAP_CORRECTIONS}" ]; then
-                       boot_mesg "Loading keymap corrections: 
${KEYMAP_CORRECTIONS}..."
+               # Apply that command to all consoles mentioned in
+               # /etc/inittab. Important: in the UTF-8 mode this should
+               # happen before setfont, otherwise a kernel bug will
+               # show up and the unicode map of the font will not be
+               # used.
+               # FIXME: Fedora Core also initializes two spare consoles
+               # - do we want that?
+               
+               # for TTY in `grep '^[^#].*respawn:/sbin/agetty' /etc/inittab |
+               #       grep -o '\btty[[:digit:]]*\b'`
+               #
+               # XXX Livecd doesn't use agetty, so the statement above
+               # doesn't work
+               for TTY in 1 2 3 4 5 6
+               do
+                       openvt -f -w -c ${TTY#tty} -- \
+                               /bin/sh -c "${MODE_COMMAND}"
+               done
+
+               # Set the font (if not already set above) and the keymap
+               is_true "${USE_FB}" ||  [ -z "${FONT}" ] || setfont $FONT
+               [ -z "${KEYMAP}" ] || loadkeys ${KEYMAP} &>/dev/null
+               [ -z "${KEYMAP_CORRECTIONS}" ] ||
                        loadkeys ${KEYMAP_CORRECTIONS} &>/dev/null
-                       evaluate_retval
-               fi
 
-               if [ -n "${FONT}" ]; then
-                       boot_mesg "Setting screen font to ${FONT}..."
-                       setfont $FONT &>/dev/null
-                       evaluate_retval
-               else
-                       guess_font
-                       boot_mesg "Setting screen font to ${FONT}..."
-                       boot_mesg_flush
-                       setfont $FONT &>/dev/null
-                       if [ ! -z "$FONT_PROBLEM" ] ; then
-                               boot_mesg "WARNING:\n${FONT_PROBLEM}" ${WARNING}
-                               boot_mesg_flush
-                       fi
-                       ( exit $ERROR )
-                       evaluate_retval
-               fi
+               # Linux kernel generates wrong bytes when composing
+               # in Unicode mode. That's why we disable dead keys in Unicode
+               # mode by default. If you need them, download and apply
+               # 
http://www.linuxfromscratch.org/~alexander/patches/linux-2.6.12.5-utf8_input-2.patch
+               # After patching, add "-m charset_of_your_keymap" to the FONT
+               # variable and set BROKEN_COMPOSE=false
+               # in /etc/sysconfig/console
+
+               [ -n "$BROKEN_COMPOSE" ] || BROKEN_COMPOSE="$UNICODE"
+               ! is_true "$BROKEN_COMPOSE" ||
+                       echo "" | loadkeys -c &>/dev/null
+               
+               # Convert the keymap from $LEGACY_CHARSET to UTF-8
+               [ -z "$LEGACY_CHARSET" ] ||
+                       dumpkeys -c "$LEGACY_CHARSET" | loadkeys -u &>/dev/null
+
+               # If any of the commands above failed, the trap at the
+               # top would set $failed to 1
+               ( exit $failed )
+               evaluate_retval
                ;;
        *)
-               echo "Usage: ${0} {start}"
+               echo $"Usage:" "${0} {start}"
                exit 1
                ;;
 esac

Added: trunk/packages/lfs-bootscripts/font-errors.dat
===================================================================
--- trunk/packages/lfs-bootscripts/font-errors.dat      2005-12-07 05:22:18 UTC 
(rev 1235)
+++ trunk/packages/lfs-bootscripts/font-errors.dat      2005-12-07 05:40:21 UTC 
(rev 1236)
@@ -0,0 +1,4 @@
+All non-ASCII characters will be treated as non-printable\nuntil you set 
locale to something other than "C".
+Some characters are missing from the console font.\nType "startx" to start the 
X session after login.
+Your language is supported in X window system only.\nType "startx" to start 
the X session after login.
+Your language is completely unsupported on this CD.\nIt is a bug, but we don't 
know how to fix it.\nPlease mail instructions to [email protected]

Added: trunk/packages/lfs-bootscripts/font.dat
===================================================================
--- trunk/packages/lfs-bootscripts/font.dat     2005-12-07 05:22:18 UTC (rev 
1235)
+++ trunk/packages/lfs-bootscripts/font.dat     2005-12-07 05:40:21 UTC (rev 
1236)
@@ -0,0 +1,33 @@
+# Charset      FONT                            ERRORCODE (from font-errors.dat)
+ANSI_X3.4-1968 default8x16                     1
+BIG5           default8x16                     3
+BIG5-HKSCS     default8x16                     3
+CP1251         cyr-sun16 -m cp1251             0
+CP1255         LatArCyrHeb-16 -m 8859-8        2
+EUC-JP         default8x16                     3
+EUC-KR         default8x16                     3
+EUC-TW         default8x16                     3
+GB18030                default8x16                     3
+GB2312         default8x16                     3
+GBK            default8x16                     3
+GEORGIAN-PS    default8x16                     4
+ISO-8859-1     lat1-16 -m 8859-1               0
+ISO-8859-2     lat2a-16 -m 8859-2              0
+ISO-8859-3     LatArCyrHeb-16 -m 8859-3        0
+ISO-8859-5     cyr-sun16 -m 8859-5             0
+ISO-8859-6     LatArCyrHeb-16 -m 8859-6        0
+ISO-8859-7     iso07u-16 -m 8859-7             0
+ISO-8859-8     LatArCyrHeb-16 -m 8859-8        0
+ISO-8859-9     cp857.16 -u cp857 -m 8859-9     0
+ISO-8859-10    LatArCyrHeb-16 -m 8859-10       0
+ISO-8859-13    LatArCyrHeb-16 -m 8859-13       0
+ISO-8859-14    default8x16                     3
+ISO-8859-15    lat0-16 -m 8859-15              0
+KOI8-R         cyr-sun16 -m koi8-r             0
+KOI8-T         cyr-sun16 -m koi8-r             2
+KOI8-U         cyr-sun16 -m koi8-u             0
+PT154          cyr-sun16 -m cp1251             2
+# FIXME: "tis-ptsmall.f16 -m tis620" may be more readable
+TIS-620                tis-phaisarn.f16 -m tis620      0
+# This catches all essentially-UTF-8 scripts like Indic ones.
+UTF-8          LatArCyrHeb-16                  4

Added: trunk/packages/lfs-bootscripts/lang.dat
===================================================================
--- trunk/packages/lfs-bootscripts/lang.dat     2005-12-07 05:22:18 UTC (rev 
1235)
+++ trunk/packages/lfs-bootscripts/lang.dat     2005-12-07 05:40:21 UTC (rev 
1236)
@@ -0,0 +1,74 @@
+# DESCRIPTION                          LANG            KEYMAP          
LEGACY_CHARSET  XKEYMAP
+Default/Other                          C               ""              ""      
        "en_US"
+English,_USA_(ISO-8859-1)              en_US           ""              ""      
        "en_US"
+English,_USA_(UTF-8)                   en_US.UTF-8     ""              
"iso-8859-1"    "en_US"
+English,_GB_(ISO-8859-1)               en_GB           "gb"            ""      
        "uk"
+English,_GB_(UTF-8)                    en_GB.UTF-8     "gb"            
"iso-8859-1"    "uk"
+English,_Australia_(ISO-8859-1)                en_AU           ""              
""              "en_US"
+English,_Australia_(UTF-8)             en_AU.UTF-8     ""              
"iso-8859-1"    "en_US"
+
+Belarusian_(CP1251)                    be_BY           "by2_win"       ""      
        "en_US,by(winkeys)"
+Belarusian_(UTF-8)                     be_BY.UTF-8     "by"            
"iso-8859-5"    "en_US,by(winkeys)"
+Brazilian,_ABNT2_keymap_(ISO-8859-1)   pt_BR           "br-abnt2"      ""      
        "br-abnt2"
+Brazilian,_ABNT2_keymap_(UTF-8)                pt_BR.UTF-8     "br-abnt2"      
"iso-8859-1"    "br-abnt2"
+Bulgarian_(CP1251)                     bg_BG           "bg_bds-cp1251" ""      
        "en_US,bds_enhanced"
+Bulgarian_(UTF-8)                      bg_BG.UTF-8     "bg_bds-utf8"   ""      
        "en_US,bds_enhanced"
+Chinese_(Traditional,_BIG5)            zh_TW           ""              ""      
        "en_US"
+Chinese_(Traditional,_EUC-TW)          zh_TW.EUC-TW    ""              ""      
        "en_US"
+Chinese_(Traditional,_UTF-8)           zh_TW.UTF-8     ""              ""      
        "en_US"
+Chinese_(Simplified,_GB2312)           zh_CN           ""              ""      
        "en_US"
+Chinese_(Simplified,_GB18030)          zh_CN.GB18030   ""              ""      
        "en_US"
+Chinese_(Simplified,_GBK)              zh_CN.GBK       ""              ""      
        "en_US"
+Chinese_(Simplified,_UTF-8)            zh_CN.UTF-8     ""              ""      
        "en_US"
+Czech_(ISO-8859-2)                     cs_CZ           "cz"            ""      
        "cz"
+Czech_(UTF-8)                          cs_CZ.UTF-8     "cz"            
"iso-8859-2"    "cz"
+Danish_(ISO-8859-1)                    da_DK           "dk-latin1"     ""      
        "dk"
+Danish_(UTF-8)                         da_DK.UTF-8     "dk-latin1"     
"iso-8859-1"    "dk"
+Finnish_(ISO-8859-1)                   fi_FI           "fi-latin1"     ""      
        "fi"
+Finnish_(ISO-8859-15)                  [EMAIL PROTECTED]       "fi-latin9"     
""              "fi"
+Finnish_(UTF-8)                                fi_FI.UTF-8     "fi-latin9"     
"iso-8859-15"   "fi"
+French_(ISO-8859-1)                    fr_FR           "fr-latin1"     ""      
        "fr"
+French_(ISO-8859-15)                   [EMAIL PROTECTED]       "fr-latin9"     
""              "fr"
+French_(UTF-8)                         fr_FR.UTF-8     "fr-latin9"     
"iso-8859-15"   "fr"
+French_(Canada,_ISO-8859-1)            fr_CA           "cf"            ""      
        "ca_enhanced"
+French_(Canada,_UTF-8)                 fr_CA.UTF-8     "cf"            
"iso-8859-1"    "ca_enhanced"
+German_(ISO-8859-1)                    de_DE           "de-latin1"     ""      
        "de"
+German_(ISO-8859-15)                   [EMAIL PROTECTED]       
"de-latin1+euro2" ""            "de"
+German_(UTF-8)                         de_DE.UTF-8     "de-latin1+euro2" 
"iso-8859-15" "de"
+Greek_(ISO-8859-7)                     el_GR           "gr"            ""      
        "en_US,el"
+Greek_(UTF-8)                          el_GR.UTF-8     "gr"            
"iso-8859-7"    "en_US,el"
+Hungarian_(ISO-8859-2)                 hu_HU           "hu101"         ""      
        "hu"
+Hungarian_(UTF-8)                      hu_HU.UTF-8     "hu101"         
"iso-8859-2"    "hu"
+Icelandic_(ISO-8859-1)                 is_IS           "is-latin1"     ""      
        "is"
+Icelandic_(UTF-8)                      is_IS.UTF-8     "is-latin1"     
"iso-8859-1"    "is"
+Japanese_(EUC-JP)                      ja_JP           ""              ""      
        "en_US"
+Japanese_(UTF-8)                       ja_JP.UTF-8     ""              ""      
        "en_US"
+Korean_(EUC-KR)                                ko_KR           ""              
""              "en_US"
+Korean_(UTF-8)                         ko_KR.UTF-8     ""              ""      
        "en_US"
+Norwegian,_Bokmal_(ISO-8859-1)         nb_NO           "no-latin1"     ""      
        "no"
+Norwegian,_Bokmal_(UTF-8)              nb_NO.UTF-8     "no-latin1"     
"iso-8859-1"    "no"
+Norwegian,_Nynorsk_(ISO-8859-1)                nn_NO           "no-latin1"     
""              "no"
+Norwegian,_Nynorsk_(UTF-8)             nn_NO.UTF-8     "no-latin1"     
"iso-8859-1"    "no"
+Polish_(ISO-8859-2)                    pl_PL           "pl"            ""      
        "pl2"
+Polish_(UTF-8)                         pl_PL.UTF-8     "pl"            
"iso-8859-2"    "pl2
+Portuguese_(ISO-8859-1)                        pt_PT           "pt-latin1"     
""              "pt"
+Portuguese_(ISO-8859-15)               [EMAIL PROTECTED]       "pt-latin9"     
""              "pt"
+Portuguese_(UTF-8)                     pt_PT.UTF-8     "pt-latin9"     
"iso-8859-15"   "pt"
+Russian_(CP1251)                       ru_RU.CP1251    "ru_win"        ""      
        "en_US,ru(winkeys)"
+Russian_(KOI8-R)                       ru_RU.KOI8-R    "ru-ms"         ""      
        "en_US,ru(winkeys)"
+Russian_(UTF-8)                                ru_RU.UTF-8     "ru-ms"         
"koi8-r"        "en_US,ru(winkeys)"
+Slovak,_QWERTZ_keyboard_(ISO-8859-2)   sk_SK           "sk-qwertz"     ""      
        "sk"
+Slovak,_QWERTZ_keyboard_(UTF-8)                sk_SK.UTF-8     "sk-qwertz"     
"iso-8859-2"    "sk"
+Slovak,_QWERTY_keyboard_(ISO-8859-2)   sk_SK           "sk-qwerty"     ""      
        "sk_qwerty"
+Slovak,_QWERTY_keyboard_(UTF-8)                sk_SK.UTF-8     "sk-qwerty"     
"iso-8859-2"    "sk_qwerty"
+Spanish_(ISO-8859-1)                   es_ES           "es"            ""      
        "es"
+Spanish_(ISO-8859-15)                  [EMAIL PROTECTED]       "es+euro2"      
""              "es"
+Spanish_(UTF-8)                                es_ES.UTF-8     "es+euro2"      
"iso-8859-15"   "es"
+Spanish,_Mexico_(ISO-8859-1)           es_MX           "la-latin1"     ""      
        "la"
+Spanish,_Mexico_(UTF-8)                        es_MX.UTF-8     "la-latin1"     
"iso-8859-1"    "la"
+Swedish_(ISO-8859-1)                   sv_SE           "sv-latin1"     ""      
        "se"
+Swedish_(UTF-8)                                sv_SE.UTF-8     "sv-latin1"     
"iso-8859-1"    "se"
+Thai_(TIS-620)                         th_TH           "th-win-latin1" ""      
        "en_US,th"
+Thai_(UTF-8)                           th_TH.UTF-8     "th-win-uni"    ""      
        "en_US,th"
+Ukrainian_(KOI8-U)                     uk_UA           "ua-ws"         ""      
        "en_US,ua(winkeys)"
+Ukrainian_(UTF-8)                      uk_UA.UTF-8     "ua-utf-ws"     ""      
        "en_US,ua(winkeys)"

-- 
http://linuxfromscratch.org/mailman/listinfo/livecd
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page

Reply via email to