pmaports/main/postmarketos-duranium/rootfs-usr-local-sbin-apk
Clayton Craft f61687b60d
main/postmarketos-duranium: support "self hosting"
This will allow folks to easily run mkosi, e.g. for building duranium
images. This makes duranium self-hosting.

There are several key changes in this patch:

- mkosi is added to the duranium developer tools sysext

- user qemu is added to the dev tools sysext (for binfmt+qemu)

- coreutils is added to the main pkg to work around a conflict that Alpine
has with mkosi (see: https://github.com/systemd/mkosi/pull/4283). The
issue is that the busybox symlinks installed in the base duranium image
are not replaced by mkosi when it generates a system extension even if
that sysext pulls in coreutils. coreutils isn't *that* big, so it makes
sense to just have these links correct in the base image.

- duranium dev. tools depends on apk-tools. Wait, what?! mkosi uses
apk to bootstrap a tools tree for building pmOS images. Since we don't
actually want apk to work when run against the duranium rootfs, this
also installs a wrapper that refuses to run apk if it detects that it's
being used "unsafely". To be clear, running apk on duranium's rootfs
won't change /usr or break duranium, but it will: 1) fail, 2) create
confusing state in /etc, /var.

Signed-off-by: Clayton Craft <craftyguy@postmarketos.org>
Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/8426>
2026-05-04 15:53:16 -07:00

11 lines
329 B
Bash

#!/bin/sh
# Prevent accidental use of apk against the the Duranium rootfs by requiring
# --root to invoke the real apk at /usr/sbin/apk
case "$*" in
*--root*) exec /usr/sbin/apk "$@" ;;
esac
echo "ERROR: apk cannot manage packages on an immutable system." >&2
echo "Use --root=<path> to manage a different rootfs." >&2
exit 1