compress_image_values="
gz
bz2
+ lzo
"
compress_disk_image_values="
gz
bz2
+ lzo
"
declare -F _split_longopt &>/dev/null && _split_longopt
_arguments \
$common_ops \
'--shrink[Whether to shrink loop images to minimal size]' \
- "--compress-image=[Compress all loop images with \'gz\' or \'bz2\']: :(gz bz2)" \
- "--compress-disk-image=[Same with --compress-image]: :(gz bz2)" \
+ "--compress-image=[Compress all loop images with \'gz\' or \'bz2\' or \'lzo\']: :(gz bz2 lzo)" \
+ "--compress-disk-image=[Same with --compress-image]: :(gz bz2 lzo)" \
&& ret=0
;;
(raw)
$common_ops \
"--fstab-entry=[Set fstab entry, \'name\' means using device names, \'uuid\' means using filesystem uuid]: :(name uuid)" \
'--generate-bmap[also generate the block map file]' \
- '--compress-image=[Compress all raw images before package]: :(gz bz2)' \
- '--compress-disk-image=[Same with --compress-image]: :(gz bz2)' \
+ '--compress-image=[Compress all raw images before package]: :(gz bz2 lzo)' \
+ '--compress-disk-image=[Same with --compress-image]: :(gz bz2 lzo)' \
&& ret=0
;;
(help)
comp_map = {
"gz": ["pgzip", "pigz", "gzip"],
"bz2": ["pbzip2", "bzip2"],
+ "lzo": ["lzop"],
}
if method not in comp_map:
raise CreatorError("Unsupport compress format: %s, valid values: %s"
pass
if not cmd:
raise CreatorError("Command %s not available" % cmdname)
- rc = runner.show([cmd, "-f", fpath])
+ if 'lzop' in cmd:
+ rc = runner.show([cmd, "-Uf", fpath])
+ else:
+ rc = runner.show([cmd, "-f", fpath])
if rc:
raise CreatorError("Failed to %s file: %s" % (comp_map[method], fpath))
@classmethod
@cmdln.option("--compress-disk-image", dest="compress_image",
- type='choice', choices=("gz", "bz2"), default=None,
+ type='choice', choices=("gz", "bz2", "lzo"), default=None,
help="Same with --compress-image")
# alias to compress-image for compatibility
@cmdln.option("--compress-image", dest="compress_image",
- type='choice', choices=("gz", "bz2"), default=None,
- help="Compress all loop images with 'gz' or 'bz2'")
+ type='choice', choices=("gz", "bz2", "lzo"), default=None,
+ help="Compress all loop images with 'gz' or 'bz2' or 'lzo',"
+ "Note: if you want to use 'lzo', package 'lzop' is needed to"
+ "be installed manually.")
@cmdln.option("--shrink", action='store_true', default=False,
help="Whether to shrink loop images to minimal size")
def do_create(self, subcmd, opts, *args):
@classmethod
@cmdln.option("--compress-disk-image", dest="compress_image", type='choice',
- choices=("gz", "bz2"), default=None,
+ choices=("gz", "bz2", "lzo"), default=None,
help="Same with --compress-image")
@cmdln.option("--compress-image", dest="compress_image", type='choice',
- choices=("gz", "bz2"), default = None,
- help="Compress all raw images before package")
+ choices=("gz", "bz2", "lzo"), default=None,
+ help="Compress all raw images before package, Note: if you want "
+ "to use 'lzo', package 'lzop' is needed to be installed manually.")
@cmdln.option("--generate-bmap", action="store_true", default = None,
help="also generate the block map file")
@cmdln.option("--fstab-entry", dest="fstab_entry", type='choice',