Merging casper 1.130.
authorDaniel Baumann <daniel@debian.org>
Wed, 16 Apr 2008 07:02:46 +0000 (09:02 +0200)
committerDaniel Baumann <daniel@debian.org>
Wed, 9 Mar 2011 16:47:59 +0000 (17:47 +0100)
debian/control
docs/ChangeLog.casper
scripts/live
scripts/live-functions

index 3836a66..6ff07ed 100644 (file)
@@ -12,7 +12,7 @@ XS-Upstream-Depends: git-core
 
 Package: live-initramfs
 Architecture: all
-Depends: ${misc:Depends}, busybox, file, initramfs-tools, sudo, udev, user-setup
+Depends: ${misc:Depends}, busybox, file, initramfs-tools, localechooser-data, sudo, udev, user-setup
 Recommends: eject, uuid-runtime, wget
 Suggests: genext2fs (>= 1.4.1), squashfs-tools, mtd-tools
 Description: Debian Live initramfs hook
index 34e0bd0..6bc93d9 100644 (file)
@@ -1,3 +1,10 @@
+casper (1.130) hardy; urgency=low
+
+  * Handle use of debian-installer/language for locale selection
+    (LP: #213930).
+
+ -- Colin Watson <cjwatson@ubuntu.com>  Sat, 12 Apr 2008 00:30:10 +0100
+
 casper (1.129) hardy; urgency=low
 
   * Add COPYING file with GPL text (LP: #211923).
index 46dcb74..240691a 100755 (executable)
@@ -154,6 +154,12 @@ Arguments ()
                                export LIVE_MEDIA_TIMEOUT
                                ;;
 
+                       language=*|debian-installer/language=*)
+                               language=${x#debian-installer/language=}
+                               locale="$(lang2locale "$language")"
+                               set_locale="true"
+                               ;;
+
                        locale=*|debian-installer/locale=*)
                                LOCALE="${ARGUMENT#*=}"
                                export LOCALE
index 964fdf0..b6d04fb 100644 (file)
@@ -29,3 +29,32 @@ really_export ()
 
        eval export "${STRING}"="${VALUE}"
 }
+
+lang2locale() {
+       langpart="${1%%_*}"
+       if [ "$1" != "C" ]; then
+               # Match the language code with 3rd field in languagelist
+               line=$(grep -v "^#" /root/usr/share/localechooser/languagelist | cut -f3,4,5 -d\; | grep -v ';C$' | grep "^$langpart;")
+               if [ -n "$line" ]; then
+                       if [ "$(echo "$line" | grep -c '')" -gt 1 ]; then
+                               # More than one match; try matching the
+                               # country as well.
+                               countrypart="${1#*_}"
+                               if [ "$countrypart" = "$1" ]; then
+                                       countryline="$(echo "$line" | head -n1)"
+                                       echo "${countryline##*;}"
+                                       return
+                               fi
+                               countrypart="${countrypart%%[@.]*}"
+                               countryline="$(echo "$line" | grep ";$countrypart;" | head -n1 || true)"
+                               if [ "$countryline" ]; then
+                                       echo "${countryline##*;}"
+                                       return
+                               fi
+                       fi
+                       echo "${line##*;}"
+               fi
+       else
+               echo "C"
+       fi
+}