--- docs/livemedia-creator.1 | 6 ++++++ src/pylorax/imgutils.py | 2 +- src/sbin/livemedia-creator | 13 +++++++++---- 3 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/docs/livemedia-creator.1 b/docs/livemedia-creator.1 index 9d1379e..9cb578c 100644 --- a/docs/livemedia-creator.1 +++ b/docs/livemedia-creator.1 @@ -11,6 +11,7 @@ livemedia-creator [-h] [--fs-label FS_LABEL] [--qcow2] [--qcow2-arg QCOW2_ARGS] [--compression] [--compress-arg] + [--live-rootfs-size LIVE_ROOTFS_SIZE] [--keep-image] [--no-virt] [--proxy PROXY] [--anaconda-arg ANACONDA_ARGS] [--armplatform ARMPLATFORM] [--location LOCATION] @@ -195,6 +196,11 @@ Path to template to use for appliance data. \fB--app-file APP_FILE\fR Appliance template results file.
+.SH PXE-LIVE ARGUMENTS: +.TP +\fB--live-rootfs-size\fR +Size of root filesystem of live image in GiB. By default approximate size of space used in root filesystem is used. + .SH VIRT-INSTALL ARGUMENTS: .TP \fB--ram MEMORY\fR diff --git a/src/pylorax/imgutils.py b/src/pylorax/imgutils.py index f2702e4..232d91f 100644 --- a/src/pylorax/imgutils.py +++ b/src/pylorax/imgutils.py @@ -98,7 +98,7 @@ def mkrootfsimg(rootdir, outfile, label, size=2, sysroot=""): :param str rootdir: Root directory :param str outfile: Path of output image file :param str label: Filesystem label - :param int size: Size of the image, if None computed automatically + :param int size: Size of the image in GiB, if None computed automatically :param str sysroot: path to system (deployment) root relative to physical root """ if size: diff --git a/src/sbin/livemedia-creator b/src/sbin/livemedia-creator index 683612d..62bd023 100755 --- a/src/sbin/livemedia-creator +++ b/src/sbin/livemedia-creator @@ -1037,7 +1037,7 @@ def make_image(opts, ks): return disk_img
-def make_live_images(opts, work_dir, root_dir, rootfs_image=None): +def make_live_images(opts, work_dir, root_dir, rootfs_image=None, size=None): """ Create live images from direcory or rootfs image
@@ -1063,7 +1063,7 @@ def make_live_images(opts, work_dir, root_dir, rootfs_image=None): shutil.copy2(rootfs_image, joinpaths(liveos_dir, "rootfs.img")) else: log.info("Creating live rootfs image") - mkrootfsimg(root_dir, joinpaths(liveos_dir, "rootfs.img"), "LiveOS", size=None, sysroot=sys_root) + mkrootfsimg(root_dir, joinpaths(liveos_dir, "rootfs.img"), "LiveOS", size=size, sysroot=sys_root)
log.info("Packing live rootfs image") add_pxe_args = [] @@ -1201,7 +1201,6 @@ def main(): help="Compression binary for make-tar. xz, lzma, gzip, and bzip2 are supported. xz is the default.") image_group.add_argument("--compress-arg", action="append", dest="compress_args", default=[], help="Arguments to pass to compression. Pass once for each argument") - # Group of arguments for appliance creation app_group = parser.add_argument_group("appliance arguments") app_group.add_argument("--app-name", default=None, @@ -1235,6 +1234,11 @@ def main(): "once for each argument. NOTE: this " "overrides the default. (default: %s)" % (DRACUT_DEFAULT,))
+ # pxe to live arguments + pxelive_group = parser.add_argument_group("pxe to live arguments") + pxelive_group.add_argument("--live-rootfs-size", type=int, default=0, + help="Size of root filesystem of live image in GiB") + parser.add_argument("--title", default="Linux Live Media", help="Substituted for @TITLE@ in bootloader config files") parser.add_argument("--project", default="Linux", @@ -1441,7 +1445,8 @@ def main(): mounted_sysroot_boot_dir = None if opts.ostree: mounted_sysroot_boot_dir = mount_boot_part_over_root(img_mount) - result_dir = make_live_images(opts, work_dir, img_mount.mount_dir) + size = opts.live_rootfs_size or None + result_dir = make_live_images(opts, work_dir, img_mount.mount_dir, size=size) finally: if mounted_sysroot_boot_dir: umount(mounted_sysroot_boot_dir)
--- docs/livemedia-creator.1 | 5 +++++ src/sbin/livemedia-creator | 8 +++++++- 2 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/docs/livemedia-creator.1 b/docs/livemedia-creator.1 index 9cb578c..550bcf4 100644 --- a/docs/livemedia-creator.1 +++ b/docs/livemedia-creator.1 @@ -12,6 +12,7 @@ livemedia-creator [-h] [--qcow2] [--qcow2-arg QCOW2_ARGS] [--compression] [--compress-arg] [--live-rootfs-size LIVE_ROOTFS_SIZE] + [--live-rootfs-keep-size LIVE_ROOTFS_KEEP_SIZE] [--keep-image] [--no-virt] [--proxy PROXY] [--anaconda-arg ANACONDA_ARGS] [--armplatform ARMPLATFORM] [--location LOCATION] @@ -201,6 +202,10 @@ Appliance template results file. \fB--live-rootfs-size\fR Size of root filesystem of live image in GiB. By default approximate size of space used in root filesystem is used.
+.TP +\fB--live-rootfs-keep-size\fR +Keep the size of original root filesystem (rounded down to GiB) in live image + .SH VIRT-INSTALL ARGUMENTS: .TP \fB--ram MEMORY\fR diff --git a/src/sbin/livemedia-creator b/src/sbin/livemedia-creator index 62bd023..326f5c8 100755 --- a/src/sbin/livemedia-creator +++ b/src/sbin/livemedia-creator @@ -1238,6 +1238,9 @@ def main(): pxelive_group = parser.add_argument_group("pxe to live arguments") pxelive_group.add_argument("--live-rootfs-size", type=int, default=0, help="Size of root filesystem of live image in GiB") + pxelive_group.add_argument("--live-rootfs-keep-size", action="store_true", + help="Keep the original size of root filesystem in live image") +
parser.add_argument("--title", default="Linux Live Media", help="Substituted for @TITLE@ in bootloader config files") @@ -1445,7 +1448,10 @@ def main(): mounted_sysroot_boot_dir = None if opts.ostree: mounted_sysroot_boot_dir = mount_boot_part_over_root(img_mount) - size = opts.live_rootfs_size or None + if opts.live_rootfs_keep_size: + size = img_mount.mount_size / 1024**3 + else: + size = opts.live_rootfs_size or None result_dir = make_live_images(opts, work_dir, img_mount.mount_dir, size=size) finally: if mounted_sysroot_boot_dir:
Ack to these.
anaconda-patches@lists.fedorahosted.org