Alexander E. Patrakov wrote:
Hello,

the attached patch to the livecd buildscripts simplifies the process of console configuration by guessing the screen font based on the user's locale.

Forgot to attach the patch. Sorry.

--
Alexander E. Patrakov

Index: isolinux/options.msg
===================================================================
--- isolinux/options.msg        (revision 174)
+++ isolinux/options.msg        (working copy)
@@ -16,3 +16,6 @@
 Also, add UTC=1 if the hardware clock in your computer
 is set to GMT instead of local time.
 
+Set your locale by adding LANG=your_locale anywhere after
+"linux". To see the list of presumably working locales,
+press F2.
Index: isolinux/isolinux.cfg
===================================================================
--- isolinux/isolinux.cfg       (revision 174)
+++ isolinux/isolinux.cfg       (working copy)
@@ -4,6 +4,8 @@
 timeout 600
 display boot.msg
 F1 options.msg
+F2 locales1.msg
+F3 locales2.msg
 
 label linux
   kernel linux
Index: isolinux/locales1.msg
===================================================================
--- isolinux/locales1.msg       (revision 0)
+++ isolinux/locales1.msg       (revision 0)
@@ -0,0 +1,24 @@
+aa_DJ.ISO-8859-1         en_AU.ISO-8859-1         [EMAIL PROTECTED]
+af_ZA.ISO-8859-1         en_BW.ISO-8859-1         es_GT.ISO-8859-1
+an_ES.ISO-8859-15        en_CA.ISO-8859-1         es_HN.ISO-8859-1
+be_BY.CP1251             en_DK.ISO-8859-1         es_MX.ISO-8859-1
+bg_BG.CP1251             en_GB.ISO-8859-1         es_NI.ISO-8859-1
+br_FR.ISO-8859-1         en_HK.ISO-8859-1         es_PA.ISO-8859-1
[EMAIL PROTECTED]   en_IE.ISO-8859-1         es_PE.ISO-8859-1
+bs_BA.ISO-8859-2         [EMAIL PROTECTED]   es_PR.ISO-8859-1
+ca_ES.ISO-8859-1         en_NZ.ISO-8859-1         es_PY.ISO-8859-1
[EMAIL PROTECTED]   en_PH.ISO-8859-1         es_SV.ISO-8859-1
+cs_CZ.ISO-8859-2         en_SG.ISO-8859-1         es_US.ISO-8859-1
+da_DK.ISO-8859-1         en_US.ISO-8859-1         es_UY.ISO-8859-1
+de_AT.ISO-8859-1         en_ZA.ISO-8859-1         es_VE.ISO-8859-1
[EMAIL PROTECTED]   en_ZW.ISO-8859-1         et_EE.ISO-8859-1
+de_BE.ISO-8859-1         es_AR.ISO-8859-1         et_EE.ISO-8859-15
[EMAIL PROTECTED]   es_BO.ISO-8859-1         eu_ES.ISO-8859-1
+de_CH.ISO-8859-1         es_CL.ISO-8859-1         [EMAIL PROTECTED]
+de_DE.ISO-8859-1         es_CO.ISO-8859-1         fi_FI.ISO-8859-1
[EMAIL PROTECTED]   es_CR.ISO-8859-1         [EMAIL PROTECTED]
+de_LU.ISO-8859-1         es_DO.ISO-8859-1         fo_FO.ISO-8859-1
[EMAIL PROTECTED]   es_EC.ISO-8859-1         fr_BE.ISO-8859-1
+el_GR.ISO-8859-7         es_ES.ISO-8859-1         [EMAIL PROTECTED]
+
+[ F3 ] = more locales    [ F1 ] = other options
Index: isolinux/locales2.msg
===================================================================
--- isolinux/locales2.msg       (revision 0)
+++ isolinux/locales2.msg       (revision 0)
@@ -0,0 +1,24 @@
+fr_CA.ISO-8859-1         lt_LT.ISO-8859-13        sk_SK.ISO-8859-2
+fr_CH.ISO-8859-1         lv_LV.ISO-8859-13        sl_SI.ISO-8859-2
+fr_FR.ISO-8859-1         mi_NZ.ISO-8859-13        so_DJ.ISO-8859-1
[EMAIL PROTECTED]   mk_MK.ISO-8859-5         so_KE.ISO-8859-1
+fr_LU.ISO-8859-1         ms_MY.ISO-8859-1         so_SO.ISO-8859-1
[EMAIL PROTECTED]   mt_MT.ISO-8859-3         sq_AL.ISO-8859-1
+ga_IE.ISO-8859-1         nb_NO.ISO-8859-1         st_ZA.ISO-8859-1
[EMAIL PROTECTED]   nl_BE.ISO-8859-1         sv_FI.ISO-8859-1
+gd_GB.ISO-8859-15        [EMAIL PROTECTED]   [EMAIL PROTECTED]
+gl_ES.ISO-8859-1         nl_NL.ISO-8859-1         sv_SE.ISO-8859-1
[EMAIL PROTECTED]   [EMAIL PROTECTED]   tg_TJ.KOI8-T
+gv_GB.ISO-8859-1         nn_NO.ISO-8859-1         tl_PH.ISO-8859-1
+hr_HR.ISO-8859-2         oc_FR.ISO-8859-1         uk_UA.KOI8-U
+hu_HU.ISO-8859-2         om_KE.ISO-8859-1         uz_UZ.ISO-8859-1
+id_ID.ISO-8859-1         pl_PL.ISO-8859-2         wa_BE.ISO-8859-1
+is_IS.ISO-8859-1         pt_BR.ISO-8859-1         [EMAIL PROTECTED]
+it_CH.ISO-8859-1         pt_PT.ISO-8859-1         xh_ZA.ISO-8859-1
+it_IT.ISO-8859-1         [EMAIL PROTECTED]   zu_ZA.ISO-8859-1
[EMAIL PROTECTED]   ro_RO.ISO-8859-2         
+kl_GL.ISO-8859-1         ru_RU.ISO-8859-5         
+kw_GB.ISO-8859-1         ru_RU.KOI8-R             
+lg_UG.ISO-8859-10        ru_UA.KOI8-U             
+
+[ F2 ] = more locales    [ F1 ] = other options
Index: etc/sysconfig/console
===================================================================
--- etc/sysconfig/console       (revision 174)
+++ etc/sysconfig/console       (working copy)
@@ -1 +0,0 @@
-FONT=default8x16
Index: packages/lfs-bootscripts/console
===================================================================
--- packages/lfs-bootscripts/console    (revision 0)
+++ packages/lfs-bootscripts/console    (revision 0)
@@ -0,0 +1,116 @@
+#!/bin/sh
+########################################################################
+# Begin $rc_base/init.d/console
+#
+# Description : Sets keymap and screen font (LiveCD version)
+#
+# Authors     : Gerard Beekmans - [EMAIL PROTECTED]
+#              Alexander E. Patrakov
+#
+# Version     : 00.00-livecd
+#
+# Notes       : Unlike the stock "console" script, this version guesses
+#               the correct font based on the user's locale.
+#
+########################################################################
+
+. /etc/sysconfig/rc
+. ${rc_functions}
+
+# Native English speakers probably don't have /etc/sysconfig/console at all
+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::0:You forgot to (correctly) set your locale!
+BIG5::1:Chinese is not supported by this Live CD. Sorry.
+BIG5-HKSCS::1:Chinese is not supported by this Live CD. Sorry.
+CP1251:ruscii_8x16 -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::1:Japanese is not supported by this Live CD. Sorry.
+EUC-KR::1:Korean is not supported by this Live CD. Sorry.
+EUC-TW::1:Chinese is not supported by this Live CD. Sorry.
+GB18030::1:Chinese is not supported by this Live CD. Sorry.
+GB2312::1:Chinese is not supported by this Live CD. Sorry.
+GBK::1:Chinese is not supported by this Live CD. Sorry.
+GEORGIAN-PS::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::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:ruscii_8x16 -m koi8-r:0:
+KOI8-T:ruscii_8x16 -m koi8-r:0:The "kbd" package does not support KOI8-T 
encoding, using KOI8-R instead.
+KOI8-U:ruscii_8x16 -m koi8-u:0:
+PT154:ruscii_8x16 -m cp1251:0:The "kbd" package does not support PT154 
encoding, using CP1251 instead.
+TCVN5712-1::1:Vietnamese is not supported by this Live CD. Sorry.
+TIS-620::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
+}
+
+case "${1}" in
+       start)
+               if [ -n "${KEYMAP}" ]; then
+                       boot_mesg "Loading keymap: ${KEYMAP}..."
+                       loadkeys ${KEYMAP} &>/dev/null
+                       evaluate_retval
+               fi
+
+               if [ -n "${KEYMAP_CORRECTIONS}" ]; then
+                       boot_mesg "Loading keymap corrections: 
${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
+                       FONT="${FONT-default8x16}"
+                       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
+               ;;
+       *)
+               echo "Usage: ${0} {start}"
+               exit 1
+               ;;
+esac
+
+# End $rc_base/init.d/console
Index: packages/lfs-bootscripts/Makefile
===================================================================
--- packages/lfs-bootscripts/Makefile   (revision 174)
+++ packages/lfs-bootscripts/Makefile   (working copy)
@@ -29,6 +29,7 @@
         ln -sf ../init.d/udev /etc/rc.d/rcsysinit.d/S10udev && \
         install -m 755 ../mountfs /etc/rc.d/init.d/ && \
         ln -sf ../init.d/mountfs /etc/rc.d/rcsysinit.d/S40mountfs && \
+        install -m 755 ../console /etc/rc.d/init.d/ && \
         rm -f /etc/rc.d/*/*mountsqfs /etc/rc.d/*/*startup ; fi
 
 clean:
Index: packages/syslinux/Makefile
===================================================================
--- packages/syslinux/Makefile  (revision 174)
+++ packages/syslinux/Makefile  (working copy)
@@ -21,7 +21,7 @@
        @if [ ! -f $(FILE) ] ; then $(WGET) $(URL) ; fi
        @if [ ! -f /boot/isolinux/isolinux.bin ] ; then tar xzvf $(FILE) && cd 
$(DIR) && \
         cp isolinux.bin /boot/isolinux ; fi
-       @cp $(ROOT)/isolinux/{isolinux.cfg,boot.msg,options.msg,splash.lss} 
/boot/isolinux
+       @cp $(ROOT)/isolinux/{isolinux.cfg,*.msg,splash.lss} /boot/isolinux
        @make clean
 
 clean:
-- 
http://linuxfromscratch.org/mailman/listinfo/livecd
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page

Reply via email to