install: openrc: fix installing alpine-base early

With recent changes we don't install alpine-base in the chroots anymore.
It still gets installed as postmarketos-base depends on it (for now,
this will change soon in master). But it is not guaranteed to be
installed before other packages which may run "rc-update" in their
postinst scripts.

Fix this by explicitly installing alpine-base early on during
"pmbootstrap install".

Fix for e.g. v24.12:pine64-pinephone:phosh images:

  (342/976) Installing eg25-manager-openrc (0.4.6-r5)
  (343/976) Installing device-pine64-pinephone-openrc (7-r0)
  Executing device-pine64-pinephone-openrc-7-r0.post-install
  lib/apk/exec/device-pine64-pinephone-openrc-7-r0.post-install: line 3: rc-update: not found
  ERROR: device-pine64-pinephone-openrc-7-r0.post-install: script exited with error 127

Related: https://builds.sr.ht/~postmarketos/job/1473669#task-img-743
Fixes: 12d125ab ("chroot: don't depende on alpine-base")

Part-of: https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/merge_requests/2585
This commit is contained in:
Oliver Smith 2025-04-18 10:25:34 +02:00
parent 9e8c4b2810
commit 6eb8cab84d
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB

View file

@ -1389,6 +1389,10 @@ def create_device_rootfs(args: PmbArgs, step: int, steps: int) -> None:
# when services are installed later
if pmb.config.other.is_systemd_selected(context.config):
pmb.chroot.apk.install(["postmarketos-base-systemd"], chroot)
else:
# Install alpine-base (which pulls in openrc related packages) early,
# so postinst scripts can run rc-update
pmb.chroot.apk.install(["alpine-base"], chroot)
# Install all packages to device rootfs chroot (and rebuild the initramfs,
# because that doesn't always happen automatically yet, e.g. when the user