summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lumens <clumens@redhat.com>2009-10-12 16:50:28 -0400
committerChris Lumens <clumens@redhat.com>2009-10-13 13:18:55 -0400
commit2525dda439357f0d169d8eca6e47a8d154ce8097 (patch)
tree2ea957de1836c9c03cf0c4c4b783ed23b8703d2f
parentfbd2e28131d2bf834df883961c7eedb844bb3ebe (diff)
downloadanaconda-2525dda439357f0d169d8eca6e47a8d154ce8097.tar.gz
anaconda-2525dda439357f0d169d8eca6e47a8d154ce8097.tar.xz
anaconda-2525dda439357f0d169d8eca6e47a8d154ce8097.zip
Support upgrading when the language isn't in lang-table (#528317).
-rwxr-xr-xanaconda2
-rw-r--r--instdata.py2
-rw-r--r--iw/kbd_gui.py3
-rw-r--r--iw/language_gui.py2
-rw-r--r--iw/timezone_gui.py2
-rw-r--r--language.py34
-rw-r--r--loader/init.c2
-rw-r--r--textw/keyboard_text.py2
-rw-r--r--textw/language_text.py4
-rw-r--r--textw/timezone_text.py2
10 files changed, 40 insertions, 15 deletions
diff --git a/anaconda b/anaconda
index 6b01ed003..be38973db 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 b5a189add..2e1503d3a 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 fdf67e131..322d04c4a 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 5459ce5c8..d09213b8b 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 2e18f5a34..f41492969 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 c4f7bf528..c0270c28c 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,34 @@ class Language(object):
def getCurrentLangSearchList(self):
return expandLangs(self.systemLang) + ['C']
- def getDefaultKeyboard(self):
- return self.localeInfo[self.systemLang][3]
-
- def getDefaultTimeZone(self):
- return self.localeInfo[self.systemLang][4]
+ 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]
+
+ 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/loader/init.c b/loader/init.c
index bab572146..b730c8dae 100644
--- a/loader/init.c
+++ b/loader/init.c
@@ -530,7 +530,9 @@ int main(int argc, char **argv) {
exit(1);
}
+ /*
execl("/sbin/udevadm", "udevadm", "control", "--env=ANACONDA=1", NULL);
+ */
}
printf("done\n");
diff --git a/textw/keyboard_text.py b/textw/keyboard_text.py
index 52ecffb2c..d136446df 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 ec9fcd142..191a90d5d 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 9a5280ac1..6245ed56f 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,