X-Git-Url: http://git.grml.org/?p=grml-live.git;a=blobdiff_plain;f=etc%2Fgrml%2Ffai%2Fconfig%2Fscripts%2FGRMLBASE%2F25-locales;h=ccc402874500e2e8d3fad0c00690ae2418b58820;hp=c093e2804b7573ac0e86671263115b8c41270be6;hb=4b2e8632eba4fa2343986f897cfcd59ed1413d66;hpb=18b724911750d346e7d13ac5d29e4b0d321c9283 diff --git a/etc/grml/fai/config/scripts/GRMLBASE/25-locales b/etc/grml/fai/config/scripts/GRMLBASE/25-locales index c093e28..ccc4028 100755 --- a/etc/grml/fai/config/scripts/GRMLBASE/25-locales +++ b/etc/grml/fai/config/scripts/GRMLBASE/25-locales @@ -1,18 +1,66 @@ -#!/bin/sh -# Filename: /etc/grml/fai/config/scripts/GRML/25-locales +#!/bin/bash +# Filename: /etc/grml/fai/config/scripts/GRMLBASE/25-locales # Purpose: locales (language) configuration of the live system # Authors: grml-team (grml.org), (c) Michael Prokop # Bug-Reports: see http://grml.org/bugs/ # License: This file is licensed under the GPL v2 or any later version. -# Latest change: Tue Sep 18 19:46:58 CEST 2007 [mika] ################################################################################ -set -u set -e -# FIXME: replace it with /etc/locale.gen.grml finally! -cp $target/etc/locale.gen.minimal $target/etc/locale.gen -$ROOTCMD locale-gen +if [ -z "$ROOTCMD" ] ; then + echo "variable \$ROOTCMD not set, exiting to avoid any possible damage">&2 + exit 1 +fi + +# use full locales setup only in classes GRML_FULL and LOCALES +if ifclass GRML_FULL || ifclass LOCALES ; then + echo 'Using /etc/locale.gen.grml for locales generation' + cp $target/etc/locale.gen.grml $target/etc/locale.gen +else + echo 'Using /etc/locale.gen.minimal for locales generation' + cp $target/etc/locale.gen.minimal $target/etc/locale.gen +fi + +# get rid of locales unless using class LOCALES +# TODO +# * this should be improved in the long run, ideas welcome :) +# * what about /usr/share/i18n/locales? +if ! ifclass LOCALES ; then + echo 'Removing /usr/share/locale' + + # get rid of the original + $ROOTCMD rm -rf /usr/share/locale + + # restore *empty* directories because otherwise installation/upgrade of packages might fail + [ -d "$target"/usr/share/locale ] || mkdir "$target"/usr/share/locale + $ROOTCMD ln -s /etc/locale.alias /usr/share/locale/locale.alias + + # make sure the directories of removed locales exist; ugly hack but no other solution present :( + echo 'Creating empty /usr/share/locale/*/LC_MESSAGES directories' + for f in $($ROOTCMD dpkg -S LC_MESSAGES | awk '{print $2}' | grep '/usr/share/locale/' | sed 's#LC_MESSAGES.*##' | sort -u) ; do + if ! [ -d "$target/$f"/LC_MESSAGES ] ; then + $ROOTCMD mkdir -p "$f"/LC_MESSAGES + fi + done +fi + +# make sure: +# localepurge localepurge/nopurge multiselect .... +# is set so localepurge works as expected +if [ -x $target/usr/sbin/localepurge ] ; then + $ROOTCMD dpkg-reconfigure -f noninteractive localepurge +fi + +if [ -x $target/usr/sbin/locale-gen ] ; then + $ROOTCMD locale-gen +else + echo 'Warning: locale-gen [package locales] not available' +fi + +if [ -x $target/usr/sbin/localepurge ] ; then + $ROOTCMD localepurge +fi ## END OF FILE ################################################################# # vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=3