From 4515a2c6ead0cbb164de1c1cbbbe68ebf584b923 Mon Sep 17 00:00:00 2001 From: Caleb Connolly Date: Thu, 20 Feb 2025 12:24:23 +0000 Subject: [PATCH] device-postmarketos-trailblazer: move most depends to recommends None of the devices running trailblazer actually need all these daemons or firmware. Move almost everything to recommends so that users can free up space and so that customised images can be built with --no-recommends. Since there are some folks already using trailblazer who DO depend on these packages, let's try letting users know about this at least. Signed-off-by: Caleb Connolly Part-of: https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/6239 --- .../device-postmarketos-trailblazer/APKBUILD | 17 +++-- ...evice-postmarketos-trailblazer.pre-upgrade | 70 +++++++++++++++++++ 2 files changed, 81 insertions(+), 6 deletions(-) create mode 100644 device/testing/device-postmarketos-trailblazer/device-postmarketos-trailblazer.pre-upgrade diff --git a/device/testing/device-postmarketos-trailblazer/APKBUILD b/device/testing/device-postmarketos-trailblazer/APKBUILD index 845683e85..de16b2f10 100644 --- a/device/testing/device-postmarketos-trailblazer/APKBUILD +++ b/device/testing/device-postmarketos-trailblazer/APKBUILD @@ -4,30 +4,35 @@ pkgname=device-postmarketos-trailblazer pkgdesc="postmarketOS Trailblazer generic ARM64" pkgver=12 -pkgrel=2 +pkgrel=3 url="https://postmarketos.org" license="MIT" arch="aarch64" options="!check !archcheck" depends=" postmarketos-base - soc-qcom-qbootctl + systemd-boot +" +_pmb_recommends=" linux-firmware-qcom linux-firmware-ath10k linux-firmware-ath11k linux-firmware-ath12k linux-firmware-qca linux-firmware-rtw88 + firmware-siliconlabs-rs9116 + firmware-brcm43752 + + soc-qcom-qbootctl rmtfs pd-mapper tqftpserv bootmac - systemd-boot - firmware-siliconlabs-rs9116 - firmware-brcm43752 - dtbloader woa-firmware-yoinker + + dtbloader " +install="$pkgname.pre-upgrade" makedepends="devicepkg-dev" subpackages=" $pkgname-kernel-next:kernel_next diff --git a/device/testing/device-postmarketos-trailblazer/device-postmarketos-trailblazer.pre-upgrade b/device/testing/device-postmarketos-trailblazer/device-postmarketos-trailblazer.pre-upgrade new file mode 100644 index 000000000..1cfb7af12 --- /dev/null +++ b/device/testing/device-postmarketos-trailblazer/device-postmarketos-trailblazer.pre-upgrade @@ -0,0 +1,70 @@ +#!/bin/sh -e +# +# Handle packages that were moved from depends to _pmb_recommends by nuking +# apk from orbit, adding the packages to world and then re-running it. + +# The old version of the package is passed in as the second argument +OLD_VER="$2" +NEW_VER="$1" +old_ver_less() { + [ "$(apk version -t "$OLD_VER" "$1")" = "<" ] +} + +# For a given upgrade, ensure that certain package are in +# the world file, otherwise fail with a nice message letting +# the user know how to manually add them +ensure_installed() { + # $1: version to check + # $@: list of packages + local missing ver cmd + + ver="$1" + shift + + # Only applicable if upgrading from a version older + # than $ver, otherwise we're all good here. + if ! old_ver_less "$ver"; then + return + fi + + # Determine which packages in our list aren't in /etc/apk/world + # these packages were moved from depends to _pmb_recommends and + # must be manually installed to ensure we don't break booting + missing="$(printf '%s\n' "$@" | grep -v -f /etc/apk/world | tr '\n' ' ')" + # None missing? then we're good! + [[ -n "$missing" ]] || return + + printf '\n\n' + printf 'ERROR: some packages that your device might need are no longer installed\n' + printf ' automatically. To ensure your device continues to function as expected\n' + printf ' plese run the following command:\n\n' + printf ' apk add ' + printf '%s ' $missing + printf '\n' + + return 0 +} + +# We migrated everything that isn't required on ALL +# platforms from depends to recommends in 12-r2. Since +# we can't know which packages are in use, the user must +# manually add them all to their world file for now. They +# can uninstall any unused ones after the upgrade at their +# own risk. +ensure_installed 12-r2 \ + linux-firmware-qcom \ + linux-firmware-ath10k \ + linux-firmware-ath11k \ + linux-firmware-ath12k \ + linux-firmware-qca \ + linux-firmware-rtw88 \ + firmware-siliconlabs-rs9116 \ + firmware-brcm43752 \ + soc-qcom-qbootctl \ + rmtfs \ + pd-mapper \ + tqftpserv \ + bootmac \ + woa-firmware-yoinker \ + dtbloader +