home *** CD-ROM | disk | FTP | other *** search
/ PC Welt 2006 November (DVD) / PCWELT_11_2006.ISO / casper / filesystem.squashfs / usr / share / initramfs-tools / scripts / casper-bottom / 14locales < prev    next >
Encoding:
Text File  |  2006-08-23  |  1.0 KB  |  57 lines

  1. #! /bin/sh
  2.  
  3. PREREQ=""
  4. DESCRIPTION="Setting up locales..."
  5.  
  6. . /scripts/functions
  7.  
  8. prereqs()
  9. {
  10.        echo "$PREREQ"
  11. }
  12.  
  13. case $1 in
  14. # get pre-requisites
  15. prereqs)
  16.        prereqs
  17.        exit 0
  18.        ;;
  19. esac
  20.  
  21. log_begin_msg "$DESCRIPTION"
  22.  
  23. if [ -e /root/etc/default/locale ]; then
  24.     grep_file=/root/etc/default/locale
  25.     locale=$(grep 'LANG=' ${grep_file} | sed s/'LANG='// | tr -d '"' ) 
  26. elif [ -e /root/etc/environment ]; then # Old locales policy
  27.     grep_file=/root/etc/environment
  28. fi
  29.  
  30. # commandline
  31. for x in $(cat /proc/cmdline); do
  32.     case $x in
  33.         debian-installer/locale=*)
  34.             locale=${x#debian-installer/locale=}
  35.             set_locale="true"
  36.             ;;
  37.         locale=*)
  38.             locale=${x#locale=}
  39.             set_locale="true"
  40.             ;;
  41.     esac
  42. done
  43.  
  44. if [ -z "${locale}" ]; then
  45.     # Set a default one
  46.     locale=en_US.UTF-8
  47.     set_locale="true"
  48. fi
  49.  
  50. if [ "${set_locale}" ]; then
  51.     LANG=$(grep "^${locale}" /root/usr/share/i18n/SUPPORTED | grep UTF-8 |sed -e 's, .*,,' -e q)
  52.     printf 'LANG="%s"\n' "${LANG}" >> "${grep_file}" 
  53.     chroot /root /usr/sbin/locale-gen "${LANG}"
  54. fi
  55.  
  56. log_end_msg
  57.