[SCM] live-config branch, debian, updated. debian/3.0_b1-1

Daniel Baumann daniel at debian.org
Wed Jul 25 13:24:12 UTC 2012


The following commit has been merged in the debian branch:
commit df358a3fe86fa6a6da840664288942b1f2b71d6c
Author: Daniel Baumann <daniel at debian.org>
Date:   Thu Jul 19 02:07:07 2012 +0200

    Decrufting locales script to handle multiple locales.

diff --git a/scripts/config/0050-locales b/scripts/config/0050-locales
index 116a764..21136a9 100755
--- a/scripts/config/0050-locales
+++ b/scripts/config/0050-locales
@@ -34,76 +34,27 @@ Locales ()
 
 Configure_locales ()
 {
-	if [ -e /etc/default/locale ]
+	if echo "${LIVE_LOCALES}" | grep -qs ","
 	then
-		# use rootfs configured locale
-		_LOCALE="$(grep -s 'LANG=' /etc/default/locale | sed s/'LANG='// | tr -d '"' )"
+		# multiple locales specified
+		_LOCALE="$(echo ${LIVE_LOCALES} | sed -e 's|,.*||')"
+		_LOCALES="$(echo ${LIVE_LOCALES} | sed -e 's|.*,||' -e 's|,| |g')"
+	else
+		# one or no locale specified
+		_LOCALE="${LIVE_LOCALES:-en_US.UTF-8}"
+		_LOCALES=""
 	fi
 
-	if [ -n "${LIVE_LOCALES}" ]
-	then
-		_LOCALE="${LIVE_LOCALES}"
-		_SET_LOCALE="true"
-	fi
-
-	if [ -z "${_LOCALE}" ]
-	then
-		# Set a default one
-		_LOCALE="en_US.UTF-8"
-		_SET_LOCALE="true"
-	fi
-
-	_LANGUAGE="$(echo ${_LOCALE} | cut -d. -f1)"
-	export _LANGUAGE
-
-	if [ -z "${_SET_LOCALE}" ]
-	then
-		# Actually, we should check here if the locale is generated
-		return
-	fi
-
-	if echo "${_LOCALE}" | grep -sqE '^[[:lower:]]{2}$'
-	then
-		# input is like "locale=ch", so we will convert and setup also the keyboard if not already set
-		if [ -z "${_KEYBOARD}" ]
-		then
-			_KEYBOARD="${_LOCALE}"
-			export _KEYBOARD
-		fi
-
-		_LOCALE_UP=$(echo "${_LOCALE}" | tr '[a-z]' '[A-Z]')
-		_LOCALE="${_LOCALE}_${_LOCALE_UP}.UTF-8"
-	fi
-
-	LANG=
-	_LANGUAGE="$(echo ${_LOCALE} | cut -d. -f1)"
-	eval $(awk '/^'"${_LOCALE}"'/ { print "LANG=" $1 " codepage=" $2; exit; }' /usr/share/i18n/SUPPORTED)
-
-	if [ -z "${LANG}" ]
-	then
-		# Try and fallback to another codepage for this language.
-		eval $(awk '/^'"${_LANGUAGE}"'/ { print "LANG=" $1 " codepage=" $2; exit; }' /usr/share/i18n/SUPPORTED)
-
-		if [ -n "${LANG}" ]
-		then
-			echo "Choosing locale '${LANG}' as '${_LOCALE}' is unsupported."
-		fi
-	fi
-
-	if [ -z "${LANG}" ]
-	then
-		echo "Locale '${_LOCALE}' is unsupported."
-		_CODEPAGE="UTF-8"
-		_LANGUAGE="en_US"
-		_LOCALE="${_LANGUAGE}.${_CODEPAGE}"
-		LANG="${_LANGUAGE}.${_CODEPAGE}"
-	fi
-
-	echo "LANG=${LANG}" > /etc/default/locale
+	echo "LANG=${_LOCALE}" > /etc/default/locale
 
 	if [ -e /etc/locale.gen ]
 	then
-		sed -i -e "s|# ${LANG} ${_CODEPAGE}|${LANG} ${_CODEPAGE}|" /etc/locale.gen
+		for _LOCALE in ${_LOCALE} ${_LOCALES}
+		do
+			_CHARSET="$(echo ${_LOCALE} | awk -F. '{ print $2 }')"
+
+			sed -i -e "s|# ${_LOCALE} ${_CHARSET}|${_LOCALE} ${_CHARSET}|" /etc/locale.gen
+		done
 	fi
 
 	locale-gen --keep-existing > /dev/null 2>&1

-- 
live-config



More information about the debian-live-changes mailing list