Signed-off-by: Vratislav Podzimek vpodzime@redhat.com --- pyanaconda/install.py | 4 ++++ pyanaconda/kickstart.py | 7 +++++++ pyanaconda/timezone.py | 19 +++++++++++++++++++ 3 files changed, 30 insertions(+)
diff --git a/pyanaconda/install.py b/pyanaconda/install.py index b716364..102855d 100644 --- a/pyanaconda/install.py +++ b/pyanaconda/install.py @@ -86,8 +86,12 @@ def doInstall(storage, payload, ksdata, instClass): installing packages onto those filesystems. """ from pyanaconda import progress + from pyanaconda import timezone from pyanaconda.kickstart import runPostScripts
+ # First save system time to HW clock. + timezone.save_hw_clock(ksdata.timezone) + # We really only care about actions that affect filesystems, since # those are the ones that take the most time. steps = len(storage.devicetree.findActions(type="create", object="format")) + \ diff --git a/pyanaconda/kickstart.py b/pyanaconda/kickstart.py index 7ff41a5..809af11 100644 --- a/pyanaconda/kickstart.py +++ b/pyanaconda/kickstart.py @@ -1262,6 +1262,13 @@ class Services(commands.services.FC6_Services): root=ROOT_PATH)
class Timezone(commands.timezone.F18_Timezone): + def __init__(self, *args): + commands.timezone.F18_Timezone.__init__(self, *args) + + #TODO: Do we need to set it to False in case of dual-boot? + #default to UTC HW clock in Anaconda + self.isUtc = True + def execute(self, *args): # write out timezone configuration if not timezone.is_valid_timezone(self.timezone): diff --git a/pyanaconda/timezone.py b/pyanaconda/timezone.py index 0b7173d..6d07317 100644 --- a/pyanaconda/timezone.py +++ b/pyanaconda/timezone.py @@ -29,6 +29,7 @@ import pytz from collections import OrderedDict
from pyanaconda import localization +from pyanaconda import iutil
import logging log = logging.getLogger("anaconda") @@ -87,6 +88,24 @@ def write_timezone_config(timezone, root): msg = "Error while writing /etc/adjtime file: %s" % ioerr.strerror raise TimezoneConfigError(msg)
+def save_hw_clock(timezone): + """ + Save system time to HW clock. + + @param timezone: ksdata.timezone object + + """ + + cmd = "hwclock" + args = ["--systohc"] + if timezone.isUtc: + args.append("--utc") + else: + args.append("--local") + + iutil.execWithRedirect(cmd, args, stdout="/dev/tty5", stderr="/dev/tty5") + + def get_all_territory_timezones(territory): """ Return the list of timezones for a given territory.
On Fri, Oct 05, 2012 at 07:57:47PM +0200, Vratislav Podzimek wrote:
- # First save system time to HW clock.
- timezone.save_hw_clock(ksdata.timezone)
This should be wrapped in a can_touch_runtime_system() check.
On Tue, 2012-10-09 at 10:31 -0700, Brian C. Lane wrote:
On Fri, Oct 05, 2012 at 07:57:47PM +0200, Vratislav Podzimek wrote:
- # First save system time to HW clock.
- timezone.save_hw_clock(ksdata.timezone)
This should be wrapped in a can_touch_runtime_system() check.
Good catch, thanks. I will change it locally.
anaconda-patches@lists.fedorahosted.org