Timezone setting change
[platform/upstream/mic.git] / mic / kickstart / __init__.py
old mode 100644 (file)
new mode 100755 (executable)
index 8116da3..76cc525
@@ -167,6 +167,12 @@ class LanguageConfig(KickstartConfig):
             f.write("LANG=\"" + kslang.lang + "\"\n")
             f.close()
 
+            #cp ks lang setting to other file, then can access the file in %post section
+            fs.makedirs(self.path("/etc/config"))
+            f = open(self.path("/etc/config/mic_language"), "w+")
+            f.write("LANG=\"" + kslang.lang + "\"\n")
+            f.close()
+
 class KeyboardConfig(KickstartConfig):
     """A class to apply a kickstart keyboard configuration to a system."""
     @apply_wrapper
@@ -194,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:
-            cpcmd = fs.find_binary_inchroot('cp', self.instroot)
-            if cpcmd:
-                self.call([cpcmd, "-f", tz_source, tz_dest])
+            lncmd = fs.find_binary_inchroot('ln', self.instroot)
+            if lncmd:
+                self.call([lncmd, "-s", tz_source, tz_midst])
+                self.call([lncmd, "-s", tz_midst, tz_dest])
             else:
-                cpcmd = fs.find_binary_path('cp')
-                subprocess.call([cpcmd, "-f",
+                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)
@@ -726,11 +739,11 @@ RepoType = collections.namedtuple("Repo",
 
 def Repo(name, baseurl, mirrorlist=None, includepkgs=[], excludepkgs=[], proxy=None,
          proxy_username=None, proxy_password=None, debuginfo=None,
-         source=None, gpgkey=None, disable=None, ssl_verify=False,
+         source=None, gpgkey=None, disable=None, ssl_verify=None,
          nocache=False, cost=None, priority=None):
     return RepoType(name, baseurl, mirrorlist, includepkgs, excludepkgs, proxy,
                     proxy_username, proxy_password, debuginfo,
-                    source, gpgkey, disable, ssl_verify == "yes", nocache,
+                    source, gpgkey, disable, ssl_verify, nocache,
                     cost, priority)
 
 
@@ -807,6 +820,13 @@ def get_post_scripts(ks):
         scripts.append(s)
     return scripts
 
+def get_sign_scripts(ks):
+    scripts = []
+    for s in ks.handler.scripts:
+        if s.type != ksparser.KS_SCRIPT_RUN:
+            continue
+        scripts.append(s)
+    return scripts
 def add_repo(ks, repostr):
     args = repostr.split()
     repoobj = ks.handler.repo.parse(args[1:])