dom0/vm: set VM timezone same as in dom0 - on VM boot (#413)
This commit is contained in:
parent
0a5082023f
commit
2897a795c4
@ -644,6 +644,19 @@ class QubesVm(object):
|
|||||||
f_private.truncate (size)
|
f_private.truncate (size)
|
||||||
f_private.close ()
|
f_private.close ()
|
||||||
|
|
||||||
|
# FIXME: should be outside of QubesVM?
|
||||||
|
def get_timezone(self):
|
||||||
|
clock_config = open('/etc/sysconfig/clock', "r")
|
||||||
|
clock_config_lines = clock_config.readlines()
|
||||||
|
clock_config.close()
|
||||||
|
zone_re = re.compile(r'^ZONE="(.*)"')
|
||||||
|
for line in clock_config_lines:
|
||||||
|
line_match = zone_re.match(line)
|
||||||
|
if line_match:
|
||||||
|
return line_match.group(1)
|
||||||
|
|
||||||
|
return None
|
||||||
|
|
||||||
def cleanup_vifs(self):
|
def cleanup_vifs(self):
|
||||||
"""
|
"""
|
||||||
Xend does not remove vif when backend domain is down, so we must do it
|
Xend does not remove vif when backend domain is down, so we must do it
|
||||||
@ -704,6 +717,12 @@ class QubesVm(object):
|
|||||||
"{0}/qubes_secondary_dns".format(domain_path),
|
"{0}/qubes_secondary_dns".format(domain_path),
|
||||||
self.netvm_vm.secondary_dns)
|
self.netvm_vm.secondary_dns)
|
||||||
|
|
||||||
|
tzname = self.get_timezone()
|
||||||
|
if tzname:
|
||||||
|
xs.write('',
|
||||||
|
"{0}/qubes-timezone".format(domain_path),
|
||||||
|
tzname)
|
||||||
|
|
||||||
for srv in self.services.keys():
|
for srv in self.services.keys():
|
||||||
# convert True/False to "1"/"0"
|
# convert True/False to "1"/"0"
|
||||||
xs.write('', "{0}/qubes-service/{1}".format(domain_path, srv),
|
xs.write('', "{0}/qubes-service/{1}".format(domain_path, srv),
|
||||||
|
@ -29,6 +29,13 @@ start()
|
|||||||
(grep -v "\<$name\>" /etc/hosts; echo "127.0.0.1 $name") > /etc/hosts
|
(grep -v "\<$name\>" /etc/hosts; echo "127.0.0.1 $name") > /etc/hosts
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
timezone=`/usr/bin/xenstore-read qubes-timezone 2> /dev/null`
|
||||||
|
if [ -n "$timezone" ]; then
|
||||||
|
ln -f /usr/share/zoneinfo/$timezone /etc/localtime
|
||||||
|
echo "# Clock configuration autogenerated based on Qubes dom0 settings" > /etc/sysconfig/clock
|
||||||
|
echo "ZONE=\"$timezone\"" >> /etc/sysconfig/clock
|
||||||
|
fi
|
||||||
|
|
||||||
# Set IP address again (besides action in udev rules); this is needed by
|
# Set IP address again (besides action in udev rules); this is needed by
|
||||||
# DispVM (to override DispVM-template IP) and in case when qubes_ip was
|
# DispVM (to override DispVM-template IP) and in case when qubes_ip was
|
||||||
# called by udev before loading evtchn kernel module - in which case
|
# called by udev before loading evtchn kernel module - in which case
|
||||||
|
@ -48,3 +48,9 @@ if [ -n "$name" ]; then
|
|||||||
(grep -v "\<$name\>" /etc/hosts; echo "127.0.0.1 $name") > /etc/hosts
|
(grep -v "\<$name\>" /etc/hosts; echo "127.0.0.1 $name") > /etc/hosts
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
timezone=`$XS_READ qubes-timezone 2> /dev/null`
|
||||||
|
if [ -n "$timezone" ]; then
|
||||||
|
ln -f /usr/share/zoneinfo/$timezone /etc/localtime
|
||||||
|
echo "# Clock configuration autogenerated based on Qubes dom0 settings" > /etc/sysconfig/clock
|
||||||
|
echo "ZONE=\"$timezone\"" >> /etc/sysconfig/clock
|
||||||
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user