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>
This commit is contained in:
parent
fc5554ef5c
commit
f61687b60d
2 changed files with 53 additions and 2 deletions
|
|
@ -4,13 +4,17 @@ pkgver=6
|
|||
pkgrel=0
|
||||
pkgdesc="Configuration for building and booting immutable postmarketOS images"
|
||||
url="https://wiki.postmarketos.org/wiki/Duranium_(Immutable_postmarketOS)"
|
||||
options="!check" # no tests
|
||||
# check: no tests
|
||||
# fhs: allow installing into /usr/local
|
||||
options="!check !fhs"
|
||||
depends="
|
||||
coreutils
|
||||
coldbrew
|
||||
e2fsprogs
|
||||
erofs-utils
|
||||
f0rmz
|
||||
postmarketos-base
|
||||
!postmarketos-base-apk
|
||||
postmarketos-base-systemd
|
||||
shadow
|
||||
shadow-subids
|
||||
|
|
@ -70,6 +74,7 @@ _source755="
|
|||
usr/libexec/duranium/first-boot
|
||||
usr/libexec/duranium/mount-subpartitions
|
||||
usr/libexec/duranium/usb-gadget-setup
|
||||
usr/local/sbin/apk
|
||||
"
|
||||
|
||||
# Avoid filename based checksum conflicts by including the whole path:
|
||||
|
|
@ -141,21 +146,52 @@ initramfs() {
|
|||
|
||||
sysext_dev_tools() {
|
||||
description="meta package for Duranium Developer Tools system extension"
|
||||
depends=""
|
||||
|
||||
# android development
|
||||
depends="
|
||||
$depends
|
||||
android-tools
|
||||
android-udev-rules
|
||||
"
|
||||
|
||||
# containers for toolchains, etc
|
||||
depends="
|
||||
$depends
|
||||
devpod
|
||||
distrobox
|
||||
podman
|
||||
"
|
||||
|
||||
# mkosi for building duranium, other distro images
|
||||
depends="
|
||||
$depends
|
||||
apk-tools
|
||||
mkosi
|
||||
"
|
||||
# Block app store plugins that might try to use apk/libapk
|
||||
depends="
|
||||
$depends
|
||||
!discover-backend-apk
|
||||
!gnome-software-plugin-apk2
|
||||
"
|
||||
|
||||
# support for running VMs / platform emulation
|
||||
depends="
|
||||
$depends
|
||||
libvirt-client
|
||||
libvirt-common-drivers
|
||||
libvirt-daemon
|
||||
libvirt-qemu
|
||||
qemu
|
||||
qemu-aarch64
|
||||
qemu-arm
|
||||
qemu-i386
|
||||
qemu-img
|
||||
qemu-loongarch64
|
||||
qemu-modules
|
||||
qemu-ppc64le
|
||||
qemu-riscv64
|
||||
qemu-system-aarch64
|
||||
qemu-system-arm
|
||||
qemu-system-i386
|
||||
|
|
@ -163,6 +199,7 @@ sysext_dev_tools() {
|
|||
qemu-system-ppc64
|
||||
qemu-system-riscv64
|
||||
qemu-system-x86_64
|
||||
qemu-x86_64
|
||||
"
|
||||
|
||||
case "$CARCH" in
|
||||
|
|
@ -174,7 +211,9 @@ sysext_dev_tools() {
|
|||
depends="$depends edk2-loongarch64" ;;
|
||||
esac
|
||||
|
||||
mkdir -p "$subpkgdir"
|
||||
# /usr/local/sbin takes precedence over /usr/sbin in PATH, and we want this to
|
||||
# get ahead of the real apk binary
|
||||
amove usr/local/sbin/apk
|
||||
}
|
||||
|
||||
sha512sums="
|
||||
|
|
@ -217,5 +256,6 @@ ede57bf8696dce4ee295dc2a1dfe31dec415e7ce994600ce3bf7386ac1ad63797a6c5a88434ca0cc
|
|||
2b9ed56b379d2392fd00919def8ab0cb1d9c50452bb9a6ce802eb458e41be542dd2f878cdd3c5c86f34fa40c1ee1d9d78a4bb9b9cc9c6e165c1d372fa7e50e35 rootfs-usr-libexec-duranium-first-boot
|
||||
bb3ec1693f88a61563876cd069b49351861a31c15b1795702031e5beb4e89cefe302644c1ea9d0bb74746aa97007664c1782857900e2b85dd71182e95efd66ae rootfs-usr-libexec-duranium-mount-subpartitions
|
||||
9912109374399bf6df4d45c05baff5b3c424e05380b81b2be5b55e28e95f07bda71b5a4f7345a40498c1b11df465a9f4410e740d119ab98543ce28b75c53eb0f rootfs-usr-libexec-duranium-usb-gadget-setup
|
||||
a18931c21df72984f4b09b49b192ecb2ee203caff3303a306633cad03ee2dc4750763d8177ea107e445f64b337233138b963f7755da0dbd8ff3a543f0b64793f rootfs-usr-local-sbin-apk
|
||||
ca5b767d4bbc5857c2282124fee3082fafaca8e735ab2077112060e67a37afdb521c28c81fc3b548f114e857aaa702169ee77fab8b7b37c44b5233c83a94afd4 dev-gpt-auto-root-no-timeout.conf
|
||||
"
|
||||
|
|
|
|||
11
main/postmarketos-duranium/rootfs-usr-local-sbin-apk
Normal file
11
main/postmarketos-duranium/rootfs-usr-local-sbin-apk
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
#!/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
|
||||
Loading…
Add table
Add a link
Reference in a new issue