systemd: add stub systemd-apk-macros to get packages building

Since we have cyclical dependencies we need this stub for everything to
build, once the binary repo is updated to drop all uses we can remove
it.

This is now all handled in abuild directly

Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
Part-of: https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/6334
This commit is contained in:
Caleb Connolly
2025-03-22 17:10:18 +00:00
parent 8bd95745c2
commit 5f74dc3f60
2 changed files with 6 additions and 79 deletions
+2 -2
View File
@@ -121,8 +121,8 @@ subpackages="
source="
https://gitlab.postmarketos.org/postmarketOS/systemd/-/archive/$_pkgver/systemd-$_pkgver.tar.gz
systemd-apk-macros.sh
wired.network
systemd-apk-macros.sh
"
builddir="$srcdir/systemd-$_pkgver"
@@ -424,6 +424,6 @@ dev() {
sha512sums="
3cd75d5ba29a3994230ecbe16ea106d4fe05d7d76e7cd9b9a6a63177f09d8c362c055a1fea49e6c9a10a949afc07a6c75fe75dad2bd302d94e41a81f8ddb2a15 systemd-musl-v256.11-split-usr.tar.gz
2f9ec875de67fc4bb401bebea88653cd34c22787a26a8122233fbb761bfbf190be72cfa0c26a433c30d703ee1e10489787d75492f0e1a76cbd5f6601e7e23d49 systemd-apk-macros.sh
81c897fed8a3fbfb67ec591b2398a5d65e4af1b3ef379376c157c98d71f085b707f8ebc896d5571a94f99f8fc84fd6b43e3b879ca9b0d57fc6c4596034c7a777 wired.network
cc1c8f00a0ff1c94fcebe0e6d48b3d1a74c51b9d86bf255762cecda4b4d0c08e313f817aaaa301f41133eaf73c525e36c0f48659b263a7ed990080de9f3cec6c systemd-apk-macros.sh
"
@@ -1,88 +1,15 @@
#!/bin/sh
# systemd.preset reference:
# https://www.freedesktop.org/software/systemd/man/latest/systemd.preset.html
# Systemd macro file for RPM:
# https://github.com/systemd/systemd/blob/main/src/rpm/macros.systemd.in
# https://github.com/systemd/systemd/blob/main/src/rpm/systemd-update-helper.in
SYSTEMD_BUS_TIMEOUT=5s
# This is a stub to work around cyclical dependencies in CI while we migrate away from this script.
is_systemd_running() {
[ -d "/run/systemd/running" ]
return 1
}
# runs `systemctl preset` on the list of services of the given type
# $1: type of service, supported values: "user" or "system"
# $@: list of service unit names, as you'd pass to `systemctl preset`
# FIXME: this may not work with wildcards in unit names, and other input you
# can give to the preset command
systemd_service_post_install() {
local type="$1"
shift
if [ -z "$type" ]; then
echo "service type (user or service) not given"
exit 1
fi
if ! command -v systemctl > /dev/null; then
echo "systemctl is not available"
exit 1
fi
case "$type" in
"user")
systemctl --no-reload preset --global "$@"
;;
"system")
systemctl --no-reload preset "$@" || true
;;
*)
echo "unsupported service type: $type"
exit 1
esac
echo "NOP systemd_service_post_install"
}
# disables the list of services of the given type
# $1: type of service, supported values: "user" or "system"
# $@: list of service unit names, as you'd pass to `systemctl disable`
# FIXME: this may not work with wildcards in unit names, and other input you
# can give to the disable command
systemd_service_pre_deinstall() {
local type="$1"
shift
if [ -z "$type" ]; then
echo "service type (user/service) not given"
exit 1
fi
if ! command -v systemctl > /dev/null; then
echo "systemctl is not available"
exit 1
fi
case "$type" in
"user")
systemctl --global disable --no-warn "$@"
if is_systemd_running; then
local users
users=$(systemctl list-units 'user@*' --legend=no | sed -n -r 's/.*user@([0-9]+).service.*/\1/p')
for user in $users; do
systemctl --user -M "$user@" disable --now --no-warn "$@" &
done
wait
fi
;;
"system")
if is_systemd_running; then
systemctl --no-reload disable --now --no-warn "$@"
else
systemctl --no-reload disable --no-warn "$@"
fi
;;
*)
echo "unsupported service type: $type"
exit 1
esac
echo "NOP systemd_service_pre_deinstall"
}