diff --git a/pmb/install/_install.py b/pmb/install/_install.py index ceb0c292..38f64a46 100644 --- a/pmb/install/_install.py +++ b/pmb/install/_install.py @@ -416,7 +416,11 @@ def install_system_image(args): pmb.chroot.shutdown(args, True) # Convert rootfs to sparse using img2simg - if args.deviceinfo["flash_sparse"] == "true" and not args.split and not args.sdcard: + sparse = args.sparse + if sparse is None: + sparse = args.deviceinfo["flash_sparse"] == "true" + + if sparse and not args.split and not args.sdcard: logging.info("(native) make sparse rootfs") pmb.chroot.apk.install(args, ["android-tools"]) sys_image = args.device + ".img" diff --git a/pmb/parse/arguments.py b/pmb/parse/arguments.py index 87b690cb..72d261af 100644 --- a/pmb/parse/arguments.py +++ b/pmb/parse/arguments.py @@ -488,6 +488,13 @@ def arguments(): install.add_argument("--no-base", help="do not install postmarketos-base (advanced)", action="store_false", dest="install_base") + group = install.add_mutually_exclusive_group() + group.add_argument("--sparse", help="generate sparse image file" + " (even if unsupported by device)", default=None, + action="store_true") + group.add_argument("--no-sparse", help="do not generate sparse image file" + " (even if supported by device)", dest="sparse", + action="store_false") # Action: checksum / aportgen / build checksum = sub.add_parser("checksum", help="update aport checksums")