diff options
author | Slava Barinov <v.barinov@samsung.com> | 2018-10-17 10:11:05 +0300 |
---|---|---|
committer | Slava Barinov <v.barinov@samsung.com> | 2018-10-17 10:11:05 +0300 |
commit | 01d97d2c5ced05245b45482e0984016639961515 (patch) | |
tree | 0c787aa6dedf4fb34ef606681ff10e28c415e50a | |
parent | 5e9bb04c82121076fedd5a858f9dbe174aaed09d (diff) | |
download | kickstarter-sandbox/vbarinov/pre.tar.gz kickstarter-sandbox/vbarinov/pre.tar.bz2 kickstarter-sandbox/vbarinov/pre.zip |
Add support for %env sectionsandbox/vbarinov/presandbox/dkson95/env
Env-scripts support are required for building certain firmware configurations,
e.g. sanitized firmwares and can be used for setting up environment variables
for firmware build.
Signed-off-by: Slava Barinov <v.barinov@samsung.com>
-rw-r--r-- | kickstart/kickstart.tmpl | 4 | ||||
-rw-r--r-- | kswriter/KSWriter.py | 13 |
2 files changed, 16 insertions, 1 deletions
diff --git a/kickstart/kickstart.tmpl b/kickstart/kickstart.tmpl index e2b9b8e..86e4e55 100644 --- a/kickstart/kickstart.tmpl +++ b/kickstart/kickstart.tmpl @@ -87,6 +87,10 @@ repo --name=${r} --baseurl=${rr.Url} ${options_repo} #end for #end for +%env +${metadata.Env} +%end + %pre ${metadata.Pre} %end diff --git a/kswriter/KSWriter.py b/kswriter/KSWriter.py index bd0f89d..889c34f 100644 --- a/kswriter/KSWriter.py +++ b/kswriter/KSWriter.py @@ -92,7 +92,7 @@ class KSWriter(): plat = copy.copy(self.image_meta[img['Platform']]) conf.update(plat) conf.update(img) - lval = ['Repos', 'Groups', 'PostScripts', 'NoChrootScripts', 'RemovePackages', 'ExtraPackages', 'RunScripts', 'PreScripts'] + lval = ['Repos', 'Groups', 'PostScripts', 'NoChrootScripts', 'RemovePackages', 'ExtraPackages', 'RunScripts', 'PreScripts', 'EnvScripts'] lvald = {} for l in lval: full = [] @@ -145,6 +145,16 @@ class KSWriter(): else: raise KSMetaError('%s/scripts/%s.pre not found, aborting.' %(meta_root, scr )) + envscript = "" + for scr in conf['EnvScripts']: + if os.path.exists('%s/scripts/%s.env' %(meta_root,scr)): + f = open('%s/scripts/%s.env' %(meta_root, scr ), 'r') + envscript += f.read() + envscript += "\n" + f.close() + else: + raise KSMetaError('%s/scripts/%s.env not found, aborting.' %(meta_root, scr )) + ptab = "" for g in [ plat, img ]: if g.has_key("Part"): @@ -167,6 +177,7 @@ class KSWriter(): conf['NoChroot'] = nochrootscript conf['Run'] = runscript conf['Pre'] = prescript + conf['Env'] = envscript return conf def process_files(self, meta, repos): |