Slim the armv7 rootfs: drop Rust and Wayland packages, dead code, and build residue
- Replace Rust sudo-rs with C sudo (sudo-virt provider at priority 100) and add a two-phase pruner so apk atomically swaps the conflicting provider. - Remove Wayland-purpose libwpebackend-fdo from the runtime set and add imv-x11 for the X11-only image viewer path. - Drop unused mesa-demos, postmarketos-artwork-wallpapers, ttyescape/hkdm, clickclack/sdl3, and font-twemoji; keep sfeed, w3m, htop, non-Latin fonts, and the documented SDK toolchain to avoid functional regressions. - Strip apk index caches, apk logs, and unused gettext locales before mke2fs, with a hard guard that fails the build if any residue survives. - Harden check-rebuild.sh with critical/forbidden package and guard checks. - Delete the unreferenced Sway-era configurator and patch; sync the docs.
This commit is contained in:
1 parent
0ab9367e28
commit
5d10b801ff
12 files changed
+187
-1024
No files matched your search
Executable
+56
@@ -0,0 +1,56 @@
|
||||
#!/bin/sh
|
||||
# Remove Wayland-only, Rust-based, and retired packages from a target rootfs.
|
||||
# Usage: prune-rootfs-packages.sh <rootfs-dir> world|purge
|
||||
# world - drop retired entries from etc/apk/world before apk add, so apk can
|
||||
# atomically replace conflicting providers (C sudo replaces sudo-rs)
|
||||
# purge - apk del the still-installed entries after apk add, so install_if
|
||||
# helpers are not re-added by the same transaction
|
||||
# Runs inside the build container, where apk and the repositories are available.
|
||||
set -eu
|
||||
|
||||
ROOTFS="$1"
|
||||
PHASE="$2"
|
||||
BASE_DIR="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
PRUNE_FILE="$BASE_DIR/scripts/rootfs-prune-packages.txt"
|
||||
INSTALLED_DB="$ROOTFS/lib/apk/db/installed"
|
||||
WORLD_FILE="$ROOTFS/etc/apk/world"
|
||||
|
||||
if [ ! -f "$PRUNE_FILE" ]; then
|
||||
echo "Error: missing $PRUNE_FILE" >&2
|
||||
exit 1
|
||||
fi
|
||||
PRUNE_PKGS="$(grep -v '^[[:space:]]*#' "$PRUNE_FILE" | grep -v '^[[:space:]]*$' | tr '\n' ' ')"
|
||||
|
||||
case "$PHASE" in
|
||||
world)
|
||||
if [ -f "$WORLD_FILE" ]; then
|
||||
cp "$WORLD_FILE" "$WORLD_FILE.bananarchy-tmp"
|
||||
for pkg in $PRUNE_PKGS; do
|
||||
grep -vxF "$pkg" "$WORLD_FILE.bananarchy-tmp" > "$WORLD_FILE.bananarchy-tmp2" || true
|
||||
mv "$WORLD_FILE.bananarchy-tmp2" "$WORLD_FILE.bananarchy-tmp"
|
||||
done
|
||||
mv "$WORLD_FILE.bananarchy-tmp" "$WORLD_FILE"
|
||||
fi
|
||||
;;
|
||||
purge)
|
||||
if [ -f "$INSTALLED_DB" ]; then
|
||||
PRUNE_INSTALLED=""
|
||||
for pkg in $PRUNE_PKGS; do
|
||||
if grep -Fxq "P:$pkg" "$INSTALLED_DB"; then
|
||||
PRUNE_INSTALLED="$PRUNE_INSTALLED $pkg"
|
||||
fi
|
||||
done
|
||||
if [ -n "$PRUNE_INSTALLED" ]; then
|
||||
echo "[prune] Removing:$PRUNE_INSTALLED"
|
||||
# shellcheck disable=SC2086
|
||||
if ! apk --root "$ROOTFS" --arch armv7 del --no-scripts $PRUNE_INSTALLED; then
|
||||
echo " -> Warning: some retired packages could not be purged" >&2
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 <rootfs-dir> world|purge" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
Reference in new issue
Block a user