pmb.install: Add pmbootstrap install --(no-)sparse option (!1862)

At the moment, sparse images are generated if the device sets
deviceinfo_flash_sparse="true". But for testing purposes it can be
useful to specifically enable or disable the default behavior.

Add a --sparse and --no-sparse option that enables or disables
sparse image generation.
This commit is contained in:
Minecrell 2020-01-22 18:48:45 +01:00 committed by Oliver Smith
parent 4352096783
commit c8737740b1
No known key found for this signature in database
GPG Key ID: 5AE7F5513E0885CB
2 changed files with 12 additions and 1 deletions

View File

@ -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"

View File

@ -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")