2 # Filename: /etc/grml/fai/config/scripts/GRMLBASE/25-locales
3 # Purpose: locales (language) configuration of the live system
4 # Authors: grml-team (grml.org), (c) Michael Prokop <mika@grml.org>
5 # Bug-Reports: see http://grml.org/bugs/
6 # License: This file is licensed under the GPL v2 or any later version.
7 ################################################################################
11 if [ -z "$ROOTCMD" ] ; then
12 echo "variable \$ROOTCMD not set, exiting to avoid any possible damage">&2
16 # use full locales setup only in classes GRML_FULL and LOCALES
17 if ifclass GRML_FULL || ifclass LOCALES ; then
18 echo 'Using /etc/locale.gen.grml for locales generation'
19 cp $target/etc/locale.gen.grml $target/etc/locale.gen
21 echo 'Using /etc/locale.gen.minimal for locales generation'
22 cp $target/etc/locale.gen.minimal $target/etc/locale.gen
25 # get rid of locales unless using class LOCALES
27 # * this should be improved in the long run, ideas welcome :)
28 # * what about /usr/share/i18n/locales?
29 if ! ifclass LOCALES ; then
30 echo 'Removing /usr/share/locale'
32 # get rid of the original
33 $ROOTCMD rm -rf /usr/share/locale
35 # restore *empty* directories because otherwise installation/upgrade of packages might fail
36 [ -d "$target"/usr/share/locale ] || mkdir "$target"/usr/share/locale
37 $ROOTCMD ln -s /etc/locale.alias /usr/share/locale/locale.alias
39 # make sure the directories of removed locales exist; ugly hack but no other solution present :(
40 echo 'Creating empty /usr/share/locale/*/LC_MESSAGES directories'
41 for f in $($ROOTCMD dpkg -S LC_MESSAGES | awk '{print $2}' | grep '/usr/share/locale/' | sed 's#LC_MESSAGES.*##' | sort -u) ; do
42 if ! [ -d "$target/$f"/LC_MESSAGES ] ; then
43 $ROOTCMD mkdir -p "$f"/LC_MESSAGES
49 # localepurge localepurge/nopurge multiselect ....
50 # is set so localepurge works as expected
51 if [ -x $target/usr/sbin/localepurge ] ; then
52 $ROOTCMD dpkg-reconfigure -f noninteractive localepurge
55 if [ -x $target/usr/sbin/locale-gen ] ; then
58 echo 'Warning: locale-gen [package locales] not available'
61 if [ -x $target/usr/sbin/localepurge ] ; then
65 ## END OF FILE #################################################################
66 # vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=3