From: SoonKyu Park Date: Thu, 24 Aug 2017 06:00:18 +0000 (+0900) Subject: Add 'Runscript' templete which support script running between 'each img creation... X-Git-Tag: accepted/tizen/unified/20170825.043947^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8592bd142d61b9084aad5b2ac0043bb93710badc;p=platform%2Fupstream%2Fkickstarter.git Add 'Runscript' templete which support script running between 'each img creation' and 'tar.gz creation' Image creation order : Create *.img, *.bin - Runscript - Create xxxx.tar.gz Change-Id: Ia77c05072283ca8cde5b95a127a0cbb28c8edba7 --- diff --git a/kickstart/kickstart.tmpl b/kickstart/kickstart.tmpl index 54f8a2e..301e3c0 100644 --- a/kickstart/kickstart.tmpl +++ b/kickstart/kickstart.tmpl @@ -132,3 +132,8 @@ ${metadata.Post} %post --nochroot ${metadata.NoChroot} %end + +%runscript +${metadata.Run} +%end + diff --git a/kswriter/KSWriter.py b/kswriter/KSWriter.py index 3117bae..b5e97a3 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'] + lval = ['Repos', 'Groups', 'PostScripts', 'NoChrootScripts', 'RemovePackages', 'ExtraPackages', 'RunScripts'] lvald = {} for l in lval: full = [] @@ -125,6 +125,16 @@ class KSWriter(): else: raise KSMetaError('%s/scripts/%s.nochroot not found, aborting.' %(meta_root, scr )) + runscript = "" + for scr in conf['RunScripts']: + if os.path.exists('%s/scripts/%s.run' %(meta_root,scr)): + f = open('%s/scripts/%s.run' %(meta_root, scr ), 'r') + runscript += f.read() + runscript += "\n" + f.close() + else: + raise KSMetaError('%s/scripts/%s.run not found, aborting.' %(meta_root, scr )) + ptab = "" for g in [ plat, img ]: if g.has_key("Part"): @@ -135,6 +145,7 @@ class KSWriter(): conf['Part'] = ptab conf['Post'] = postscript conf['NoChroot'] = nochrootscript + conf['Run'] = runscript return conf def process_files(self, meta, repos):