I've been using OSBuilder to spin up some custom images, I'm just
wondering if my XO-1.5 is a little strange or if I uncovered a bug.
When olpc-configure is run at first boot and reads the $MFG_DATA in /ofw
the LO tag that is returned has "en_US.UTF8" in it which will never
match: 

if ! locale -a | grep -qx "${SYS_LANG/UTF-8/utf8}"; then 
            echo "olpc-configure: Locale $SYS_LANG is not supported;"
            SYS_LANG="en_US.UTF-8"  # better fallback than "C"
            echo "olpc-configure: Falling back to locale $SYS_LANG"
        fi

Then the default language becomes en_US.UTF-8... So my question becomes 
do I have a funny tag in ofw or is this a bug? If this is a bug, would 
it not be better to source /etc/sysconfig/i18n for a LANG= variable before 
defaulting to the above? Is there some sugar specific reason for the above?
Just want to know what others think. I've patched olpc-configure to work 
around the issue, but the LANG=C in OSBuilder's base routine should go away 
as it's not being used anyway.
 
Jerry
--- olpc-configure.orig	2010-08-14 23:52:46.000000000 +0000
+++ olpc-configure	2010-08-15 02:02:26.000000000 +0000
@@ -144,7 +144,7 @@
 	# Some defaults
 	XKB_MODEL="olpc"
 	XKB_LAYOUT="us"
-	SYS_LANG="en_US.UTF-8"
+	SYS_LANG_SET=`cat /etc/sysconfig/i18n | grep LANG= | awk -F= '{ print $2 }' `
 
 	XORG_CONF=xorg-emu.conf
 
@@ -198,11 +198,21 @@
 			fi
 		fi
 	fi
-	if ! locale -a | grep -qx "${SYS_LANG/UTF-8/utf8}"; then
-	    echo "olpc-configure: Locale $SYS_LANG is not supported;"
+
+	if ! locale -a | grep $SYS_LANG; then
+	    echo "olpc-configure: Locale $SYS_LANG from MFG Tag is not supported;"
 	    SYS_LANG="en_US.UTF-8"  # better fallback than "C"
 	    echo "olpc-configure: Falling back to locale $SYS_LANG"
+	else
+	    echo "olpc-configure: Setting locale to $SYS_LANG from MFG Tag"
 	fi
+
+	if [ -n "$SYS_LANG_SET" ]; then
+	    SUGAR_LANG=$SYS_LANG_SET
+	    echo "olpc-configure: Setting locale to $SUGAR_LANG from sysconfig"
+        else
+	    SUGAR_LANG=$SYS_LANG
+        fi
 }
 
 rebuild_library_index() {
@@ -239,7 +249,7 @@
 
 	rm -f $OLPC_HOME/.i18n
 	cat >$OLPC_HOME/.i18n <<__EOF__
-LANG="$SYS_LANG"
+LANG=$SUGAR_LANG
 __EOF__
 	chown olpc:olpc $OLPC_HOME/.i18n
 
_______________________________________________
Devel mailing list
Devel@lists.laptop.org
http://lists.laptop.org/listinfo/devel

Reply via email to