From: Dohyung Kim Date: Tue, 21 Nov 2017 07:36:14 +0000 (+0900) Subject: Add 'UmountScripts' templete which support '%post-umount' section X-Git-Tag: accepted/tizen/6.0/unified/20201030.110920^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F86%2F239186%2F2;p=platform%2Fupstream%2Fkickstarter.git Add 'UmountScripts' templete which support '%post-umount' section Change-Id: If5c94ef67305bd04c6919e65ea7e3bd6a8e4e594 Signed-off-by: Dohyung Kim --- diff --git a/kickstart/kickstart.tmpl b/kickstart/kickstart.tmpl index 10059a8..3ada3d6 100644 --- a/kickstart/kickstart.tmpl +++ b/kickstart/kickstart.tmpl @@ -139,7 +139,16 @@ ${metadata.Post} ${metadata.NoChroot} %end +#if $metadata.Run != "" %runscript ${metadata.Run} %end +#end if + +#if $metadata.Umount != "" +%post-umount +${metadata.Umount} +%end +#end if + diff --git a/kswriter/KSWriter.py b/kswriter/KSWriter.py index 9449eb4..fdc27e8 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', 'EnvScripts'] + lval = ['Repos', 'Groups', 'PostScripts', 'NoChrootScripts', 'RemovePackages', 'ExtraPackages', 'RunScripts', 'EnvScripts', 'UmountScripts'] lvald = {} for l in lval: full = [] @@ -145,6 +145,16 @@ class KSWriter(): else: raise KSMetaError('%s/scripts/%s.env not found, aborting.' %(meta_root, scr )) + umountscript = "" + for scr in conf['UmountScripts']: + if os.path.exists('%s/scripts/%s.umount' %(meta_root,scr)): + f = open('%s/scripts/%s.umount' %(meta_root, scr ), 'r') + umountscript += f.read() + umountscript += "\n" + f.close() + else: + raise KSMetaError('%s/scripts/%s.umount not found, aborting.' %(meta_root, scr )) + ptab = "" for g in [ plat, img ]: if g.has_key("Part"): @@ -166,6 +176,7 @@ class KSWriter(): conf['Post'] = postscript conf['NoChroot'] = nochrootscript conf['Run'] = runscript + conf['Umount'] = umountscript if envscript: conf['Env'] = envscript return conf