5 # initramfs-tools header
21 # live-initramfs header
23 if [ -n "${NOLOCALES}" ]
28 . /scripts/live-functions
30 log_begin_msg "Setting up locales..."
32 # live-initramfs script
34 if [ -e /root/etc/default/locale ]
36 grep_file=/root/etc/default/locale
37 elif [ -e /root/etc/environment ]
40 grep_file=/root/etc/environment
43 if [ -n "${grep_file}" ]
45 # use rootfs configured locale
46 locale=$(grep -s 'LANG=' ${grep_file} | sed s/'LANG='// | tr -d '"' )
48 grep_file=/root/etc/default/locale
64 if [ "${set_locale}" ]
66 if echo "${locale}" | grep -sqE '^[[:lower:]]{2}$'
68 # input is like "locale=it", so we will convert and setup also the keyboard if not already set
71 # FIXME: look if this keyb is supported
76 uploc=$(echo "${locale}" | tr '[a-z]' '[A-Z]')
77 locale="${locale}_${uploc}.UTF-8"
80 LANG=$(grep "^${locale}" /root/usr/share/i18n/SUPPORTED | grep UTF-8 | sed -e 's, .*,,' -e q)
84 log_warning_message "Locale ${locale} is unsupported."
91 if [ "${BUILD_SYSTEM}" = "Ubuntu" ]
93 printf 'LANG="%s"\n' "${LANG}" > "${grep_file}"
94 chroot /root /usr/sbin/locale-gen "${LANG}"
95 live-preseed /root debian-installer/locale "${locale}"
97 printf 'LANG=%s\n' "${LANG}" > "${grep_file}"
98 printf '%s UTF-8\n' "${LANG}" > /root/etc/locale.gen
99 chroot /root /usr/sbin/locale-gen