Hi, It looks OK, but I would name it differently (maybe restoreSetupTime?) as the funtion does no upgrade, it is just reading values. Of course, this will need community testing to get all the corner cases right. And as we discussed yesterday, this patch is not doing the second part.. What if the timezone files changed in the new version? Should we use the old file from user's system to set the time or the new one with the same name? And should we then install the old version or the new one into destination /etc? Martin ----- "Ales Kozumplik" <akozumpl@xxxxxxxxxx> wrote: > Including timezone and UTC through /etc/adjtime. > --- > dispatch.py | 2 ++ > upgrade.py | 41 ++++++++++++++++++++++++++++++++++++++++- > 2 files changed, 42 insertions(+), 1 deletions(-) > > diff --git a/dispatch.py b/dispatch.py > index 5bcaab9..a4029d9 100644 > --- a/dispatch.py > +++ b/dispatch.py > @@ -36,6 +36,7 @@ from storage.partitioning import doAutoPartition > from bootloader import writeBootloader, bootloaderSetupChoices > from flags import flags > from upgrade import upgradeMountFilesystems > +from upgrade import upgradeSetupTime > from upgrade import upgradeSwapSuggestion, upgradeMigrateFind > from upgrade import findRootParts, queryUpgradeContinue > from installmethod import doMethodComplete > @@ -83,6 +84,7 @@ installSteps = [ > ("autopartitionexecute", doAutoPartition, ), > ("partition", ), > ("upgrademount", upgradeMountFilesystems, ), > + ("upgradesetuptime", upgradeSetupTime, ), > ("upgradecontinue", queryUpgradeContinue, ), > ("upgradeswapsuggestion", upgradeSwapSuggestion, ), > ("addswap", ), > diff --git a/upgrade.py b/upgrade.py > index 438407a..bff2ad0 100644 > --- a/upgrade.py > +++ b/upgrade.py > @@ -107,7 +107,45 @@ def upgradeMigrateFind(anaconda): > anaconda.dispatch.skipStep("upgrademigratefs") > else: > anaconda.dispatch.skipStep("upgrademigratefs", skip = 0) > - > + > +def copyFromSysimage(rootPath, filename): > + """Mirrors filename from the sysimage on the ramdisk.""" > + sysfile = os.path.normpath("%s/%s" % (rootPath, filename)) > + if os.access(sysfile, os.R_OK): > + try: > + # remove our copy if we have one (think liveinstall) > + os.remove(filename) > + except OSError: > + pass > + try: > + shutil.copyfile(sysfile, filename) > + except OSError as e: > + log.error("Error copying %s to sysimage: %s" %(sysfile, > e.strerror)) > + return False > + else: > + log.error("Error copying %s to sysimage, file not > accessible." % sysfile) > + return False > + return True > + > +def upgradeSetupTime(anaconda): > + """Load time setup for upgrade install. > + > + This is pretty much what packages.setupTimezone() does in > reverse. > + """ > + if anaconda.dir == DISPATCH_BACK: > + return > + if os.environ.has_key("TZ"): > + del os.environ["TZ"] > + copyFromSysimage(anaconda.rootPath, '/etc/localtime') > + copyFromSysimage(anaconda.rootPath, '/etc/adjtime') > + if iutil.isS390(): > + return > + args = [ "--hctosys" ] > + try: > + iutil.execWithRedirect("/usr/sbin/hwclock", args,stdout = > "/dev/tty5", > + stderr = "/dev/tty5") > + except RuntimeError: > + log.error("Failed to set the clock.") > > # returns None if no more swap is needed > def upgradeSwapSuggestion(anaconda): > @@ -271,6 +309,7 @@ def setSteps(anaconda): > "findrootparts", > "findinstall", > "upgrademount", > + "upgradesetuptime", > "upgrademigfind", > "upgrademigratefs", > "enablefilesystems", > -- > 1.6.6 > > _______________________________________________ > Anaconda-devel-list mailing list > Anaconda-devel-list@xxxxxxxxxx > https://www.redhat.com/mailman/listinfo/anaconda-devel-list _______________________________________________ Anaconda-devel-list mailing list Anaconda-devel-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/anaconda-devel-list