From a7df2300f1a684225b16bdba5e3f6087a587c939 Mon Sep 17 00:00:00 2001 From: Michael Prokop Date: Wed, 8 Jul 2009 00:18:16 +0200 Subject: [PATCH] grml-setlang: do not set LANGUAGE by default, set LANG and LC_CTYPE only instead --- debian/changelog | 11 +++++++++++ usr_sbin/grml-setlang | 31 ++++++++++++++++++++----------- 2 files changed, 31 insertions(+), 11 deletions(-) diff --git a/debian/changelog b/debian/changelog index e95f1e1..f27a242 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,14 @@ +grml-scripts (1.1.24) UNRELEASED; urgency=low + + * grml-setlang: do not set $LANGUAGE and $LC_MESSAGES any longer, but + instead just set $LANG and $LC_CTYPE. $LC_CTYPE is set to 'en_US.UTF-8' + by default and to 'C' if using a ISO system - this should avoid breakages + if logging in to a remote system where the according $LANG locale isn't + available. Thanks to Gebi and Thorsten 'mira' Glaser for discussing + the issue. + + -- Michael Prokop Wed, 08 Jul 2009 00:15:26 +0200 + grml-scripts (1.1.23) unstable; urgency=low * Drop symlink for 'service' manpage. diff --git a/usr_sbin/grml-setlang b/usr_sbin/grml-setlang index f8cb28b..e4c8293 100755 --- a/usr_sbin/grml-setlang +++ b/usr_sbin/grml-setlang @@ -4,7 +4,6 @@ # Authors: grml-team (grml.org), (c) Michael Prokop # Bug-Reports: see http://grml.org/bugs/ # License: This file is licensed under the GPL v2. -# Latest change: Mit Sep 05 18:33:23 CEST 2007 [mika] ################################################################################ PN="$(basename $0)" @@ -166,6 +165,15 @@ if ! grep -qe "${LANGUAGE})" -qe "${LANGUAGE}|" $LANGFUNC ; then ewarn "Language ${LANGUAGE} not supported, using default." ; eend 0 fi +# fallback to C if using an ISO system (which is latin1 for LC_CTYPE); +# this should prevent users from broken ctype settings if the set +# locale isn't available on a remote system +if echo $LANGUAGE | grep -q -- '-iso' ; then + LC_CTYPE=C +else + LC_CTYPE=en_US.UTF-8 +fi + # read in the file where all the $LANGUAGE stuff is defined source $LANGFUNC @@ -173,22 +181,23 @@ fi if ! [ -r $CONFFILE ] ; then cat > $CONFFILE < LC_* > LANG +# LANGUAGE is glibc only and binds stronger than LC_ALL EOF fi -setvalue 'LANGUAGE=' $LANGUAGE -setvalue 'LANG=' $LANG -setvalue 'LC_MESSAGES=' $LANG -# setvalue 'TZ=' $TZ +setvalue 'LANG=' $LANG +setvalue 'LC_CTYPE=' $LC_CTYPE retval=$? case $retval in -- 2.1.4