[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
[PATCH 1/2] Add "style" param to lorax.conf and LoraxInstallTree
- From: Will Woods <wwoods redhat com>
- To: anaconda-devel-list redhat com
- Subject: [PATCH 1/2] Add "style" param to lorax.conf and LoraxInstallTree
- Date: Fri, 25 Mar 2011 14:35:29 -0400
This adds a "ramdisk" section to lorax.conf, which contains a "style" key.
This key is passed to LoraxInstallTree to control what style of ramdisk
should be built. The default is "initramfs", which is the current default
One Big Image style of ramdisk. More may be added later.
---
src/pylorax/__init__.py | 6 +++++-
src/pylorax/installtree.py | 33 ++++++++++++++++++++-------------
2 files changed, 25 insertions(+), 14 deletions(-)
diff --git a/src/pylorax/__init__.py b/src/pylorax/__init__.py
index 1ce411c..de74b28 100644
--- a/src/pylorax/__init__.py
+++ b/src/pylorax/__init__.py
@@ -96,6 +96,9 @@ class Lorax(BaseLoraxClass):
self.conf.add_section("templates")
self.conf.set("templates", "ramdisk", "ramdisk.ltmpl")
+ self.conf.add_section("ramdisk")
+ self.conf.set("ramdisk", "style", "initramfs")
+
# read the config file
if os.path.isfile(conf_file):
self.conf.read(conf_file)
@@ -197,7 +200,8 @@ class Lorax(BaseLoraxClass):
# set up install tree
logger.info("setting up install tree")
self.installtree = LoraxInstallTree(self.yum, self.basearch,
- self.libdir, self.workdir)
+ self.libdir, self.workdir,
+ self.conf.get("ramdisk", "style"))
# set up required build parameters
logger.info("setting up build parameters")
diff --git a/src/pylorax/installtree.py b/src/pylorax/installtree.py
index 9883bba..9704769 100644
--- a/src/pylorax/installtree.py
+++ b/src/pylorax/installtree.py
@@ -39,16 +39,33 @@ from sysutils import *
class LoraxInstallTree(BaseLoraxClass):
- def __init__(self, yum, basearch, libdir, workdir):
+ def __init__(self, yum, basearch, libdir, workdir, style):
BaseLoraxClass.__init__(self)
self.yum = yum
self.root = self.yum.installroot
self.basearch = basearch
self.libdir = libdir
self.workdir = workdir
+ self.style = style
self.lcmds = constants.LoraxRequiredCommands()
+ if self.style == 'initramfs':
+ self.make_initrd = self.make_initramfs
+
+ def compress(self, initrd, kernel, compression="xz"):
+ start = time.time()
+ logger.debug("creating {0}-style initrd".format(self.style))
+ # move corresponding modules to the tree
+ shutil.move(joinpaths(self.workdir, kernel.version),
+ joinpaths(self.root, "modules"))
+ result = self.make_initrd(initrd, kernel, compression)
+ # move modules out of the tree again
+ shutil.move(joinpaths(self.root, "modules", kernel.version),
+ self.workdir)
+ elapsed = time.time() - start
+ return result, elapsed
+
def remove_locales(self):
chroot = lambda: os.chroot(self.root)
@@ -506,13 +523,8 @@ class LoraxInstallTree(BaseLoraxClass):
dst = joinpaths(self.root, "sbin")
shutil.copy2(src, dst)
- def compress(self, initrd, kernel):
+ def make_initramfs(self, initrd, kernel, type="xz"):
chdir = lambda: os.chdir(self.root)
- start = time.time()
-
- # move corresponding modules to the tree
- shutil.move(joinpaths(self.workdir, kernel.version),
- joinpaths(self.root, "modules"))
find = subprocess.Popen([self.lcmds.FIND, "."], stdout=subprocess.PIPE,
preexec_fn=chdir)
@@ -525,13 +537,8 @@ class LoraxInstallTree(BaseLoraxClass):
gzipped.write(cpio.stdout.read())
gzipped.close()
- # move modules out of the tree again
- shutil.move(joinpaths(self.root, "modules", kernel.version),
- self.workdir)
-
- elapsed = time.time() - start
+ return True
- return True, elapsed
@property
def kernels(self):
--
1.7.4
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]