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

Re: patch for termwrap



Hi. (I'm not on this list. So please cc me if you reply. Thanks)

In <[🔎] 20020310074039.573ac21c.dancer@netfort.gr.jp>,
 on "Sun, 10 Mar 2002 07:40:39 +0900",
 with "Re: patch for termwrap",
  Junichi Uekawa <dancer@netfort.gr.jp> wrote:

> Petter Reinholdtsen <pere@hungry.com> cum veritate scripsit:
> 
> > > This sounds inappropriate for re-invocation after installation
> > 
> > Should base-config use the same language as it used during install if
> > the default language is different then the installation locale?
> 
> Considering that it might even be several years after installation,
> the current default language sounds more reasonable.

When termwrap is invoked from a shell (maybe "use termwrap after
installation" should be this case), then the required environment
variables are provided by that invoking shell.

So termwrap just needs to check it, and use it as it is when
already it is set.

On the first installation, termwarp is invoked from "init" (pid=1),
and no environment variables are provided (because of absence of
invoking shell) in this case.  The reason of configuration check
in termwarp itself, is this "invoked by init" case.

Here is the updated patch.  What do you think ?

--- termwrap.orig	Mon Mar 18 23:25:09 2002
+++ termwrap	Mon Mar 18 23:39:26 2002
@@ -15,12 +15,39 @@
 ######################################################################
 ##	Set some environment variables.
 ######################################################################
-# reads /etc/environment.
-test -f /etc/environment && . /etc/environment
+#
+# if the LANG is setup already, then don't touch it.
+if [ -z "$LANG" ]
+ then
+# reads configuration file.
+  CONFIG=/root/dbootstrap_settings
+  if [ -r $CONFIG ]
+    then
+     . $CONFIG
+# Set LANG environment variables.
+     if [ ! -z "$LANG_INST" ]
+       then
+         LANG=$LANG_INST
+         export LANG
+     fi
+# Set LANGUAGE environment variables.
+     if [ -z "$LANGUAGE" -a ! -z "$LANGUAGE_INST" ]
+       then
+         LANGUAGE=$LANGUAGE_INST
+         export LANGUAGE
+     fi
+  fi
+fi
 
-# Set all locale related environment variables.
-LC_ALL=$LANG
-export LANG LC_ALL
+# Check LANG and LANGUAGE settings at locales pacakge
+if [ ! -z "$LANG" ] ; 
+  then 
+   if ! grep $LANG /etc/locale.gen ; then LANG=C; fi
+fi
+if [ ! -z "$LANGUAGE" ] ;
+  then
+   if ! grep $LANGUAGE /etc/locale.gen ; then unset LANGUAGE; fi
+fi
 
 ######################################################################
 ##	Display usage if no argument.


-- 
  Taketoshi Sano: <sano@debian.org>,<sano@debian.or.jp>,<kgh12351@nifty.ne.jp>



Reply to: