diff options
author | yuhuan.yang <yuhuan.yang@123.com> | 2017-08-29 19:33:16 +0800 |
---|---|---|
committer | yuhuan.yang <yuhuan.yang@123.com> | 2017-08-29 19:48:37 +0800 |
commit | 77443f7562dcae30076a1a394565b9d8f0e41c75 (patch) | |
tree | a4246e5442ea1be786ee0f79f2ab54635fb30cfb | |
parent | d1888c49fa23b40c79aa24527639fcefd125f639 (diff) | |
download | mic-77443f7562dcae30076a1a394565b9d8f0e41c75.tar.gz mic-77443f7562dcae30076a1a394565b9d8f0e41c75.tar.bz2 mic-77443f7562dcae30076a1a394565b9d8f0e41c75.zip |
Timezone setting change
Change-Id: I90bdc068430589f04ab148b3b8b9b31d8b197613
-rwxr-xr-x | mic/kickstart/__init__.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/mic/kickstart/__init__.py b/mic/kickstart/__init__.py index f568f99..76cc525 100755 --- a/mic/kickstart/__init__.py +++ b/mic/kickstart/__init__.py @@ -200,16 +200,23 @@ class TimezoneConfig(KickstartConfig): f.write("ZONE=\"" + tz + "\"\n") f.write("UTC=" + utc + "\n") f.close() + if not os.path.exists("/opt/etc"): + fs.makedirs("/opt/etc") tz_source = "/usr/share/zoneinfo/%s" % (tz) + tz_midst = "/opt/etc/localtime" tz_dest = "/etc/localtime" try: lncmd = fs.find_binary_inchroot('ln', self.instroot) if lncmd: - self.call([lncmd, "-s", tz_source, tz_dest]) + self.call([lncmd, "-s", tz_source, tz_midst]) + self.call([lncmd, "-s", tz_midst, tz_dest]) else: lncmd = fs.find_binary_path('ln') subprocess.call([lncmd, "-s", self.path(tz_source), + self.path(tz_midst)]) + subprocess.call([lncmd, "-s", + self.path(tz_midst), self.path(tz_dest)]) except (IOError, OSError), (errno, msg): raise errors.KsError("Timezone setting error: %s" % msg) |