pmb.config package¶
Submodules¶
pmb.config.init module¶
- pmb.config.init.ask_build_pkgs_on_install(default: bool) bool ¶
- pmb.config.init.ask_for_additional_options(config)¶
- pmb.config.init.ask_for_channel(config: Config)¶
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)¶
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)¶
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)¶
- pmb.config.init.ask_for_keymaps(config: Config, deviceinfo: Deviceinfo)¶
- pmb.config.init.ask_for_locale(current_locale: str)¶
- pmb.config.init.ask_for_mirror()¶
- pmb.config.init.ask_for_provider_select(apkbuild, providers_cfg)¶
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, providers_cfg)¶
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(default: bool) bool ¶
- pmb.config.init.ask_for_systemd(config: Config, ui)¶
- pmb.config.init.ask_for_timezone()¶
- pmb.config.init.ask_for_ui(deviceinfo)¶
- pmb.config.init.ask_for_ui_extras(config: Config, ui)¶
- pmb.config.init.ask_for_username(default_user: str)¶
Ask for a reasonable username for the non-root user.
- Returns:
the username
- pmb.config.init.ask_for_work_path(args: PmbArgs)¶
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.frontend(args: PmbArgs)¶
- pmb.config.init.get_locales()¶
- pmb.config.init.require_programs()¶
pmb.config.load module¶
pmb.config.merge_with_args 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)¶
- pmb.config.pmaports.check_version_pmbootstrap(min_ver)¶
- pmb.config.pmaports.clone()¶
- pmb.config.pmaports.init()¶
- pmb.config.pmaports.install_githooks()¶
- pmb.config.pmaports.read_config_channel()¶
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)¶
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.save module¶
Save the config object to the specified path.
IMPORTANT: The global config (available via get_context().config) has invocation arguments merged into it. Do NOT call save() with the global config object.
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.cfg, because pmbootstrap.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)¶
Save the chroot initialization data in $WORK/workdir.cfg.
- pmb.config.workdir.chroots_outdated(chroot: Chroot | None = None)¶
Check if init dates from workdir.cfg indicate that any chroot is outdated.
- Parameters:
suffix – only check a specific chroot suffix
- Returns:
True if any of the chroots are outdated and should be zapped, 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: Set to “-dtb” if deviceinfo_append_dtb is set, otherwise “” $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.