Skip to content

pmb/parse/arguments.py: refactor 'install' args

Administrator requested to merge install-args-refactor into master

Move the numerous "install" arguments into an own function (as it was done with actions added later). Categorize the options and update the help output, so the options are easier to understand.

This is in prepartion for new --no-rootfs (#1966 (closed)) and --cp (#1977 (closed)) arguments.

How to test:

  • Run pmbootstrap install -h and look at the difference
  • Do a couple of test installs with the new code

Help output before/after

Before:

usage: pmbootstrap install [-h]
                           [--sdcard SDCARD | --split | --no-split | --android-recovery-zip | --no-image]
                           [--rsync] [--cipher CIPHER] [--iter-time ITER_TIME]
                           [--add ADD] [--fde] [--flavor FLAVOR]
                           [--recovery-install-partition RECOVERY_INSTALL_PARTITION]
                           [--recovery-no-kernel] [--no-base]
                           [--on-device-installer] [--no-local-pkgs]
                           [--no-recommends] [--sparse | --no-sparse]

optional arguments:
  -h, --help            show this help message and exit
  --sdcard SDCARD       path to the sdcard device, eg. /dev/mmcblk0
  --split               install the boot and root partition in separated image
                        files (default: only if flash method requires it)
  --no-split            create combined boot + root image even if flash method
                        requires it
  --android-recovery-zip
                        generate TWRP flashable zip
  --no-image            do not generate the image
  --rsync               update the sdcard using rsync, does not work with
                        --fde
  --cipher CIPHER       cryptsetup cipher used to encrypt the rootfs, eg. aes-
                        xts-plain64
  --iter-time ITER_TIME
                        cryptsetup iteration time (in milliseconds) to use
                        when encrypting the system partition
  --add ADD             comma separated list of packages to be added to the
                        rootfs (e.g. 'vim,gcc')
  --fde                 use full disk encryption
  --flavor FLAVOR       Specify kernel flavor to include in recovery flashable
                        zip
  --recovery-install-partition RECOVERY_INSTALL_PARTITION
                        partition to flash from recovery, eg. external_sd
  --recovery-no-kernel  do not overwrite the existing kernel
  --no-base             do not install postmarketos-base (advanced)
  --on-device-installer, --ondev
                        wrap the resulting image in a graphical on-device
                        installer, so the installation can be customized after
                        flashing
  --no-local-pkgs       do not install locally compiled packages and package
                        signing keys
  --no-recommends       do not install packages listed in _pmb_recommends of
                        the UI pmaports
  --sparse              generate sparse image file (even if unsupported by
                        device)
  --no-sparse           do not generate sparse image file (even if supported
                        by device)

After:

$ pmbootstrap install -h
usage: pmbootstrap install [-h]
                           [--no-split | --split | --sdcard BLOCKDEV | --android-recovery-zip | --no-image]
                           [--rsync] [--flavor FLAVOR]
                           [--recovery-install-partition RECOVERY_INSTALL_PARTITION]
                           [--recovery-no-kernel] [--fde] [--cipher CIPHER]
                           [--iter-time ITER_TIME] [--add PACKAGES]
                           [--no-base] [--no-recommends]
                           [--sparse | --no-sparse] [--on-device-installer]
                           [--no-local-pkgs]

optional arguments:
  -h, --help            show this help message and exit

optional image type:
  Format of the resulting image. Default is generating a combined image of
  the postmarketOS boot and root partitions (--no-split). (If the device's
  deviceinfo_flash_method requires separate boot and root partitions, then
  --split is the default.) Related: https://postmarketos.org/partitions

  --no-split            create combined boot and root image file
  --split               create separate boot and root image files
  --sdcard BLOCKDEV     do not create an image file, instead write to the
                        given SD card device (e.g. '/dev/mmcblk0')
  --android-recovery-zip
                        generate TWRP flashable zip (recommended read:
                        https://postmarketos.org/recoveryzip)
  --no-image            do not generate an image

optional image type 'sdcard' arguments:
  --rsync               update the SD card using rsync

optional image type 'android-recovery-zip' arguments:
  --flavor FLAVOR       kernel flavor to include in recovery flashable zip
  --recovery-install-partition RECOVERY_INSTALL_PARTITION
                        partition to flash from recovery (e.g. 'external_sd')
  --recovery-no-kernel  do not overwrite the existing kernel

optional full disk encryption arguments:
  --fde                 use full disk encryption
  --cipher CIPHER       cryptsetup cipher used to encrypt the the rootfs (e.g.
                        'aes-xts-plain64')
  --iter-time ITER_TIME
                        cryptsetup iteration time (in milliseconds) to use
                        when encrypting the system partition

optional packages arguments:
  Select or deselect packages to be included in the installation.

  --add PACKAGES        comma separated list of packages to be added to the
                        rootfs (e.g. 'vim,gcc')
  --no-base             do not install postmarketos-base (advanced)
  --no-recommends       do not install packages listed in _pmb_recommends of
                        the UI pmaports

optional sparse image arguments:
  Override deviceinfo_flash_sparse for testing purpose.

  --sparse              generate sparse image file
  --no-sparse           do not generate sparse image file

optional on-device installer arguments:
  Wrap the resulting image in a postmarketOS based installation OS, so it
  can be encrypted and customized on first boot. Related:
  https://postmarketos.org/on-device-installer

  --on-device-installer, --ondev
                        enable on-device installer
  --no-local-pkgs       do not install locally compiled packages and package
                        signing keys

Merge request reports

Loading