--- anaconda | 2 +- instdata.py | 2 +- iw/kbd_gui.py | 3 +-- iw/language_gui.py | 2 +- iw/timezone_gui.py | 2 +- language.py | 34 ++++++++++++++++++++++++++++++---- textw/keyboard_text.py | 2 +- textw/language_text.py | 4 ++-- textw/timezone_text.py | 2 +- 9 files changed, 39 insertions(+), 14 deletions(-) diff --git a/anaconda b/anaconda index 6b01ed0..be38973 100755 --- a/anaconda +++ b/anaconda @@ -944,7 +944,7 @@ if __name__ == "__main__": anaconda.dispatch.skipStep("language", permanent = 1) anaconda.id.instLanguage.instLang = opts.lang anaconda.id.instLanguage.systemLang = opts.lang - anaconda.id.timezone.setTimezoneInfo(anaconda.id.instLanguage.getDefaultTimeZone()) + anaconda.id.timezone.setTimezoneInfo(anaconda.id.instLanguage.getDefaultTimeZone(anaconda.rootPath)) if opts.keymap: anaconda.dispatch.skipStep("keyboard", permanent = 1) diff --git a/instdata.py b/instdata.py index b5a189a..2e1503d 100644 --- a/instdata.py +++ b/instdata.py @@ -65,7 +65,7 @@ class InstallData: self.firewall = firewall.Firewall() self.security = security.Security() self.timezone = timezone.Timezone() - self.timezone.setTimezoneInfo(self.instLanguage.getDefaultTimeZone()) + self.timezone.setTimezoneInfo(self.instLanguage.getDefaultTimeZone(self.anaconda.rootPath)) self.users = None self.rootPassword = { "isCrypted": False, "password": "", "lock": False } self.auth = "--enableshadow --passalgo=sha512 --enablefingerprint" diff --git a/iw/kbd_gui.py b/iw/kbd_gui.py index fdf67e1..322d04c 100644 --- a/iw/kbd_gui.py +++ b/iw/kbd_gui.py @@ -35,5 +35,4 @@ class KeyboardWindow(InstallWindow, installKeyboardWindow): def getScreen(self, anaconda): anaconda.id.keyboard.beenset = 1 - return installKeyboardWindow.getScreen(self, anaconda.id.instLanguage.getDefaultKeyboard(), - anaconda.id.keyboard) + return installKeyboardWindow.getScreen(self, anaconda.id.instLanguage.getDefaultKeyboard(anaconda.rootPath), anaconda.id.keyboard) diff --git a/iw/language_gui.py b/iw/language_gui.py index 5459ce5..d09213b 100644 --- a/iw/language_gui.py +++ b/iw/language_gui.py @@ -50,7 +50,7 @@ class LanguageWindow (InstallWindow): self.instLang.instLang = self.lang self.instLang.systemLang = self.lang - anaconda.id.timezone.setTimezoneInfo(anaconda.id.instLanguage.getDefaultTimeZone()) + anaconda.id.timezone.setTimezoneInfo(anaconda.id.instLanguage.getDefaultTimeZone(anaconda.rootPath)) self.ics.getICW().setLanguage() return None diff --git a/iw/timezone_gui.py b/iw/timezone_gui.py index 2e18f5a..f414929 100644 --- a/iw/timezone_gui.py +++ b/iw/timezone_gui.py @@ -92,7 +92,7 @@ class TimezoneWindow(InstallWindow): (self.default, asUTC) = self.timezone.getTimezoneInfo() if not self.default: - self.default = anaconda.id.instLanguage.getDefaultTimeZone() + self.default = anaconda.id.instLanguage.getDefaultTimeZone(anaconda.rootPath) asUTC = 0 if (string.find(self.default, "UTC") != -1): diff --git a/language.py b/language.py index c4f7bf5..9c0bebb 100644 --- a/language.py +++ b/language.py @@ -26,6 +26,7 @@ import locale import gettext from simpleconfig import SimpleConfigFile +import system_config_keyboard.keyboard as keyboard import logging log = logging.getLogger("anaconda") @@ -211,11 +212,36 @@ class Language(object): def getCurrentLangSearchList(self): return expandLangs(self.systemLang) + ['C'] - def getDefaultKeyboard(self): - return self.localeInfo[self.systemLang][3] + def getDefaultKeyboard(self, instPath): + try: + return self.localeInfo[self.systemLang][3] + except KeyError: + try: + kbd = keyboard.Keyboard() + kbd.read(instPath) + return kbd.get() + except: + return self.localeInfo[self._default][3] + else: + return self.localeInfo[self._default][3] - def getDefaultTimeZone(self): - return self.localeInfo[self.systemLang][4] + def getDefaultTimeZone(self, instPath): + try: + return self.localeInfo[self.systemLang][4] + except KeyError: + # If doing an upgrade and the system language is something not + # recognized by anaconda, we should try to see if we can figure + # it out from the running system. + if os.path.exists(instPath + "/etc/sysconfig/clock"): + cfg = SimpleConfigFile() + cfg.read(instPath + "/etc/sysconfig/clock") + + try: + return cfg.get("ZONE") + except: + return self.localeInfo[self._default][4] + else: + return self.localeInfo[self._default][4] def getFontFile(self, lang): # Note: in /etc/fonts.cgz fonts are named by the map diff --git a/textw/keyboard_text.py b/textw/keyboard_text.py index 52ecffb..d136446 100644 --- a/textw/keyboard_text.py +++ b/textw/keyboard_text.py @@ -39,7 +39,7 @@ class KeyboardWindow: if anaconda.id.keyboard.beenset: default = anaconda.id.keyboard.get () else: - default = anaconda.id.instLanguage.getDefaultKeyboard() + default = anaconda.id.instLanguage.getDefaultKeyboard(anaconda.rootPath) if default not in keyboards: default = 'us' diff --git a/textw/language_text.py b/textw/language_text.py index ec9fcd1..191a90d 100644 --- a/textw/language_text.py +++ b/textw/language_text.py @@ -59,12 +59,12 @@ class LanguageWindow: buttons=[TEXT_OK_BUTTON]) id.instLanguage.instLang = choice id.instLanguage.systemLang = choice - id.timezone.setTimezoneInfo(id.instLanguage.getDefaultTimeZone()) + id.timezone.setTimezoneInfo(id.instLanguage.getDefaultTimeZone(anaconda.rootPath)) return INSTALL_OK id.instLanguage.instLang = choice id.instLanguage.systemLang = choice - id.timezone.setTimezoneInfo(id.instLanguage.getDefaultTimeZone()) + id.timezone.setTimezoneInfo(id.instLanguage.getDefaultTimeZone(anaconda.rootPath)) anaconda.intf.drawFrame() diff --git a/textw/timezone_text.py b/textw/timezone_text.py index 9a5280a..6245ed5 100644 --- a/textw/timezone_text.py +++ b/textw/timezone_text.py @@ -67,7 +67,7 @@ class TimezoneWindow: timezones = self.getTimezoneList() (default, asUtc) = anaconda.id.timezone.getTimezoneInfo() if not default: - default = anaconda.id.instLanguage.getDefaultTimeZone() + default = anaconda.id.instLanguage.getDefaultTimeZone(anaconda.rootPath) bb = ButtonBar(screen, [TEXT_OK_BUTTON, TEXT_BACK_BUTTON]) t = TextboxReflowed(30, -- 1.6.4.2 _______________________________________________ Anaconda-devel-list mailing list Anaconda-devel-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/anaconda-devel-list