pmb.config package¶
Submodules¶
pmb.config.file module¶
pmb.config.init module¶
- pmb.config.init.ask_build_pkgs_on_install(default: bool) bool ¶
- pmb.config.init.ask_for_channel(config: Config) str ¶
Ask for the postmarketOS release channel. The channel dictates, which pmaports branch pmbootstrap will check out, and which repository URLs will be used when initializing chroots.
- Returns:
channel name (e.g. “edge”, “v21.03”)
- pmb.config.init.ask_for_device(context: Context) tuple[str, bool, str] ¶
Prompt for the device vendor, model, and kernel.
- Returns:
Tuple consisting of: (device, device_exists, kernel) * device: “<vendor>-<codename>” string for device * device_exists: bool indicating if device port exists in repo * kernel: type of kernel (downstream, etc)
- pmb.config.init.ask_for_device_kernel(config: Config, device: str) str ¶
Ask for the kernel that should be used with the device.
- Parameters:
device – code name, e.g. “lg-mako”
- Returns:
None if the kernel is hardcoded in depends without subpackages
- Returns:
kernel type (“downstream”, “stable”, “mainline”, …)
- pmb.config.init.ask_for_hostname(default: str | None, device: str) str ¶
- pmb.config.init.ask_for_keymaps(config: Config, deviceinfo: Deviceinfo) str ¶
- pmb.config.init.ask_for_locale(current_locale: str) str ¶
- pmb.config.init.ask_for_mirror() str ¶
- pmb.config.init.ask_for_provider_select(apkbuild: dict[str, Any], providers_cfg: dict[str, str]) None ¶
Ask for selectable providers that are specified using “_pmb_select” in a APKBUILD.
- Parameters:
apkbuild – the APKBUILD with the _pmb_select
providers_cfg – the configuration section with previously selected providers. Updated with new providers after selection
- pmb.config.init.ask_for_provider_select_pkg(pkgname: str, providers_cfg: dict[str, str]) None ¶
Look up the APKBUILD for the specified pkgname and ask for selectable providers that are specified using “_pmb_select”.
- Parameters:
pkgname – name of the package to search APKBUILD for
providers_cfg – the configuration section with previously selected providers. Updated with new providers after selection
- pmb.config.init.ask_for_ssh_keys(ssh_key_glob: str, default: bool) bool ¶
- pmb.config.init.ask_for_systemd(config: Config, ui: str) SystemdConfig ¶
- pmb.config.init.ask_for_timezone() str ¶
- pmb.config.init.ask_for_ui(deviceinfo: Deviceinfo) str ¶
- pmb.config.init.ask_for_username(default_user: str) str ¶
Ask for a reasonable username for the non-root user.
- Returns:
the username
- pmb.config.init.ask_for_work_path(default: Path | None) tuple[Path, bool] ¶
Ask for the work path, until we can create it (when it does not exist) and write into it.
- Returns:
(path, exists) * path: is the full path, with expanded ~ sign * exists: is False when the folder did not exist before we tested whether we can create it
- pmb.config.init.get_locales() list[str] ¶
- pmb.config.init.require_programs() None ¶
pmb.config.other module¶
pmb.config.pmaports module¶
- pmb.config.pmaports.all_channels() list[str] ¶
Get a list of all channels for all pkgrepos.
- pmb.config.pmaports.check_version_pmaports(real: str) None ¶
- pmb.config.pmaports.check_version_pmbootstrap(min_ver: str) None ¶
- pmb.config.pmaports.clone() None ¶
- pmb.config.pmaports.init() None ¶
- pmb.config.pmaports.install_githooks() None ¶
- pmb.config.pmaports.read_config_channel() dict[str, str] ¶
Get the properties of the currently active channel in pmaports.git.
As specified in channels.cfg (https://postmarketos.org/channels.cfg).
- Returns:
{“description: …, “branch_pmaports”: …, “branch_aports”: …, “mirrordir_alpine”: …}
- pmb.config.pmaports.switch_to_channel_branch(channel_new: str) bool ¶
Checkout the channel’s branch in pmaports.git.
- Channel_new:
channel name (e.g. “edge”, “v21.03”)
- Returns:
True if another branch was checked out, False otherwise
pmb.config.sudo module¶
- pmb.config.sudo.which_sudo() str | None
Return a command required to run commands as root, if any.
Find whether sudo or doas is installed for commands that require root. Allows user to override preferred sudo with PMB_SUDO env variable.
pmb.config.workdir module¶
Save, read, verify workdir state related information in $WORK/workdir.cfg, for example the init dates of the chroots. This is not saved in pmbootstrap_v3.cfg, because pmbootstrap_v3.cfg is not tied to a specific work dir.
- pmb.config.workdir.chroot_check_channel(chroot: Chroot) bool ¶
Check the chroot channel against the current channel. Returns True if the chroot should be zapped (both that it needs zapping and the user has auto_zap_misconfigured_chroots enabled), False otherwise.
- pmb.config.workdir.chroot_save_init(suffix: Chroot) None ¶
Save the chroot initialization data in $WORK/workdir.cfg.
- pmb.config.workdir.chroots_outdated() list[Chroot] ¶
- pmb.config.workdir.chroots_outdated(chroot: Chroot) bool
Check if init dates from workdir.cfg indicate that any chroot is outdated.
- Parameters:
suffix – only check a specific chroot suffix
- Returns:
A list of all outdated chroots if chroot is None, if a specific chroot is given, instead it returns True if the chroot is outdated, False otherwise
- pmb.config.workdir.clean()¶
Remove obsolete data data from workdir.cfg.
- Returns:
None if workdir does not exist, True if config was rewritten, False if config did not change
Module contents¶
- pmb.config.flash_mount_bind = [PosixPath('/sys/bus/usb/devices'), PosixPath('/sys/dev'), PosixPath('/sys/devices'), PosixPath('/dev/bus/usb')]¶
Flasher abstraction. Allowed variables:
$BOOT: Path to the /boot partition $DTB: Name of device dtb without .dtb extension $FLAVOR: Backwards compatibility with old mkinitfs (pma#660) $IMAGE: Path to the combined boot/rootfs image $IMAGE_SPLIT_BOOT: Path to the (split) boot image $IMAGE_SPLIT_ROOT: Path to the (split) rootfs image $PARTITION_KERNEL: Partition to flash the kernel/boot.img to $PARTITION_ROOTFS: Partition to flash the rootfs to
Fastboot specific: $KERNEL_CMDLINE Heimdall specific: $PARTITION_INITFS uuu specific: $UUU_SCRIPT
- pmb.config.sudo(cmd: Sequence[Path | str]) Sequence[Path | str] ¶
Adapt a command to run as root.