So, ever since the dawn of time, hwclock has written whether the system's hardware clock is in UTC or not to /etc/adjtime whenever it saves the hardware clock, and reads that file whenever it restores it. Given that, it seems odd that we've been maintaining that state in a separate file all this time. The following patches to anaconda and system-config-date stop doing that. While they are there, they also nuke the arc stuff, because 1) if hwclock doesn't support figuring that out automatically, it should 2) the current Alpha ports of Fedora don't support any ARC console machines any more, in any case Bill
diff --git a/installclass.py b/installclass.py index 68a7e37..e9fcbe5 100644 --- a/installclass.py +++ b/installclass.py @@ -263,8 +263,8 @@ class BaseInstallClass(object): def setGateway(self, id, gateway): id.network.setGateway(gateway) - def setTimezoneInfo(self, id, timezone, asUtc = 0, asArc = 0): - id.timezone.setTimezoneInfo(timezone, asUtc, asArc) + def setTimezoneInfo(self, id, timezone, asUtc = 0): + id.timezone.setTimezoneInfo(timezone, asUtc) def setAuthentication(self, id, authStr): id.auth = authStr diff --git a/timezone.py b/timezone.py index c58736c..dc3d2f6 100644 --- a/timezone.py +++ b/timezone.py @@ -51,20 +51,31 @@ class Timezone: f = open(instPath + "/etc/sysconfig/clock", "w") f.write('ZONE="%s"\n' % self.tz) - f.write("UTC=%s\n" % bool(self.utc)) - f.write("ARC=%s\n" % bool(self.arc)) + f.close() + + try: + f = open(instPath + "/etc/adjtime", "r") + lines = f.readlines() + f.close() + except: + lines = [ "0.0 0 0.0\n", "0\n" ] + f = open(instPath + "/etc/adjtime", "w") + f.write(lines[0]) + f.write(lines[1]) + if self.utc: + f.write("UTC\n") + else: + f.write("LOCAL\n") f.close() def getTimezoneInfo(self): - return (self.tz, self.utc, self.arc) + return (self.tz, self.utc) - def setTimezoneInfo(self, timezone, asUtc = 0, asArc = 0): + def setTimezoneInfo(self, timezone, asUtc = 0): self.tz = timezone self.utc = asUtc - self.arc = asArc def __init__(self): self.tz = "America/New_York" self.utc = 0 - self.arc = 0
diff -ru system-config-date-1.9.21/src/scdMainWindow.py system-config-date-1.9.21-new/src/scdMainWindow.py --- system-config-date-1.9.21/src/scdMainWindow.py 2008-01-18 11:29:17.000000000 -0500 +++ system-config-date-1.9.21-new/src/scdMainWindow.py 2008-02-04 15:42:33.000000000 -0500 @@ -195,11 +195,11 @@ # Get the time zone info from the time zone page if "timezone" in self.showPages: - timezone, utc, arc = self.timezonePage.getTimezoneInfo () + timezone, utc = self.timezonePage.getTimezoneInfo () else: - timezone, utc, arc = self.timezoneBackend.getTimezoneInfo () + timezone, utc = self.timezoneBackend.getTimezoneInfo () - self.timezoneBackend.writeConfig (timezone, utc, arc) + self.timezoneBackend.writeConfig (timezone, utc) if self.closeParent == True and not self.firstboot: if gtk.__dict__.has_key ("main_quit"): diff -ru system-config-date-1.9.21/src/timeconfig.py system-config-date-1.9.21-new/src/timeconfig.py --- system-config-date-1.9.21/src/timeconfig.py 2008-01-18 11:29:17.000000000 -0500 +++ system-config-date-1.9.21-new/src/timeconfig.py 2008-02-04 15:42:17.000000000 -0500 @@ -39,7 +39,7 @@ class TimezoneWindow: def __call__(self, screen, zonetab, timezoneBackend): self.timezone = timezoneBackend.getTimezoneInfo() - self.default, self.asUTC, self.asArc = self.timezone + self.default, self.asUTC = self.timezone bb = ButtonBar(screen, [_("OK"), _("Cancel")]) t = TextboxReflowed(40, @@ -90,8 +90,8 @@ def runConfig(rc): timezone, utc = rc - default, asUTC, asArc = timezoneBackend.getTimezoneInfo() - timezoneBackend.writeConfig(timezone, utc, asArc) + default, asUTC = timezoneBackend.getTimezoneInfo() + timezoneBackend.writeConfig(timezone, utc) if os.getuid() > 0 or os.geteuid() > 0: print _("You must be root to run timeconfig.") diff -ru system-config-date-1.9.21/src/timezoneBackend.py system-config-date-1.9.21-new/src/timezoneBackend.py --- system-config-date-1.9.21/src/timezoneBackend.py 2008-01-18 11:29:17.000000000 -0500 +++ system-config-date-1.9.21-new/src/timezoneBackend.py 2008-02-04 15:46:48.000000000 -0500 @@ -42,7 +42,7 @@ return "false" class timezoneBackend: - def writeConfig (self, timezone, utc=0, arc=0): + def writeConfig (self, timezone, utc=0): timezonefile = timezone.replace (' ', '_') fromFile = "/usr/share/zoneinfo/" + timezonefile @@ -51,12 +51,6 @@ else: utc = "true" - if arc != "false": - if arc != 0: - arc = "true" - else: - arc = "false" - try: shutil.copyfile(fromFile, "/etc/localtime") except OSError, (errno, msg): @@ -90,12 +84,20 @@ f.write('# The ZONE parameter is only evaluated by system-config-date.\n') f.write('# The time zone of the system is defined by the contents of /etc/localtime.\n') f.write('ZONE="%s"\n' % timezone) - f.write("UTC=%s\n" % utc) - f.write("ARC=%s\n" % arc) f.close() - - f = open("/etc/sysconfig/clock", "r") - tmp = f.read() + + f = open("/etc/adjtime", "r") + l = f.readlines() + f.close() + + f = open("/etc/adjtime", "w") + f.write(l[0]) + f.write(l[1]) + if utc == 'true': + f.write("UTC\n") + else: + f.write("LOCAL\n") + f.close() def copyFile(self, source, to): f = os.open(source, os.O_RDONLY) @@ -114,17 +116,15 @@ os.close(t) def getTimezoneInfo (self): - return (self.tz, self.utc, self.arc) + return (self.tz, self.utc) - def setTimezoneInfo (self, timezone, asUtc = 0, asArc = 0): + def setTimezoneInfo (self, timezone, asUtc = 0): self.tz = timezone self.utc = asUtc - self.arc = asArc def __init__(self): self.tz = "America/New_York" self.utc = "false" - self.arc = "false" path = '/etc/sysconfig/clock' lines = [] @@ -147,14 +147,16 @@ tokens = string.split(line, "=") if tokens[0] == "ZONE": self.tz = string.replace(tokens[1], '"', '') - if tokens[0] == "UTC": - self.utc = tokens[1] - if tokens[0] == "ARC": - if string.lower(tokens[1]) == "true": - self.arc = tokens[1] - else: - self.arc = "false" except: pass except: pass + if os.access("/etc/adjtime", os.R_OK): + fd = open("/etc/adjtime", 'r') + lines = fd.readlines() + fd.close() + line = lines[2].strip() + if line == 'UTC': + self.utc = 'true' + else: + self.utc = 'false' diff -ru system-config-date-1.9.21/src/timezone_gui.py system-config-date-1.9.21-new/src/timezone_gui.py --- system-config-date-1.9.21/src/timezone_gui.py 2008-01-18 11:29:17.000000000 -0500 +++ system-config-date-1.9.21-new/src/timezone_gui.py 2008-02-04 15:43:16.000000000 -0500 @@ -58,7 +58,7 @@ self.xml = xml self.mainVBox = self.xml.get_widget ("tz_vbox") self.timezone = scdMainWindow.timezoneBackend.getTimezoneInfo() - self.default, self.asUTC, self.asArc = self.timezone + self.default, self.asUTC = self.timezone self.tz = self.xml.get_widget ("tz") @@ -76,4 +76,4 @@ return self.mainVBox def getTimezoneInfo(self): - return self.tz.getCurrent().tz, self.utcCheck.get_active(), self.asArc + return self.tz.getCurrent().tz, self.utcCheck.get_active()
_______________________________________________ Anaconda-devel-list mailing list Anaconda-devel-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/anaconda-devel-list