Allow a None to be passed as size to create_runtime

This is so that imgutils.mkext4img can dynamically calculate the size of
the image.
This commit is contained in:
Brian C. Lane 2011-09-23 17:34:55 -07:00
parent 035d49628c
commit 7d1b7b4cc8

View File

@ -130,7 +130,10 @@ class RuntimeBuilder(object):
def create_runtime(self, outfile="/tmp/squashfs.img", compression="xz", compressargs=[], size=2):
# make live rootfs image - must be named "LiveOS/rootfs.img" for dracut
workdir = joinpaths(os.path.dirname(outfile), "runtime-workdir")
fssize = size * (1024*1024*1024) # 2GB sparse file compresses down to nothin'
if size:
fssize = size * (1024*1024*1024) # 2GB sparse file compresses down to nothin'
else:
fssize = None # Let mkext4img figure out the needed size
os.makedirs(joinpaths(workdir, "LiveOS"))
imgutils.mkext4img(self.vars.root, joinpaths(workdir, "LiveOS/rootfs.img"),
label="Anaconda", size=fssize)