r414 - in x86/branches/utf8: . packages/Xorg packages/dialog packages/lfs-bootscripts

alexander at linuxfromscratch.org alexander at linuxfromscratch.org
Wed Jul 27 07:32:37 PDT 2005


Author: alexander
Date: 2005-07-27 08:32:29 -0600 (Wed, 27 Jul 2005)
New Revision: 414

Added:
   x86/branches/utf8/packages/lfs-bootscripts/font.dat
   x86/branches/utf8/packages/lfs-bootscripts/lang.dat
Modified:
   x86/branches/utf8/BUGS
   x86/branches/utf8/Makefile
   x86/branches/utf8/packages/Xorg/Makefile
   x86/branches/utf8/packages/dialog/Makefile
   x86/branches/utf8/packages/lfs-bootscripts/Makefile
   x86/branches/utf8/packages/lfs-bootscripts/console
   x86/branches/utf8/packages/lfs-bootscripts/langconf
Log:
Reworked language configurator (untested).
Built packages before links (or w3m?)


Modified: x86/branches/utf8/BUGS
===================================================================
--- x86/branches/utf8/BUGS	2005-07-27 04:30:19 UTC (rev 413)
+++ x86/branches/utf8/BUGS	2005-07-27 14:32:29 UTC (rev 414)
@@ -25,6 +25,9 @@
   length is incorrect and manual pages containing hyphens and other characters
   rendered by Groff as multibte ones are wrapped incorrectly.
 
+procps:
+  "watch" still doesn't display non-ASCII characters in UTF-8 locales.
+
 slang:
   slang 2.x supports UTF-8, but most slang-based apps either don't support
   UTF-8 or expect patched slang-1.4.9 instead of 2.x. Package removed.
@@ -49,3 +52,16 @@
 lynx:
   truncates text in the header and the status line prematurely (uses byte count
   instead of properly calculated string width).
+
+lfs-bootscripts:
+  language selector is untested.
+
+Xorg:
+  The locale-names patch is not well-tested, and the configurator installed
+  with the bootscripts uses locale names that works even without the patch.
+
+links:
+  This program handles input in UTF-8 locales properly only if started in
+  the graphical mode on the X display. Package will be replaced with w3m.
+  Will resurrect on request if someone writes a wrapper script that warns the
+  user about non-working configuration.

Modified: x86/branches/utf8/Makefile
===================================================================
--- x86/branches/utf8/Makefile	2005-07-27 04:30:19 UTC (rev 413)
+++ x86/branches/utf8/Makefile	2005-07-27 14:32:29 UTC (rev 414)
@@ -179,12 +179,12 @@
 	ch-sysklogd ch-sysvinit ch-tar ch-udev ch-util-linux ch-environment
 
 blfs: ch-openssl ch-wget ch-reiserfsprogs ch-xfsprogs ch-nano ch-joe ch-screen ch-curl ch-zip \
-	ch-unzip ch-lynx ch-libxml2 ch-expat ch-subversion stop-here ch-lfs-bootscripts ch-docbook-xml ch-libxslt \
+	ch-unzip ch-lynx ch-libxml2 ch-expat ch-subversion ch-dialog ch-lfs-bootscripts ch-docbook-xml ch-libxslt \
 	ch-docbook-xsl ch-html_tidy ch-LFS-BOOK ch-libpng ch-freetype ch-fontconfig ch-Xorg ch-freefont ch-inputattach \
-	ch-fonts-dejavu ch-update-fontsdir ch-libjpeg ch-libtiff ch-links ch-openssh ch-pkgconfig ch-glib2 \
+	ch-fonts-dejavu ch-update-fontsdir ch-libjpeg ch-libtiff stop-here ch-links ch-openssh ch-pkgconfig ch-glib2 \
 	ch-libungif ch-imlib2 ch-pango ch-atk ch-gtk2 ch-cvs ch-popt ch-samba ch-libIDL ch-firefox ch-thunderbird \
 	ch-startup-notification ch-gvim ch-xfce ch-lua ch-ion ch-irssi ch-xchat ch-tcpwrappers ch-portmap \
-	ch-nfs-utils ch-traceroute ch-dialog ch-ncftp ch-pciutils ch-nALFS ch-device-mapper ch-LVM2 ch-dhcpcd \
+	ch-nfs-utils ch-traceroute ch-ncftp ch-pciutils ch-nALFS ch-device-mapper ch-LVM2 ch-dhcpcd \
 	ch-distcc ch-ppp ch-rp-pppoe ch-libaal ch-reiser4progs ch-squashfs ch-cpio ch-mutt ch-msmtp ch-slrn \
 	ch-raidtools ch-eject ch-linux ch-klibc ch-unionfs ch-initramfs ch-cdrtools ch-blfs-bootscripts ch-syslinux
 

Modified: x86/branches/utf8/packages/Xorg/Makefile
===================================================================
--- x86/branches/utf8/packages/Xorg/Makefile	2005-07-27 04:30:19 UTC (rev 413)
+++ x86/branches/utf8/packages/Xorg/Makefile	2005-07-27 14:32:29 UTC (rev 414)
@@ -6,11 +6,12 @@
 DIR= xc
 FILE= X11R$(VRS)-src.tar.bz2
 PATCH= xorg-6.8.1-luit_race-1.patch
+PATCH2= xorg-6.8.2-locale_names-1.patch
 URL= http://xorg.freedesktop.org/X11R$(VRS)/src-single/$(FILE)
 URL1= http://www.linuxfromscratch.org/patches/downloads/xorg/$(PATCH)
+URL2= http://www.linuxfromscratch.org/~alexander/$(PATCH2)
 
 
-
 #RULES
 
 .PHONY: clean chroot stage2
@@ -24,8 +25,10 @@
 	@echo ""
 	@if [ ! -f $(FILE) ] ; then $(WGET) $(URL) ; fi
 	@if [ ! -f $(PATCH) ] ; then $(WGET) $(URL1) ; fi
+	@if [ ! -f $(PATCH2) ] ; then $(WGET) $(URL2) ; fi
 	@if [ ! -d /usr/include/X11 ] ; then unpack $(FILE) && cd $(DIR) && \
 	 patch -Np1 -i ../$(PATCH) && \
+	 patch -Np1 -i ../$(PATCH2) && \
 	 sed -i '/^SUBDIRS =/s/s etc$$//' programs/Xserver/Xprint/Imakefile && \
 	 pushd config/util && \
 	 make -f Makefile.ini lndir && \
@@ -40,7 +43,7 @@
 	 ln -sf ../X11R6/lib/X11 /usr/lib/X11 && \
 	 ln -sf ../X11R6/include/X11 /usr/include/X11 && \
 	 /sbin/ldconfig ; fi
-	@echo "/tmp/.ICE-unix dir 1777 root root" >> /etc/sysconfig/createfiles
+#	@echo "/tmp/.ICE-unix dir 1777 root root" >> /etc/sysconfig/createfiles
 	@echo -e "#!/bin/sh\nexec /usr/X11R6/bin/X -nolisten tcp" >/etc/X11/xinit/xserverrc
 	@chmod 755 /etc/X11/xinit/xserverrc
 	@install -m644 $(ROOT)/etc/X11/xorg.conf /etc/X11/xorg.conf

Modified: x86/branches/utf8/packages/dialog/Makefile
===================================================================
--- x86/branches/utf8/packages/dialog/Makefile	2005-07-27 04:30:19 UTC (rev 413)
+++ x86/branches/utf8/packages/dialog/Makefile	2005-07-27 14:32:29 UTC (rev 414)
@@ -20,7 +20,8 @@
 	@echo ""
 	@if [ ! -f $(FILE) ] ; then $(WGET) $(URL) ; fi
 	@if [ ! -f /usr/bin/dialog ] ; then unpack $(FILE) && cd $(DIR) && \
-	 ./configure --prefix=/usr --enable-nls && make && make install ; fi
+	 ./configure --prefix=/usr --enable-nls --enable-widec --with-ncursesw && \
+	 make && make install ; fi
 	@make clean
 
 clean:

Modified: x86/branches/utf8/packages/lfs-bootscripts/Makefile
===================================================================
--- x86/branches/utf8/packages/lfs-bootscripts/Makefile	2005-07-27 04:30:19 UTC (rev 413)
+++ x86/branches/utf8/packages/lfs-bootscripts/Makefile	2005-07-27 14:32:29 UTC (rev 414)
@@ -22,7 +22,9 @@
 	@if [ ! -f $(SRC)/$(FILE) ] ; then $(WGET) $(URL) && \
 	 mv $(FILE) $(SRC) ; fi
 	@if [ ! -f /etc/rc.d/init.d/functions ] ; then unpack ${SRC}/${FILE} && \
-	 cd ${DIR} && make install-livecd && \
+	 cd ${DIR} && \
+	 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/S00mountkernks && \
 	 install -m 755 ../udev /etc/rc.d/init.d/ && \
@@ -33,10 +35,13 @@
 	 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 ../font.dat /etc/langconf && \
+	 install -m 644 ../lang.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 && \
 	 rm -f /etc/rc.d/*/*mountsqfs /etc/rc.d/*/*startup ; fi
 
 clean:
-	@-rm -rf bootscripts
+	@-rm -rf $(DIR)

Modified: x86/branches/utf8/packages/lfs-bootscripts/console
===================================================================
--- x86/branches/utf8/packages/lfs-bootscripts/console	2005-07-27 04:30:19 UTC (rev 413)
+++ x86/branches/utf8/packages/lfs-bootscripts/console	2005-07-27 14:32:29 UTC (rev 414)
@@ -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 - gerard at linuxfromscratch.org
 #		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,88 @@
 . ${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 '\033%@\033(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
+		# http://chris.heathens.co.nz/linux/downloads/patches-2.6.4-cdh1.tar.gz
+		# Unpack and patch the kernel with p1_conv_8bit_to_uni.patch
+		# Other patches in that tarball give rejects.
+		# 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: x86/branches/utf8/packages/lfs-bootscripts/font.dat
===================================================================
--- x86/branches/utf8/packages/lfs-bootscripts/font.dat	2005-07-27 04:30:19 UTC (rev 413)
+++ x86/branches/utf8/packages/lfs-bootscripts/font.dat	2005-07-27 14:32:29 UTC (rev 414)
@@ -0,0 +1,31 @@
+# Charset	FONT				ERROR?	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	LatArCyrHeb-16 -m 8859-3	0	Bright colors 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	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	LatArCyrHeb-16 -m 8859-10	0	Bright colors 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		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.
+TIS-620		default-8x16			1	Thai is not supported by this Live CD. Sorry.
+UTF-8		LatArCyrHeb-16			0

Added: x86/branches/utf8/packages/lfs-bootscripts/lang.dat
===================================================================
--- x86/branches/utf8/packages/lfs-bootscripts/lang.dat	2005-07-27 04:30:19 UTC (rev 413)
+++ x86/branches/utf8/packages/lfs-bootscripts/lang.dat	2005-07-27 14:32:29 UTC (rev 414)
@@ -0,0 +1,61 @@
+# DESCRIPTION				LANG		KEYMAP		FONT	LEGACY_CHARSET	XKEYMAP
+Default/Other				C		""		""	""		"us"
+English,_USA_(ISO-8859-1)		en_US		""		""	""		"us"
+English,_USA_(UTF-8)			en_US.UTF-8	""		""	"iso-8859-1"	"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		""		""	""		"us"
+English,_Australia_(UTF-8)		en_AU.UTF-8	""		""	"iso-8859-1"	"us"
+
+Belarusian_(CP1251)			be_BY		"by2_win"	""	""		"us,by(winkeys)"
+Belarusian_(UTF-8)			be_BY.UTF-8	"by"		""	"iso-8859-5"	"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"	""	""		"us,bds_enhanced"
+Bulgarian_(UTF-8)			bg_BG.UTF-8	"bg_bds-utf8"	""	""		"us,bds_enhanced"
+French,_Canada_(ISO-8859-1)		fr_CA		"cf"		""	""		"ca_enhanced"
+French,_Canada_(UTF-8)			fr_CA.UTF-8	"cf"		""	"iso-8859-1"	"ca_enhanced"
+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)			fi_FI at euro	"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)			fr_FR at euro	"fr-latin9"	""	""		"fr"
+French_(UTF-8)				fr_FR.UTF-8	"fr-latin9"	""	"iso-8859-15"	"fr"
+German_(ISO-8859-1)			de_DE		"de-latin1"	""	""		"de"
+German_(ISO-8859-15)			de_DE at euro	"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"		""	""		"us,el"
+Greek_(UTF-8)				el_GR.UTF-8	"gr"		"iso07u-16" "iso-8859-7" "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"
+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)		pt_PT at euro	"pt-latin9"	""	""		"pt"
+Portuguese_(UTF-8)			pt_PT.UTF-8	"pt-latin9"	""	"iso-8859-15"	"pt"
+Russian_(CP1251)			ru_RU.CP1251	"ru_win"	""	""		"us,ru(winkeys)"
+Russian_(KOI8-R)			ru_RU.KOI8-R	"ru_ms"		""	""		"us,ru(winkeys)"
+Russian_(UTF-8)				ru_RU.UTF-8	"ru_ms"		""	"koi8-r"	"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)			es_ES at euro	"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"
+Ukrainian_(KOI8-U)			uk_UA		"ua-ws"		""	""		"us,ua(winkeys)"
+Ukrainian_(UTF-8)			uk_UA.UTF-8	"ua-utf-ws"	""	""		"us,ua(winkeys)"

Modified: x86/branches/utf8/packages/lfs-bootscripts/langconf
===================================================================
--- x86/branches/utf8/packages/lfs-bootscripts/langconf	2005-07-27 04:30:19 UTC (rev 413)
+++ x86/branches/utf8/packages/lfs-bootscripts/langconf	2005-07-27 14:32:29 UTC (rev 414)
@@ -1,53 +1,166 @@
 #!/bin/sh
+########################################################################
+# Begin $rc_base/init.d/langconf
+#
+# Description : Language and Keymap Configuration Script for the Live CD
+#
+# Authors     : Alexander E. Patrakov
+#
+# Version     : 00.00
+#
+# Notes       :
+#
+########################################################################
 
-# Get a well-defined sort order
-LC_ALL=C
-export LC_ALL
+SELECTED=
 
-if [ ! -z "$LANG" ] ; then
-	# Assume that the locale is already configured, and the
-	# keymap is satisfactory
-	exit 0
-fi
+DATABASE=/etc/langconf/lang.dat
+FONTDB=/etc/langconf/font.dat
 
-LOCALES=`cat /boot/isolinux/locales*.msg | grep _ | \
-    sed 's, ,\n,g' | grep -v '^$' | sort`
+same_locale() {
+	for term in language territory charmap
+	do
+		[ "`LC_ALL=$1 locale $term`" = "`LC_ALL=$2 locale $term`" ] || return 1
+	done
+	return 0
+}
 
-ARGS="C Default "
-for L in $LOCALES ; do
-	ARGS="$ARGS $L \"`LC_ALL=$L locale language`\" "
-done
+guess_selection() {
+	while read F_DESCRIPTION F_LANG F_KEYMAP F_FONT F_LEGACYCHARSET F_XKEYMAP
+	do
+		if [ -z "$F_DESCRIPTION" ] || [ "$F_DESCRIPTION" = "#" ]
+		then
+			continue
+		fi
+		F_KEYMAP="${F_KEYMAP//\"/}"
+		F_FONT="${F_FONT//\"/}"
+		F_LEGACYCHARSET="${F_LEGACYCHARSET//\"/}"
+		F_XKEYMAP="${F_XKEYMAP//\"/}"
+		same_locale "$F_LANG" "$LANG" && SELECTED="$F_DESCRIPTION" && return 0
+	done <$DATABASE
+	exit 1
+}
 
-DLG_COMMAND="dialog --title \"Locale configuration\" --default-item C \
-    --timeout 20 --menu \"Select your locale from the list below\" 0 0 0 \
-    $ARGS"
+get_selection_dlg() {
+	ARGS=""
+	while read F_DESCRIPTION F_LANG F_KEYMAP F_FONT F_LEGACYCHARSET F_XKEYMAP
+	do
+		if [ -z "$F_DESCRIPTION" ] || [ "$F_DESCRIPTION" = "#" ]
+		then
+			continue
+		fi
+		DESCRIPTION=`echo $F_DESCRIPTION | tr _ ' '`
+		ARGS="$ARGS \"$DESCRIPTION\" \"\""
+	done <$DATABASE
+	DLG_COMMAND="dialog --title \"Regional settings\" --timeout 20 \
+	--default-item \"Default/Other\" \
+	--menu \"Choose your locale and keymap\" -1 0 0 $ARGS"
+	SELECTED=`eval $DLG_COMMAND 3>&2 2>&1 1>&3`
 
-LANG_SELECTED=`eval $DLG_COMMAND 3>&2 2>&1 1>&3`
+	if [ $? -ne 0 ] ; then
+		exit 0
+	fi
+}
 
-if [ $? -ne 0 ] ; then
-	exit 0
-fi
+guess_font() {
+	F_CHARMAP=`LC_ALL=$F_LANG locale charmap`
+	while IFS="	" read CHARMAP FONT ERROR CAVEAT
+	do
+		if [ "$F_CHARMAP" = "$CHARMAP" ]
+		then
+			F_FONT="$FONT"
+			if [ "$ERROR" = "1" ]
+			then
+				echo ERROR:
+			fi
+			if [ -n "$CAVEAT" ]
+			then
+				echo $CAVEAT
+			fi
+		fi
+	done <$FONTDB
+}
 
-echo "LANG=$LANG_SELECTED" >>/etc/environment
-echo "LANG=$LANG_SELECTED ; export LANG" >>/etc/sysconfig/rc
-echo "LANG=$LANG_SELECTED ; export LANG" >>/etc/profile
+confirm() {
+	# TODO: simplify life for Dvorak users. They have to edit
+	# this using (awkward) qwerty keymap!
+	
+	DLG_COMMAND="dialog --title \"Confirm/edit settings\" \
+	--no-cancel \
+	--form \"Please review and, if necessary, edit the settings below.
+\n\nKeymap autoconversion is used only together with UTF-8 locales.
+If you don't need to convert your keymap to UTF-8 (e.g. because it
+is already in UTF-8, or because you don't want UTF-8), don't fill in
+that field.\" 0 0 5 \
+	\"Locale:\" 1 1 \"$F_LANG\" 1 30 40 0 \
+	\"Console keymap:\" 2 1 \"$F_KEYMAP\" 2 30 40 0 \
+	\"  autoconverted from charset:\" 3 1 \"$F_LEGACYCHARSET\" 3 30 40 0 \
+	\"Console font:\" 4 1 \"$F_FONT\" 4 30 40 0 \
+	\"X keymap:\" 5 1 \"$F_XKEYMAP\" 5 30 40 0"
+	SELECTION=`eval $DLG_COMMAND 3>&2 2>&1 1>&3`
+	STATUS=$?
+	[ "$STATUS" != 0 ] && exit 1
+	eval "`echo "$SELECTION" | \
+		sed -e '1s,^,F_LANG=",' \
+		-e '2s,^,F_KEYMAP=",' \
+		-e '3s,^,F_LEGACYCHARSET=",' \
+		-e '4s,^,F_FONT=",' \
+		-e '5s,^,F_XKEYMAP=",' | sed -e 's,$,",'`"
+	return 0
+}
 
-KEYMAPS=`cat /boot/isolinux/keymaps.msg | grep -v ':' | grep -v '\[' | sort`
-ARGS="Default \"\" "
-for K in $KEYMAPS ; do
-	ARGS="$ARGS $K \"\" "
-done
-DLG_COMMAND="dialog --title \"Keyboard configuration\" --default-item Default \
-    --menu \"Select your keyboard layout from the list below\" 0 0 0 \
-    $ARGS"
-KEYMAP_SELECTED=`eval $DLG_COMMAND 3>&2 2>&1 1>&3`
+interactive_config() {
+	get_selection_dlg
+	F_SELECTED=`echo $SELECTED | tr ' ' _`
+	LINE=`grep "^$F_SELECTED" $DATABASE | sed 's,[[:space:]]\+,\n,g'`
+	eval "`echo "$LINE" | sed -e 's,+, ,g' -e 's,",,g' | \
+		sed -e '1d' \
+		-e '2s,^,F_LANG=",' \
+		-e '3s,^,F_KEYMAP=",' \
+		-e '4s,^,F_FONT=",' \
+		-e '5s,^,F_LEGACYCHARSET=",' \
+		-e '6s,^,F_XKEYMAP=",' | sed -e 's,$,",'`"
+	[ -z "$F_KEYMAP" ] && F_KEYMAP=defkeymap
+	[ -z "$F_FONT" ] && guess_font
+	[ -z "$F_XKEYMAP" ] && F_XKEYMAP=us
+	confirm
+}
 
-if [ $? -ne 0 ] ; then
-	exit 0
+noninteractive_config() {
+	guess_selection
+	F_LANG="$LANG"
+	# Accept overrides to our guesses if given on the command line
+	[ -z "$F_KEYMAP" ] && F_KEYMAP=defkeymap
+	[ -z "$F_FONT" ] && guess_font
+	[ -z "$F_XKEYMAP" ] && F_XKEYMAP=us
+	[ -n "$KEYMAP" ] && F_KEYMAP=${KEYMAP//+/ }
+	[ -n "$FONT" ] && F_FONT=${FONT//+/ }
+	[ -n "$LEGACY_CHARSET" ] && F_LEGACYCHARSET=$LEGACY_CHARSET
+	[ -n "$XKEYMAP" ] && F_XKEYMAP=$XKEYMAP
+}
+
+# Assume that noninteractive configuration is wanted if LANG is set
+if [ -n "$LANG" ]
+then
+	noninteractive_config
+else
+	interactive_config
 fi
 
-if [ "$KEYMAP_SELECTED" = "Default" ] ; then
-	exit 0
+# Write the settings out to configuration files
+echo "LANG=\"$F_LANG\" ; export LANG" >>/etc/profile
+
+echo "KEYMAP=\"$F_KEYMAP\"" >/etc/sysconfig/console
+echo "FONT=\"$F_FONT\"" >>/etc/sysconfig/console
+
+if [ "`LC_ALL="$F_LANG" locale charmap`" = "UTF-8" ]
+then
+	echo "UNICODE=1" >>/etc/sysconfig/console
+	echo "BROKEN_COMPOSE=0" >>/etc/sysconfig/console
+	if [ -n "$F_LEGACYCHARSET" ]
+	then
+		echo "LEGACY_CHARSET=\"$F_LEGACYCHARSET\"" >>/etc/sysconfig/console
+	fi
 fi
 
-echo "KEYMAP=$KEYMAP_SELECTED" >>/etc/sysconfig/console
+sed -i "s,\"us\",\"$F_XKEYMAP\"," /etc/X11/xorg.conf




More information about the livecd mailing list