[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#261256: languagechooser: Should enable selected locale in /target/



Package: languagechooser
Version: 1.28
Tags:    d-i patch

At the moment, the locale needed in the second stage of the
installation is generated by termwrap before base-config starts.  I
believe it would be better if this is done in the prebaseconfig script
in languagechooser.  Even better would be to get the locales package
to handle it, but I am not sure how to do that.  It is installed by
base-installer, and there is no way to tell it which locale it should
generate.

Here is a patch to enable this.

Index: prebaseconfig
===================================================================
--- prebaseconfig       (revision 18320)
+++ prebaseconfig       (working copy)
@@ -2,6 +2,8 @@

 . /usr/share/debconf/confmodule

+LOG=/var/log/messages
+
 modify_cyrconfig() {
         if [ "$2" ]; then
            sed -e "s/^$1 .*\$/$1 $2/" \
@@ -76,3 +78,19 @@
     echo "LANG_INST=\"$LOCALE\""
     echo "LANGUAGE_INST=\"$LANGLIST\""
 ) >> /target/root/dbootstrap_settings
+
+# Set global locale and language, and make sure the glibc locale is
+# generated.  This task is also done in termwrap and base-config, and
+# should probably be removed from there when this part work.
+(
+    echo "LANG=\"$LOCALE\"
+    echo "LANGUAGE=\"$LANGLIST\""
+) >> /target/etc/environment
+# If the locale isn't already valid, append it to locale.gen
+if chroot /target/ /usr/sbin/validlocale $LOCALE \
+    >> /target/etc/locale.gen 2> $LOG ; then
+    : # Nothing to do
+else
+    # New locale added to locale.gen, generate it
+    chroot /target /usr/sbin/locale-gen > $LOG 2>&1
+fi

When this patch is enabled, we should modify termwrap to only check if
the locale is available, and to not generate it if it isn't.



Reply to: