X-Git-Url: https://git.grml.org/?p=grml-live.git;a=blobdiff_plain;f=etc%2Fgrml%2Ffai%2Fconfig%2Fscripts%2FGRMLBASE%2F25-locales;h=1717c70a57f7fab94fc3866b2695db106d1b843e;hp=b47a5e597531713467b2293a0879dd29191ed8e1;hb=fa05be302992602b96e156836716234e2ea7f194;hpb=edcbcd0457813705a214cd7228b1be6c8809573d diff --git a/etc/grml/fai/config/scripts/GRMLBASE/25-locales b/etc/grml/fai/config/scripts/GRMLBASE/25-locales index b47a5e5..1717c70 100755 --- a/etc/grml/fai/config/scripts/GRMLBASE/25-locales +++ b/etc/grml/fai/config/scripts/GRMLBASE/25-locales @@ -8,11 +8,9 @@ set -e -# 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 +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 @@ -24,6 +22,36 @@ else 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