pmaports/temp/akms/akms.trigger
Antoine Martin e927f76a7a
temp/akms: add with patches making sandboxing optional
AKMS builds modules in a sandbox using bubblewrap. Bubblewrap
unfortunately does not work in chroot environment, thus breaking
pmbootstrap. While a PR has been proposed upstream, history shows that
upstream takes a while to consider PRs. Thus, to unblock usage of AKMS,
this adds a patched version that allows disabling of sandbox using
`--no-sandbox` argument or by adding `use_sandbox=false` to
`/etc/akms.conf`. When building in chroot environment, sandboxing is
automatically disabled.

The aport handles conflicts with akms by setting `pkgver=9999$_pkgver`,
thus always overriding Alpine's package.

Upstream PR: https://github.com/jirutka/akms/pull/19

Part-of: https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/6604
2025-06-16 08:46:13 -07:00

34 lines
916 B
Bash

#!/bin/sh
# shellcheck disable=SC1090
CFG_FILE='/etc/akms.conf'
if ! [ -f "$CFG_FILE" ]; then
echo "$CFG_FILE does not exist, skipping akms trigger" >&2
exit 0
fi
. "$CFG_FILE"
# shellcheck disable=SC2154
case "$disable_trigger" in
yes | true | 1) exit 0;;
esac
for srcdir in "$@"; do
[ -f "$srcdir"/AKMBUILD ] || continue
if [ "$(stat -c %d:%i /)" != "$(stat -c %d:%i /proc/1/root/.)" ]; then
echo ">>> AKMS is running in chroot environment, disabling overlay and sandboxing"
echo ">>> Please make sure module build dependencies are already installed"
akms install --no-overlay --no-sandbox "$srcdir"
else
echo ">>> AKMS running in sandbox"
akms install "$srcdir"
fi
done
# Triggers exiting with non-zero status cause headaches. APK marks the
# corresponding package and the world as broken and starts exiting with
# status 1 even after e.g. successful installation of a new package.
exit 0