[master/f20-branch][PATCH] Fix geolocation on live installs

Martin Kolman mkolman at redhat.com
Tue Nov 19 15:27:48 UTC 2013


Ignore LANG if it is the same as our default language,
otherwise geolocation will never bee used.
If LANG is set to a different value than our
default language, it will take precedence and
geolocation will not be used.

Signed-off-by: Martin Kolman <mkolman at redhat.com>
---
 anaconda               | 16 +++++++++++++++-
 data/liveinst/liveinst |  4 ----
 2 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/anaconda b/anaconda
index fcaeb1c..5e10315 100755
--- a/anaconda
+++ b/anaconda
@@ -980,7 +980,21 @@ if __name__ == "__main__":
 
     from pyanaconda import localization
     # Set the language before loading an interface, when it may be too late.
-    requested_lang = opts.lang or ksdata.lang.lang
+
+    # check if the LANG environmental variable is set
+    env_lang = os.environ.get("LANG")
+    if env_lang is not None:
+        # parse it using langtable
+        env_langs = localization.get_language_locales(env_lang)
+        # if parsed LANG is the same as our default language - ignore it;
+        # otherwise use it as valid language candidate
+        if env_langs and env_langs[0] != constants.DEFAULT_LANG:
+            env_lang = env_langs[0]  # the first language is the best match
+        else:
+            env_lang = None
+
+    requested_lang = opts.lang or ksdata.lang.lang or env_lang
+
     if requested_lang:
         locales = localization.get_language_locales(requested_lang)
         if locales:
diff --git a/data/liveinst/liveinst b/data/liveinst/liveinst
index dce02e5..a2cd773 100755
--- a/data/liveinst/liveinst
+++ b/data/liveinst/liveinst
@@ -18,10 +18,6 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #
 
-if [ -n "$DISPLAY" -a -n "$LANG" ]; then
-    INSTLANG="--lang $LANG"
-fi
-
 LIVE_INSTALL=0
 IMAGE_INSTALL=0
 RESCUE=0
-- 
1.8.4.2



More information about the anaconda-patches mailing list