init: systemd: fix always switching pma to edge

Fix that pmbootstrap doesn't recognize v25.06 with systemd enabled as
valid channel and suggests switching to edge. This happens because
pmb.config.pmaports.read_config() unconditionally prepends "systemd-"
before the channel name if systemd is enabled, even though the init code
doesn't expect this.

The result is when running 'yes "" | pmbootstrap init' (as we do in BPO
and CI), pmbootstrap attempts to replace the correctly checked out
v25.06 branch with edge:

Fix for:
  [20:36:37] Available (12):
  [20:36:37] * edge: Rolling release / Most devices / Occasional breakage: https://postmarketos.org/edge
  [20:36:37] * v25.06: Upcoming stable release (DO NOT USE)
  [20:36:37] * v24.12: Latest release / Recommended for best stability
  [20:36:37] Channel [edge]:
  [20:36:37] Currently checked out branch 'v25.06' of pmaports.git is on channel 'v25.06'.
  [20:36:37] Switching to branch 'master' on channel 'edge'...
  …
  ERROR: pmbootstrap switched to the wrong branch: master

Related: https://builds.sr.ht/~postmarketos/job/1497179#task-bpo_setup-23

Part-of: https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/merge_requests/2613
This commit is contained in:
Oliver Smith 2025-05-30 10:53:33 +02:00
parent c39ac5fe99
commit 26c310f374
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB
2 changed files with 6 additions and 4 deletions

View file

@ -214,7 +214,7 @@ def ask_for_channel(config: Config) -> str:
# Otherwise, if valid: channel from pmaports.cfg of current branch
# The actual channel name is not saved in pmbootstrap_v3.cfg, because then
# we would need to sync it with what is checked out in pmaports.git.
default = pmb.config.pmaports.read_config()["channel"]
default = pmb.config.pmaports.read_config(add_systemd_prefix=False)["channel"]
choices = channels_cfg["channels"].keys()
if config.is_default_channel or default not in choices:
default = channels_cfg["meta"]["recommended"]