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/6475
This commit is contained in:
Pablo Correa Gómez
2025-05-15 10:22:03 +02:00
parent f1b840646c
commit a00d027b40
2 changed files with 12 additions and 3 deletions
@@ -3,7 +3,7 @@
# pmbootstrap installs this, if systemd is selected in "pmbootstrap init".
pkgname=postmarketos-base-systemd
pkgver=39
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="
+9 -2
View File
@@ -1,6 +1,6 @@
pkgname=postmarketos-base
pkgver=44
pkgrel=1
pkgrel=2
pkgdesc="Meta package for minimal postmarketOS base"
url="https://postmarketos.org"
arch="noarch"
@@ -94,6 +94,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"
@@ -144,7 +149,8 @@ ssh() {
}
openrc() {
install_if="$pkgname=$pkgver-r$pkgrel openrc"
provides="$pkgname-init"
provider_priority=10
install="$subpkgname.post-install $subpkgname.post-upgrade"
replaces="
busybox-openrc
@@ -153,6 +159,7 @@ openrc() {
zram-init-openrc
"
depends="
!systemd
eudev-openrc
logbookd
logbookd-openrc