From 9bcdec3337290fd0271aef4a7eca77a221d6b891 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20Correa=20G=C3=B3mez?= Date: Thu, 3 Apr 2025 15:02:18 +0200 Subject: [PATCH] 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 --- .../systemd/postmarketos-base-systemd/APKBUILD | 4 +++- main/postmarketos-base/APKBUILD | 12 ++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/extra-repos/systemd/postmarketos-base-systemd/APKBUILD b/extra-repos/systemd/postmarketos-base-systemd/APKBUILD index 0e46d9efa..00421dd15 100644 --- a/extra-repos/systemd/postmarketos-base-systemd/APKBUILD +++ b/extra-repos/systemd/postmarketos-base-systemd/APKBUILD @@ -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=" diff --git a/main/postmarketos-base/APKBUILD b/main/postmarketos-base/APKBUILD index fffe165f9..8e971cad6 100644 --- a/main/postmarketos-base/APKBUILD +++ b/main/postmarketos-base/APKBUILD @@ -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