[Fedora-livecd-list] [PATCH] Record rpm macro information into the /etc/rpm/macros.imagecreate directory so they persist with the image

Bryan Kearney bkearney at redhat.com
Thu Sep 4 20:47:07 UTC 2008


---
 imgcreate/creator.py   |    1 +
 imgcreate/kickstart.py |   18 +++++++++++++++++-
 2 files changed, 18 insertions(+), 1 deletions(-)

diff --git a/imgcreate/creator.py b/imgcreate/creator.py
index b32a657..0a2453b 100644
--- a/imgcreate/creator.py
+++ b/imgcreate/creator.py
@@ -720,6 +720,7 @@ class ImageCreator(object):
         kickstart.ServicesConfig(self._instroot).apply(ksh.services)
         kickstart.XConfig(self._instroot).apply(ksh.xconfig)
         kickstart.NetworkConfig(self._instroot).apply(ksh.network)
+        kickstart.RPMMacroConfig(self._instroot).apply(self.ks)
 
         self._create_bootconfig()
 
diff --git a/imgcreate/kickstart.py b/imgcreate/kickstart.py
index b34f733..7c59e47 100644
--- a/imgcreate/kickstart.py
+++ b/imgcreate/kickstart.py
@@ -233,7 +233,23 @@ class XConfig(KickstartConfig):
         f.seek(0)
         f.write(buf)
         f.close()
-
+        
+class RPMMacroConfig(KickstartConfig):
+	"""A class to apply the specified rpm macros to the filesystem"""
+	def apply(self, ks):
+		if not ks:
+			return
+		f = open(self.path("/etc/rpm/macros.imagecreate"), "w+")
+		if exclude_docs(ks):
+			f.write("%_exludedocs 1\n")
+		if not selinux_enabled(ks):
+			f.write("%__file_context_path %{nil}\n")        	
+		if inst_langs(ks) != None:
+			f.write("%_install_langs ")    
+			f.write(inst_langs(ks))
+			f.write("\n")      	
+		f.close()
+       	
 class NetworkConfig(KickstartConfig):
     """A class to apply a kickstart network configuration to a system."""
     def write_ifcfg(self, network):
-- 
1.5.5.1




More information about the livecd mailing list