pmb.commands package

Submodules

pmb.commands.apkbuild_parse module

pmb.commands.apkbuild_parse.apkbuild_parse(packages: Sequence[str]) → None

pmb.commands.apkindex_parse module

pmb.commands.apkindex_parse.apkindex_parse(index: Apkindex, package: str | list[str]) → None

pmb.commands.aportgen module

pmb.commands.aportgen.aportgen(package_list: list[str], fork_alpine: bool, fork_alpine_retain_branch: bool) → None

pmb.commands.bootimg_analyze module

pmb.commands.bootimg_analyze.bootimg_analyze(path: Path) → None

pmb.commands.build module

pmb.commands.build.build(packages: list[str], arch: Arch | None, code_src: str, use_envkernel: bool, use_strict: bool) → None

pmb.commands.build_init module

pmb.commands.build_init.build_init(chroot: Chroot) → None

pmb.commands.chroot module

pmb.commands.chroot.chroot(add: str, chroot: Chroot, chroot_usb: bool, command: str, install_blockdev: bool, output: RunOutputTypeDefault, sector_size: int | None, user: str, xauth: bool) → None

pmb.commands.checksum module

pmb.commands.checksum.checksum(packages: Collection[str], do_changed: bool, do_verify: bool) → None

pmb.commands.ci module

pmb.commands.ci.ci(scripts: str, all: bool, fast: bool) → None

pmb.commands.config module

pmb.commands.config.config(name: str | None, value: str | None, reset: bool, configpath: Path) → None

pmb.commands.export module

pmb.commands.export.export(target: Path, autoinstall: bool, odin_flashable_tar: bool) → None
pmb.commands.export.odin(device: str, folder: Path) → None

Create Odin flashable tar file with kernel and initramfs for devices configured with the flasher method ‘heimdall-isorec’ and with boot.img for devices with ‘heimdall-bootimg’

Create convenience symlinks to the rootfs and boot files.

pmb.commands.flasher module

pmb.commands.flasher.flasher(action: str, autoinstall: bool, cmdline: str | None, flash_method: str, no_reboot: bool, partition: str | None, resume: bool) → None

pmb.commands.index module

pmb.commands.index.index() → None

pmb.commands.initfs module

pmb.commands.initfs.initfs(action: str, hook: str | None) → None

pmb.commands.install module

pmb.commands.install.install(add: str, android_recovery_zip: bool, cipher: str, cmdline: str | None, filesystem: str, full_disk_encryption: bool, disk: Path | None, install_base: bool, install_cgpt: bool, install_local_pkgs: bool, install_recommends: bool, iter_time: str, no_fde: bool, no_firewall: bool, no_image: bool, no_reboot: bool, no_sshd: bool, partition: str | None, password: str, recovery_flash_kernel: bool, recovery_install_partition: str, resume: bool, rsync: bool, sector_size: int | None, single_partition: bool, sparse: bool | None, split: bool | None, verbose: bool, zap: bool) → None

pmb.commands.kconfig module

class pmb.commands.kconfig.KConfigCheck(details: bool, file: str | None, pkgname: str | list[str], keep_going: bool, categories: list[str])

Bases: object

run() → None
class pmb.commands.kconfig.KConfigEdit(pkgname: str, arch: Arch | None, use_xconfig: bool, use_nconfig: bool, fragment: str | None = None)

Bases: object

run() → None
class pmb.commands.kconfig.KConfigGenerate(pkgname: str | list[str], arch: Arch | None)

Bases: object

run() → None
class pmb.commands.kconfig.KConfigMigrate(pkgname: str | list[str], arch: Arch | None)

Bases: object

run() → None

pmb.commands.log module

pmb.commands.log.log(clear_log: bool, lines: int) → None

pmb.commands.netboot module

pmb.commands.netboot.netboot(action_netboot: str, do_replace: bool) → None
pmb.commands.netboot.start_nbd_server(device: str, replace: bool, ip: str = '172.16.42.2', port: int = 9999) → None

Start nbd server in chroot_native with pmOS rootfs.

Parameters:
  • ip – IP address to serve nbd server for

  • port – port of nbd server

pmb.commands.newapkbuild module

pmb.commands.newapkbuild.newapkbuild(folder: str, pass_through: list[str], pkgname: str, pkgname_pkgver_srcurl: str) → None

pmb.commands.pkgrel_bump module

pmb.commands.pkgrel_bump.pkgrel_bump(packages: list[str], dry_run: bool, auto: bool) → None

pmb.commands.pkgver_bump module

pmb.commands.pkgver_bump.pkgver_bump(packages: list[str]) → None

pmb.commands.pull module

pmb.commands.pull.pull() → None

pmb.commands.qemu module

pmb.commands.qemu.command_qemu(config: Config, arch: Arch, qemu_audio: str | None, qemu_cpu: str | None, qemu_display: str, memory_size: int, port_ssh: int, use_host_qemu: bool, use_qemu_gl: bool, use_qemu_kvm: bool, use_qemu_tablet: bool, img_path: Path, img_path_2nd: Path | None = None) → tuple[list[str | Path], dict[str, Path | str]]

Generate the full qemu command with arguments to run postmarketOS

pmb.commands.qemu.create_second_storage(size: str, device: str) → Path

Generate a second storage image if it does not exist.

Returns:

path to the image or None

pmb.commands.qemu.install_depends(arch: Arch) → None

Install any necessary qemu dependencies in native chroot

pmb.commands.qemu.install_efi_image(arch: Arch) → None
pmb.commands.qemu.qemu(qemu_audio: str | None, qemu_cpu: str | None, qemu_display: str, memory_size: int, image_size: str | None, second_storage: str | None, port_ssh: int, use_host_qemu: bool, use_qemu_gl: bool, use_qemu_kvm: bool, use_qemu_tablet: bool) → None

Run a postmarketOS image in qemu

pmb.commands.qemu.resize_image(img_size_new: str, img_path: Path) → None

Truncates an image to a specific size. The value must be larger than the current image size, and it must be specified in MiB or GiB units (powers of 1024).

Parameters:
  • img_size_new – new image size in M or G

  • img_path – the path to the image

pmb.commands.qemu.system_image(device: str) → Path

Returns path to rootfs for specified device. In case that it doesn’t exist, raise and exception explaining how to generate it.

pmb.commands.qemu.which_qemu(arch: Arch) → str

Finds the qemu executable or raises an exception otherwise

pmb.commands.repo_missing module

pmb.commands.repo_missing.repo_missing(arch: Arch | None) → None

pmb.commands.shutdown module

pmb.commands.shutdown.shutdown() → None

pmb.commands.sideload module

class pmb.commands.sideload.SshRemote(user, host, port)

Bases: NamedTuple

host: str

Alias for field number 1

port: str

Alias for field number 2

user: str

Alias for field number 0

pmb.commands.sideload.scp_abuild_key(remote: SshRemote) → None

Copy the building key of the local installation to the target device, so it trusts the apks that were signed here.

Parameters:
  • user – target device ssh username

  • host – target device ssh hostname

  • port – target device ssh port

pmb.commands.sideload.sideload(user: str, host: str, port: str, arch: Arch | None, copy_key: bool, strict: bool, pkgnames: list[str], allow_untrusted: bool) → None

Build packages if necessary and install them via SSH.

By default sideload will use the list of packages already installed on the device to determine if subpackages should also be installed, this is useful to ensure that service files and other relevant subpackages also get updated (and don’t get removed due to version mismatches). This behaviour can be disabled with –strict.

Network connectivity is checked using ‘nm-online’ to avoid waiting for apk to timeout.

Parameters:
  • user – target device ssh username

  • host – target device ssh hostname

  • port – target device ssh port

  • arch – target device architecture

  • copy_key – copy the abuild key too

  • strict – don’t automatically include relevant subpackages

  • pkgnames – list of pkgnames to be built

  • allow_untrusted – whether to add –allow-untrusted to the apk add invocation

pmb.commands.sideload.ssh_find_arch(remote: SshRemote) → Arch

Connect to a device via ssh and query the architecture.

pmb.commands.sideload.ssh_install_apks(remote: SshRemote, paths: list[Path], install_offline: bool, allow_untrusted: bool) → None

Copy binary packages via SCP and install them via SSH.

Parameters:
  • user – target device ssh username

  • host – target device ssh hostname

  • port – target device ssh port

  • paths – list of absolute paths to locally stored apks

pmb.commands.sideload.ssh_list_packages(remote: SshRemote) → set[str]
pmb.commands.sideload.ssh_make_cmd(remote: SshRemote, cmd: str) → list[Path | str]

pmb.commands.stats module

pmb.commands.stats.stats(arch: Arch | None) → None

pmb.commands.status module

pmb.commands.status.print_channel() → None
pmb.commands.status.print_device(config: Config) → None
pmb.commands.status.print_status() → None
pmb.commands.status.print_status_line(key: str, value: str) → None
pmb.commands.status.print_systemd(config: Config) → None
pmb.commands.status.print_ui(config: Config) → None
pmb.commands.status.status() → NoReturn

pmb.commands.test module

pmb.commands.test.apkindex_parse_all() → None
pmb.commands.test.test(action: str) → None

pmb.commands.update module

pmb.commands.update.update(arch: Arch | None, non_existing: str) → None

pmb.commands.work_migrate module

pmb.commands.work_migrate.work_migrate() → None

pmb.commands.zap module

pmb.commands.zap.zap(dry: bool, http: bool, distfiles: bool, pkgs_local: bool, pkgs_local_mismatch: bool, pkgs_online_mismatch: bool, rust: bool, netboot: bool) → None

Module contents

pmb.commands.run_command(args: PmbArgs) → None