Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   ArchLinux Development (http://www.linux-archive.org/archlinux-development/)
-   -   Write human readable timezone information to /etc/timezone. (http://www.linux-archive.org/archlinux-development/570384-write-human-readable-timezone-information-etc-timezone.html)

Ales Kozumplik 08-31-2011 10:52 AM

Write human readable timezone information to /etc/timezone.
 
This is to unify this basic config file with other distros. systemd is made to
maintain it in sync with /etc/localtime.

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
" % 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"
' % 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
", "0
" ]
-
f = open(instPath + "/etc/adjtime", "w")
f.write(lines[0])
f.write(lines[1])
--
1.7.6

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

David Cantrell 08-31-2011 01:39 PM

Write human readable timezone information to /etc/timezone.
 
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
" % 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"
' % 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
", "0
" ]
-
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@redhat.com>
Supervisor, Installer Engineering Team
Red Hat, Inc. | Westford, MA | EST5EDT

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

Chris Lumens 09-06-2011 07:29 PM

Write human readable timezone information to /etc/timezone.
 
> 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?

Yeah - I agree with this reasoning. I've never really liked that we
have to copy something to /etc/localtime anyway, and adding another task
that conveys very similar information to what we have to do is the wrong
direction. Ideally, I'd like to see some sort of timezone setting
program we could call that would do both of these tasks for us.

- Chris

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


All times are GMT. The time now is 12:03 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.