dom0/core: get timezone from /etc/localtime symlink

Fedora 18 doesn't have /etc/sysconfig/clock. Instead have /etc/localtime
symlinked to real timezone (instead of hardlinked like before), so now it is
easy to get destination TZ name.
This commit is contained in:
Marek Marczykowski 2013-01-25 03:10:12 +01:00
parent 75fc222545
commit 5de6f5ad10

View File

@ -831,6 +831,11 @@ class QubesVm(object):
# FIXME: should be outside of QubesVM?
def get_timezone(self):
# fc18
if os.path.islink('/etc/localtime'):
return '/'.join(os.readlink('/etc/localtime').split('/')[-2:])
# <=fc17
elif os.path.exists('/etc/sysconfig/clock'):
clock_config = open('/etc/sysconfig/clock', "r")
clock_config_lines = clock_config.readlines()
clock_config.close()