pmb.install package

Submodules

pmb.install.blockdevice module

pmb.install.blockdevice.create(args: PmbArgs, size_boot, size_root, size_reserve, split, disk: Path | None)

Create /dev/install (the “install blockdevice”).

Parameters:
  • size_boot – size of the boot partition in MiB

  • size_root – size of the root partition in MiB

  • size_reserve – empty partition between root and boot in MiB (pma#463)

  • split – create separate images for boot and root partitions

  • disk – path to disk block device (e.g. /dev/mmcblk0) or None

pmb.install.blockdevice.create_and_mount_image(args: PmbArgs, size_boot, size_root, size_reserve, split=False)

Create a new image file, and mount it as /dev/install.

Parameters:
  • size_boot – size of the boot partition in MiB

  • size_root – size of the root partition in MiB

  • size_reserve – empty partition between root and boot in MiB (pma#463)

  • split – create separate images for boot and root partitions

pmb.install.blockdevice.mount_disk(path: Path)
Parameters:

path – path to disk block device (e.g. /dev/mmcblk0)

pmb.install.blockdevice.previous_install(path: Path)

Search the disk for possible existence of a previous installation of pmOS. We temporarily mount the possible pmOS_boot partition as /dev/diskp1 inside the native chroot to check the label from there. :param path: path to disk block device (e.g. /dev/mmcblk0)

pmb.install.format module

pmb.install.format.format(args: PmbArgs, layout, boot_label, root_label, disk)
Parameters:
  • layout – partition layout from get_partition_layout()

  • boot_label – label of the boot partition (e.g. “pmOS_boot”)

  • root_label – label of the root partition (e.g. “pmOS_root”)

  • disk – path to disk block device (e.g. /dev/mmcblk0) or None

pmb.install.format.format_and_mount_boot(args: PmbArgs, device, boot_label)
Parameters:
  • device – boot partition on install block device (e.g. /dev/installp1)

  • boot_label – label of the root partition (e.g. “pmOS_boot”)

When adjusting this function, make sure to also adjust ondev-prepare-internal-storage.sh in postmarketos-ondev.git!

pmb.install.format.format_and_mount_root(args: PmbArgs, device, root_label, disk)
Parameters:
  • device – root partition on install block device (e.g. /dev/installp2)

  • root_label – label of the root partition (e.g. “pmOS_root”)

  • disk – path to disk block device (e.g. /dev/mmcblk0) or None

pmb.install.format.format_luks_root(args: PmbArgs, device)
Parameters:

device – root partition on install block device (e.g. /dev/installp2)

pmb.install.format.get_root_filesystem(args: PmbArgs)
pmb.install.format.install_fsprogs(filesystem)

Install the package required to format a specific filesystem.

pmb.install.format.prepare_btrfs_subvolumes(args: PmbArgs, device, mountpoint)

Create separate subvolumes if root filesystem is btrfs. This lets us do snapshots and rollbacks of relevant parts of the filesystem. /var contains logs, VMs, containers, flatpaks; and shouldn’t roll back, /root is root’s home directory and shouldn’t roll back, /tmp has temporary files, snapshotting them is unnecessary, /srv contains data for web and FTP servers, and shouldn’t roll back, /snapshots should be a separate subvol so that changing the root subvol doesn’t affect snapshots

pmb.install.losetup module

pmb.install.losetup.detach_all()

Detach all loop devices used by pmbootstrap

pmb.install.losetup.device_by_back_file(back_file: Path) Path

Get the /dev/loopX device that points to a specific image file.

pmb.install.losetup.init()
pmb.install.losetup.mount(img_path: Path)
Parameters:

img_path – Path to the img file inside native chroot.

pmb.install.losetup.umount(img_path: Path)
Parameters:

img_path – Path to the img file inside native chroot.

pmb.install.partition module

pmb.install.partition.partition(args: PmbArgs, layout, size_boot, size_reserve)

Partition /dev/install and create /dev/install{p1,p2,p3}: * /dev/installp1: boot * /dev/installp2: root (or reserved space) * /dev/installp3: (root, if reserved space > 0)

When adjusting this function, make sure to also adjust ondev-prepare-internal-storage.sh in postmarketos-ondev.git!

Parameters:
  • layout – partition layout from get_partition_layout()

  • size_boot – size of the boot partition in MiB

  • size_reserve – empty partition between root and boot in MiB (pma#463)

pmb.install.partition.partition_cgpt(args: PmbArgs, layout, size_boot, size_reserve)

This function does similar functionality to partition(), but this one is for ChromeOS devices which use special GPT.

Parameters:
  • layout – partition layout from get_partition_layout()

  • size_boot – size of the boot partition in MiB

  • size_reserve – empty partition between root and boot in MiB (pma#463)

pmb.install.partition.partitions_mount(device: str, layout, disk: Path | None)

Mount blockdevices of partitions inside native chroot :param layout: partition layout from get_partition_layout() :param disk: path to disk block device (e.g. /dev/mmcblk0) or None

pmb.install.recovery module

pmb.install.recovery.create_zip(args: PmbArgs, chroot: Chroot, device: str)

Create android recovery compatible installer zip.

pmb.install.ui module

pmb.install.ui.get_groups(config: Config) list[str]

Get all groups to which the user additionally must be added. The list of groups are listed in _pmb_groups of the UI and UI-extras package.

Returns:

list of groups, e.g. [“feedbackd”, “udev”]

Module contents