Re: [f16-branch] Write human readable timezone information to /etc/timezone.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 08/31/2011 06:52 AM, Ales Kozumplik wrote:
This is to unify this basic config file with other distros. systemd is made to
maintain it in sync with /etc/localtime.

If systemd maintains the symlink, why can't it create it when it doesn't exist? Systemd seems to be treating /etc/localtime as authoritative in this case.


Resolves: rhbz#734626
---
  pyanaconda/timezone.py |   10 +++++++---
  1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/pyanaconda/timezone.py b/pyanaconda/timezone.py
index 405aa9b..8118090 100644
--- a/pyanaconda/timezone.py
+++ b/pyanaconda/timezone.py
@@ -33,8 +33,8 @@ class Timezone:
          f.write(" %s\n" % self.tz)

      def write(self, instPath):
+        # /etc/localtime
          fromFile = instPath + "/usr/share/zoneinfo/" + self.tz
-
          if not os.access(fromFile, os.R_OK):
              log.error("Timezone to be copied (%s) doesn't exist" % fromFile)
          else:
@@ -43,18 +43,22 @@ class Timezone:
              except EnvironmentError as e:
                  log.error("Error copying timezone (from %s): %s" % (fromFile, e.strerror))

+        # /etc/sysconfig/clock
          f = open(instPath + "/etc/sysconfig/clock", "w")
-
          f.write('ZONE="%s"\n' % self.tz)
          f.close()

+        # /etc/timezone (human readable timezone name)
+        with open(instPath + "/etc/timezone", 'w') as f:
+            f.write(self.tz)
+
+        # /etc/adjtime
          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])

The problem I have with these sorts of patches are that anaconda now owns the initial creation of this symlink. What happens when the symlink has to move, change, or otherwise be modified in the future? I guarantee you that the group making that decision will not communicate it with us and we will deal with it in a reactive manner.

So I always ask myself if anaconda really needs to own the creation of this symlink or if it can be placed in another component?

The bug indicates that systemd is pushing for common files like this to avoid having applications scour /usr/share/zoneinfo to get a human readable name for /etc/localtime. Why not have systemd just do that at boot up? Will users know to update /etc/timezone when they update /etc/localtime? Or will some users think they can change /etc/timezone to change the timezone and leave /etc/localtime alone and then wonder why things don't work? Perhaps system-config-date could offer a Python library, C library, and command line tool to look up /etc/localtime and print out the human-readable name?

In short, I do not think this is a thing anaconda should own.

--
David Cantrell <dcantrell@xxxxxxxxxx>
Supervisor, Installer Engineering Team
Red Hat, Inc. | Westford, MA | EST5EDT

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux