livemedia-creator: update TreeBuilder use for isolabel

TreeBuilder class changed its __init__ so add --volid switch,
length check and isolabel.
This commit is contained in:
Brian C. Lane 2012-03-07 17:29:31 -08:00
parent ecda30d999
commit 607bd49ed7

View File

@ -424,7 +424,7 @@ def make_ami( disk_img, ami_img="ami-root.img", ami_label="AMI" ):
def make_livecd( disk_img, squashfs_args="", templatedir=None, def make_livecd( disk_img, squashfs_args="", templatedir=None,
title="Linux", project="Linux", releasever=16 ): title="Linux", project="Linux", releasever=16, isolabel=None ):
""" """
Take the content from the disk image and make a livecd out of it Take the content from the disk image and make a livecd out of it
@ -487,9 +487,14 @@ def make_livecd( disk_img, squashfs_args="", templatedir=None,
subprocess.check_call(["/bin/ln", "-s", joinpaths( work_dir, "images" ), subprocess.check_call(["/bin/ln", "-s", joinpaths( work_dir, "images" ),
joinpaths( installroot, "images" )]) joinpaths( installroot, "images" )])
isolabel = isolabel or "{0.name} {0.version} {1.basearch}".format(product, arch)
if len(isolabel) > 32:
isolabel = isolabel[:32]
log.error("Truncating isolabel to 32 chars: %s" % (isolabel,))
tb = TreeBuilder( product=product, arch=arch, tb = TreeBuilder( product=product, arch=arch,
inroot=installroot, outroot=work_dir, inroot=installroot, outroot=work_dir,
runtime=runtime, templatedir=templatedir) runtime=runtime, isolabel=isolabel, templatedir=templatedir)
log.info( "Rebuilding initrds" ) log.info( "Rebuilding initrds" )
if not opts.dracut_args: if not opts.dracut_args:
dracut_args = DRACUT_DEFAULT dracut_args = DRACUT_DEFAULT
@ -579,6 +584,7 @@ if __name__ == '__main__':
help="substituted for @PROJECT@ in bootloader config files" ) help="substituted for @PROJECT@ in bootloader config files" )
parser.add_argument( "--releasever", type=int, default=16, parser.add_argument( "--releasever", type=int, default=16,
help="substituted for @VERSION@ in bootloader config files" ) help="substituted for @VERSION@ in bootloader config files" )
parser.add_argument( "--volid", default=None, help="volume id")
parser.add_argument( "--squashfs_args", parser.add_argument( "--squashfs_args",
help="additional squashfs args" ) help="additional squashfs args" )
@ -638,6 +644,10 @@ if __name__ == '__main__':
log.error( "virt-install needs an install iso." ) log.error( "virt-install needs an install iso." )
sys.exit( 1 ) sys.exit( 1 )
if opts.volid and len(opts.volid) > 32:
logger.fatal("the volume id cannot be longer than 32 characters")
sys.exit(1)
# Make the disk image # Make the disk image
if not opts.disk_image: if not opts.disk_image:
# Parse the kickstart to get the partition sizes # Parse the kickstart to get the partition sizes
@ -716,7 +726,8 @@ if __name__ == '__main__':
if opts.make_iso and not opts.image_only: if opts.make_iso and not opts.image_only:
result_dir = make_livecd( opts.disk_image or disk_img, opts.squashfs_args, result_dir = make_livecd( opts.disk_image or disk_img, opts.squashfs_args,
opts.lorax_templates, opts.lorax_templates,
opts.title, opts.project, opts.releasever ) opts.title, opts.project, opts.releasever,
opts.volid )
elif opts.make_ami and not opts.image_only: elif opts.make_ami and not opts.image_only:
result_dir = make_ami(opts.disk_image or disk_img) result_dir = make_ami(opts.disk_image or disk_img)