pmb.config/install: add flexible provider selection for "pmbootstrap init"
The "provider selection" for pmbootstrap init
added in this MR
is a flexible way to offer UI/device-specific configuration options
in pmbootstrap init
, without hardcoding them in pmbootstrap.
Instead, the options are defined entirely in pmaports using APK's
virtual package provider mechanism. The code in pmbootstrap searches
for available providers and displays them together with their pkgdesc
.
There are many possible use cases for this but I have tested two so far:
-
Selecting root provider (sudo vs doas). This can be defined entirely in postmarketos-base, without having to handle this specifically in pmbootstrap.
$ pmbootstrap init [...] Available providers for postmarketos-root (2): * sudo: Use sudo to run root commands (**default**) * doas: Use doas (minimal replacement for sudo) to run root commands (Note: Does not support all functionality of sudo) Provider [default]: ...
pmaports MR: https://gitlab.com/postmarketOS/pmaports/-/merge_requests/2623
-
Device-specific options. My main motivation for working on this feature is a new configuration option for the MSM8916-based devices. It allows more control about which firmware to enable:
$ pmbootstrap init [...] Available providers for soc-qcom-msm8916-rproc (3): * all: Enable all remote processors (audio goes through modem) (**default**) * no-modem: Disable only modem (audio bypasses modem, ~80 MiB more RAM) * none: Disable all remote processors (no WiFi/BT/modem, ~90 MiB more RAM) Provider [default]: ...
pmaports MR: https://gitlab.com/postmarketOS/pmaports/-/merge_requests/2632
The configuration prompts show up dynamically by defining
_pmb_select="<virtual packages>"
in postmarketos-base, a UI PKGBUILD
or the device APKBUILD. Selecting default
(just pressing enter)
means that no provider is selected. This allows APK to choose it
automatically based on the provider_priority
. It also provides
compatibility with existing installation; APK will just choose the
default provider when upgrading. The selection can still be changed
after installation by installing another provider using "apk".
Note that at the end this is just a more convenient interface for the
already existing "extra packages" prompt. When using pmbootstrap in
automated scripts the providers (e.g. postmarketos-root-doas
) can be
simply selected through the existing extra_packages
option.