postmarketos-base{-systemd}: provide postmarketos-base-init

Why is this needed?

To be able to test the usr-merge downstream we need to stop
depending on alpine-baselayout. For that, we need to stop depending on
alpine-base. This is a first step to create a "provides" solution
downstream between openrc and systemd systems, so that in a follow-up
commit we can recreate alpine-base downstream without the hard-coded
openrc dependency. The virtual instead of a versioned dependency means
that:
* In theory systemd and openrc could be installed in parallel. In
  practice we avoid that with !openrc in the systemd package and
  !systemd in the postmarketos-base-openrc one. There is a lot more
  work required with provides (both upstream and downstream) regarding
  things like elogind and eudev to be able to even have them
  package-wise ready to be installed in parallel
* There must always be one installed. Here we have 3 scenarios:
  * pmbootstrap install where pmbootstrap will decide which one
  * update from existing install. The virtual makes sure that APK
    won't remove the local package because versions changed
  * Manual APK work, where the provider_priority or the user will
    choose

How does this work? Hypothesis:
* openrc upgrades: the postmarketos-base-openrc remains installed,
  moves from being an "install_if", to be there because it fulfills
  the postmarketos-base-init requirements.
* systemd upgrades: postmarketos-base-systemd is still in
  /etc/apk/world, and it fulfills the new dependency in
  postmarketos-base. Nothing happens.
* openrc installs: pmbootstrap will choose one of
  postmarketos-base-openrc and postmarketos-base-systemd... But which?
  The one with the higher version?
* systemd installs: postmarketos-base-systemd is installed before
  anything else is. That means, postmarketos-base-init will already
  be satisfied when postmarketos-base gets installed, and openrc will
  not be installed

Part-of: https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/6375
This commit is contained in:
Pablo Correa Gómez 2025-04-03 15:02:18 +02:00 committed by Pablo Correa Gómez
parent 53500854fe
commit 9bcdec3337
No known key found for this signature in database
GPG key ID: 7A342565FF635F79
2 changed files with 13 additions and 3 deletions

View file

@ -3,7 +3,7 @@
# pmbootstrap installs this, if systemd is selected in "pmbootstrap init".
pkgname=postmarketos-base-systemd
pkgver=37
pkgrel=0
pkgrel=1
pkgdesc="Meta package for running postmarketOS with systemd"
url="https://postmarketos.org"
arch="noarch"
@ -38,6 +38,8 @@ depends="
systemd-timesyncd
tzdata
"
provides="postmarketos-base-init"
provider_priority=100
replaces="alpine-baselayout postmarketos-base systemd systemd-logind"
replaces_priority=100
install="

View file

@ -1,6 +1,6 @@
pkgname=postmarketos-base
pkgver=43
pkgrel=1
pkgrel=2
pkgdesc="Meta package for minimal postmarketOS base"
url="https://postmarketos.org"
arch="noarch"
@ -90,6 +90,11 @@ prepare() {
}
package() {
# pmos-base-init provided by a subpackage in this APKBUILD, and it may not
# exist when this is evaluated at the top level. It's moved into this
# function to work around it.
depends="$depends postmarketos-base-init"
local i
for i in $_source440; do
install -Dm440 "$srcdir/$(flatpath "$i")" "$pkgdir/$i"
@ -129,7 +134,8 @@ nftables_openrc() {
}
openrc() {
install_if="$pkgname=$pkgver-r$pkgrel openrc"
provides="$pkgname-init"
provider_priority=10
install="$subpkgname.post-install $subpkgname.post-upgrade"
replaces="
busybox-openrc
@ -138,9 +144,11 @@ openrc() {
zram-init-openrc
"
depends="
!systemd
eudev-openrc
logbookd
logbookd-openrc
openrc
openssh-server-common-openrc
udev-init-scripts-openrc
zram-init-openrc