#!/bin/sh # Fast offline preflight: verify that a clean clone can rebuild Bananarchy. set -eu BASE_DIR="$(cd "$(dirname "$0")/.." && pwd)" FAILURES=0 TARGET_FILTER="${BANANARCHY_CHECK_TARGET:-all}" SKIP_PINNED_HASHES=0 while [ "$#" -gt 0 ]; do case "$1" in --for-rebuild) SKIP_PINNED_HASHES=1 ;; --target|--device) shift if [ "$#" -eq 0 ]; then echo "Usage: $0 [--for-rebuild] [--device |all|nokia-argon|nokia-beatles|nokia-coconut|nokia-sparkler|nokia-leo]" >&2 exit 1 fi TARGET_FILTER="$1" ;; --target=*|--device=*) TARGET_FILTER="${1#*=}" ;; *) TARGET_FILTER="$1" ;; esac shift done case "$TARGET_FILTER" in ""|all|sxmo) TARGET_FILTER="all" ;; nokia-argon|argon) TARGET_FILTER="nokia-argon" ;; nokia-beatles|beatles) TARGET_FILTER="nokia-beatles" ;; nokia-coconut|nokia-tough|coconut|tough) TARGET_FILTER="nokia-coconut" ;; nokia-sparkler|sparkler) TARGET_FILTER="nokia-sparkler" ;; nokia-leo|leo) TARGET_FILTER="nokia-leo" ;; *) echo "Usage: $0 [--device |all|nokia-argon|nokia-beatles|nokia-coconut|nokia-sparkler|nokia-leo]" >&2 exit 1 ;; esac check_target() { [ "$TARGET_FILTER" = "all" ] && return 0 for _target in "$@"; do [ "$TARGET_FILTER" = "$_target" ] && return 0 done return 1 } artifact_matches_target() { [ "$TARGET_FILTER" = "all" ] && return 0 case "$1" in *nokia-argon*) check_target nokia-argon ;; *nokia-beatles*) check_target nokia-beatles ;; *nokia-coconut*) check_target nokia-coconut ;; *nokia-leo*) check_target nokia-leo ;; *nokia-sparkler*) check_target nokia-sparkler nokia-leo ;; *) return 0 ;; esac } fail() { echo "FAIL: $1" FAILURES=$((FAILURES + 1)) } echo "[check] Shell syntax..." for script in "$BASE_DIR"/*.sh "$BASE_DIR"/scripts/*.sh; do if ! sh -n "$script" 2>/dev/null; then fail "shell syntax: $script" fi done echo "[check] Target-specific hostname..." HOSTNAME_HELPER="$BASE_DIR/scripts/set-bananarchy-hostname.sh" if [ ! -x "$HOSTNAME_HELPER" ]; then fail "missing or non-executable scripts/set-bananarchy-hostname.sh" fi if ! grep -qF 'set-bananarchy-hostname.sh' "$BASE_DIR/scripts/bootstrap-rootfs-container.sh" || \ ! grep -qF 'set-bananarchy-hostname.sh' "$BASE_DIR/scripts/apply-bananarchy-overlay.sh" || \ grep -qF '"nokia-argon" > "$ROOTFS/etc/hostname"' \ "$BASE_DIR/scripts/bootstrap-rootfs-container.sh"; then fail "target rootfs bootstrap no longer uses the target-specific hostname helper" fi if [ -x "$HOSTNAME_HELPER" ]; then HOSTNAME_TMP="$(mktemp -d)" for dev in nokia-argon nokia-beatles nokia-coconut nokia-sparkler nokia-leo; do if ! "$HOSTNAME_HELPER" "$HOSTNAME_TMP" "$dev"; then fail "hostname helper failed for $dev" continue fi if [ "$(cat "$HOSTNAME_TMP/etc/hostname" 2>/dev/null)" != "$dev" ] || \ ! grep -qF "127.0.0.1 $dev localhost.localdomain localhost" \ "$HOSTNAME_TMP/etc/hosts" 2>/dev/null || \ [ "$(readlink "$HOSTNAME_TMP/etc/runlevels/boot/hostname" 2>/dev/null)" != \ "/etc/init.d/hostname" ]; then fail "hostname helper produced the wrong identity for $dev" fi done rm -rf "$HOSTNAME_TMP" fi if ! grep -qF 'BANANARCHY_USER_PASSWORD="${BANANARCHY_USER_PASSWORD:-147147}"' \ "$BASE_DIR/scripts/bootstrap-rootfs.sh" || \ ! grep -qF 'openssl passwd -6 -salt bananarchy "$PASSWORD"' \ "$BASE_DIR/scripts/bootstrap-rootfs-container.sh"; then fail "the default 147147 unlock passcode is no longer provisioned" fi echo "[check] Python syntax..." python3 - "$BASE_DIR" <<'PYEOF' || exit 1 import ast import glob import os import sys base = sys.argv[1] paths = sorted(glob.glob(os.path.join(base, "scripts", "*.py")) + glob.glob(os.path.join(base, "*.py")) + glob.glob(os.path.join(base, "vendor", "edl", "*.py")) + glob.glob(os.path.join(base, "vendor", "edl", "Library", "*.py"))) for path in paths: with open(path, "r", encoding="utf-8", errors="replace") as handle: try: ast.parse(handle.read(), filename=path) except SyntaxError as exc: print("FAIL: python syntax: %s: %s" % (path, exc)) sys.exit(1) print(" %d Python file(s) parsed" % len(paths)) PYEOF if [ -n "$(find "$BASE_DIR/overlay/rootfs" -type d -name __pycache__ -print -quit 2>/dev/null)" ]; then fail "overlay/rootfs contains Python bytecode caches" fi echo "[check] Rootfs package list..." PKGS_FILE="$BASE_DIR/scripts/rootfs-packages.txt" PRUNE_FILE="$BASE_DIR/scripts/rootfs-prune-packages.txt" if [ ! -f "$PKGS_FILE" ]; then fail "missing $PKGS_FILE" else PKG_COUNT="$(grep -v '^[[:space:]]*#' "$PKGS_FILE" | grep -cv '^[[:space:]]*$' || true)" if [ "$PKG_COUNT" -lt 70 ]; then fail "package list has only $PKG_COUNT entries" else echo " $PKG_COUNT packages" fi for pkg in alpine-base postmarketos-ui-sxmo-de-dwm webkit2gtk-4.1 libwpe \ sudo imv-x11 fcitx5-gtk3 mesa-utils sfeed yabasic yabasic-doc \ curl bc ed rlwrap mandoc nano less frotz tcl \ msm-firmware-loader msm-firmware-loader-openrc msm-firmware-loader-wcnss; do if ! grep -Fxq "$pkg" "$PKGS_FILE"; then fail "missing critical package: $pkg" fi done # Pure X11 and Rust-free top-level package set. for pkg in sudo-rs postmarketos-base-sudo-rs libwpebackend-fdo imv-wayland \ xwayland sxmo-utils-wayland wofi grim slurp \ gcc g++ musl-dev make janet janet-dev jpm \ perl perl-io-socket-ssl tcl-lib tcl-tls sqlite-tcl sqlite \ lua5.4 lua5.4-dev lua5.5 lua5.5-dev; do if grep -Fxq "$pkg" "$PKGS_FILE"; then fail "forbidden Rust/Wayland package in package list: $pkg" fi done fi echo "[check] WCNSS firmware loader services..." for service in \ "$BASE_DIR/overlay/rootfs/etc/runlevels/sysinit/msm-firmware-loader" \ "$BASE_DIR/overlay/rootfs/etc/runlevels/boot/msm-firmware-loader-unpack"; do if [ ! -L "$service" ]; then fail "WCNSS firmware loader runlevel link is missing: ${service#"$BASE_DIR/"}" fi done if [ "$(readlink "$BASE_DIR/overlay/rootfs/etc/runlevels/sysinit/msm-firmware-loader" 2>/dev/null)" != \ "/etc/init.d/msm-firmware-loader" ] || \ [ "$(readlink "$BASE_DIR/overlay/rootfs/etc/runlevels/boot/msm-firmware-loader-unpack" 2>/dev/null)" != \ "/etc/init.d/msm-firmware-loader-unpack" ]; then fail "WCNSS firmware loader services are wired to the wrong init scripts" fi echo "[check] Rootfs prune list..." if [ ! -f "$PRUNE_FILE" ]; then fail "missing $PRUNE_FILE" else PRUNE_COUNT="$(grep -v '^[[:space:]]*#' "$PRUNE_FILE" | grep -cv '^[[:space:]]*$' || true)" echo " $PRUNE_COUNT prune entries" for pkg in sudo-rs libwpebackend-fdo imv-wayland gcc janet perl lua5.5 sqlite; do if ! grep -Fxq "$pkg" "$PRUNE_FILE"; then fail "missing prune entry: $pkg" fi done for deny in '!imv-wayland' '!gstreamer-ptp-helper' '!libheif-rav1e' '@so:libperl.so'; do if ! grep -Fxq "$deny" "$PRUNE_FILE"; then fail "missing negative world constraint: $deny" fi done fi if [ ! -x "$BASE_DIR/scripts/prune-rootfs-packages.sh" ]; then fail "missing or non-executable scripts/prune-rootfs-packages.sh" fi echo "[check] Lua symlink removal..." if grep -q 'lua5.5' "$BASE_DIR/rebuild-image.sh" || \ grep -q 'lua5.5' "$BASE_DIR/scripts/bootstrap-rootfs-container.sh"; then fail "build scripts still create dangling lua/luac symlinks" fi echo "[check] Yabasic FFI runtime..." for artifact in \ "$BASE_DIR/prebuilt/sxmo-x11/usr/lib/libneoui.so" \ "$BASE_DIR/prebuilt/sxmo-x11/usr/include/neoui.h" \ "$BASE_DIR/overlay/rootfs/usr/lib/neoui.yab" \ "$BASE_DIR/overlay/rootfs/usr/lib/neonet.yab" \ "$BASE_DIR/overlay/rootfs/home/user/Projects/neoui.yab" \ "$BASE_DIR/overlay/rootfs/home/user/Projects/neonet.yab"; do # The /usr/lib/*.yab entries are absolute symlinks into the target rootfs, # so a dangling link on the build host is expected and still valid. if [ ! -e "$artifact" ] && [ ! -L "$artifact" ]; then fail "missing Yabasic FFI artifact: ${artifact#"$BASE_DIR/"}" fi done echo "[check] Image residue guard..." if ! grep -q 'strip_build_residue' "$BASE_DIR/rebuild-image.sh" || \ ! grep -q 'apk cache/log still present' "$BASE_DIR/rebuild-image.sh"; then fail "rebuild-image.sh is missing the apk cache/log guard" fi echo "[check] Vendored EDL client library..." for module in usb gpt sahara firehose utils; do if [ ! -f "$BASE_DIR/vendor/edl/Library/$module.py" ]; then fail "missing vendor/edl/Library/$module.py" fi done for f in vendor/edl/LICENSE scripts/test-edl-firehose-read.py; do if [ ! -f "$BASE_DIR/$f" ]; then fail "missing $f" fi done if ! python3 "$BASE_DIR/scripts/test-edl-firehose-read.py" >/dev/null 2>&1; then fail "Firehose rawmode read regression tests failed" fi if ! grep -q '^from Library\.sahara import qualcomm_sahara$' "$BASE_DIR/flash-edl.py"; then fail "flash-edl.py is missing the Sahara client import" fi if ! grep -qF 'DEFAULT_USB_TIMEOUT_MS = 30000' "$BASE_DIR/vendor/edl/Library/usb.py" || \ ! grep -qF 'DEFAULT_USB_IO_TIMEOUT_SEC = 30' "$BASE_DIR/flash-edl.py" || \ ! grep -qF '"--usb-timeout"' "$BASE_DIR/flash-edl.py"; then fail "EDL flasher USB transfer timeout defaults (30s) regressed" fi echo "[check] Device-specific EDL Firehose loaders..." if ! grep -q '^DEVICE_LOADERS = {' "$BASE_DIR/flash-edl.py"; then fail "flash-edl.py is missing the device-to-loader map" fi for dev in nokia-argon nokia-beatles nokia-coconut nokia-sparkler nokia-leo; do if ! grep -q "\"$dev\":" "$BASE_DIR/flash-edl.py"; then fail "DEVICE_LOADERS is missing $dev" fi done for mbn in 8110.mbn 2720.mbn 2720v.mbn 800t.mbn 8k.mbn; do if [ ! -s "$BASE_DIR/bootloader/loaders/$mbn" ]; then fail "missing bootloader/loaders/$mbn" fi done for mapping in \ '"nokia-beatles": "2720.mbn"' \ '"nokia-coconut": "800t.mbn"' \ '"nokia-sparkler": "8k.mbn"' \ '"nokia-leo": "8k.mbn"' \ '"us": "2720v.mbn"'; do if ! grep -qF "$mapping" "$BASE_DIR/flash-edl.py"; then fail "flash-edl.py loader mapping lost: $mapping" fi done if ! grep -q '^VARIANT_LOADER_IDENTITIES' "$BASE_DIR/flash-edl.py"; then fail "flash-edl.py is missing the variant identity map" fi if ! grep -q '^EDL_PIDS = ' "$BASE_DIR/flash-edl.py"; then fail "flash-edl.py is missing the EDL PID auto-detection list" fi for edlpid in 9008 900E 9006; do if ! grep -qi "0x$edlpid" "$BASE_DIR/flash-edl.py"; then fail "EDL_PIDS is missing 0x$edlpid" fi done if ! grep -q '^BOOT_IMAGE_DEVICES' "$BASE_DIR/flash-edl.py"; then fail "flash-edl.py is missing the boot-image device list" fi if ! grep -q '^BOOT_METHOD_PARTITIONS' "$BASE_DIR/flash-edl.py"; then fail "flash-edl.py is missing the method-to-partition map" fi if ! grep -q '^def resolve_boot_method' "$BASE_DIR/flash-edl.py"; then fail "flash-edl.py is missing resolve_boot_method()" fi if ! grep -q '^def resolve_wipe_system' "$BASE_DIR/flash-edl.py"; then fail "flash-edl.py is missing the system wipe guard" fi if ! grep -q '^def verify_partition' "$BASE_DIR/flash-edl.py"; then fail "flash-edl.py is missing the partition read-back verification" fi if ! grep -q '^BOOT_METHOD_TARGETS' "$BASE_DIR/flash-edl.py"; then fail "flash-edl.py is missing the dual boot/recovery target map" fi if ! grep -q '^def dump_diagnostics' "$BASE_DIR/flash-edl.py"; then fail "flash-edl.py is missing the EDL diagnostic partition dump" fi if ! grep -q 'return "lk2nd"' "$BASE_DIR/flash-edl.py"; then fail "flash-edl.py no longer defaults to the lk2nd boot.img" fi if ! grep -q 'if method == "lk2nd" and device in DEVICE_LK2ND_IMAGES:' "$BASE_DIR/flash-edl.py"; then fail "flash-edl.py no longer writes lk2nd to both slots on 2720/800 Tough" fi if check_target nokia-beatles; then for variant in normal diagnostic display; do case "$variant" in normal) image="$BASE_DIR/images/boot-lk2nd-nokia-beatles.img" opts="--expect-fastboot 0" label="source-built nokia-beatles lk2nd" ;; diagnostic) image="$BASE_DIR/images/boot-lk2nd-nokia-beatles-diagnostic.img" opts="--expect-fastboot 1" label="nokia-beatles forced-fastboot diagnostic image" ;; display) image="$BASE_DIR/images/boot-lk2nd-nokia-beatles-display.img" opts="--expect-fastboot 0 --expect-display 1" label="nokia-beatles display lk2nd image with Fastboot reboot cookie" ;; esac if [ ! -f "$image" ]; then echo "[skip] local build output ${image#"$BASE_DIR/"} is absent; prepare-release.sh will rebuild it" continue fi # shellcheck disable=SC2086 if ! python3 "$BASE_DIR/scripts/check-lk2nd-beatles.py" \ --image "$image" $opts; then fail "$label validation failed" fi done fi if ! grep -qF 'BEATLES_LK2ND_IMAGE = "images/boot-lk2nd-nokia-beatles-display.img"' \ "$BASE_DIR/flash-edl.py"; then fail "flash-edl.py no longer defaults to the display-enabled lk2nd image" fi if ! grep -qF 'target_names = ("boot", "recovery", "lk2nd")' \ "$BASE_DIR/flash-edl.py"; then fail "flash-edl.py no longer refreshes the separate lk2nd partition" fi for f in bootloader/lk2nd/nokia-beatles.patch \ bootloader/lk2nd/nokia-coconut.patch \ bootloader/lk2nd/nokia-sparkler.patch \ bootloader/lk2nd/README.md \ bootloader/lk2nd/spi-panel-init.h \ bootloader/lk2nd/Dockerfile \ scripts/build-lk2nd-beatles.sh \ scripts/test-lk2nd-beatles-port.py \ scripts/build-lk2nd-coconut.sh \ scripts/check-lk2nd-coconut.py \ scripts/test-lk2nd-coconut-port.py \ scripts/build-lk2nd-sparkler.sh \ scripts/check-lk2nd-sparkler.py \ scripts/test-lk2nd-sparkler-port.py \ scripts/test-sparkler-port.py \ scripts/inspect-stock-msm8905-dump.py; do if [ ! -f "$BASE_DIR/$f" ]; then fail "missing lk2nd port / inspection file: $f" fi done if ! grep -qF 'COCONUT_LK2ND_IMAGE = "images/boot-lk2nd-nokia-coconut-display.img"' \ "$BASE_DIR/flash-edl.py"; then fail "flash-edl.py no longer references the display-enabled coconut lk2nd image" fi if ! grep -qF 'SPARKLER_LK2ND_IMAGE = "images/boot-lk2nd-nokia-sparkler-display.img"' \ "$BASE_DIR/flash-edl.py"; then fail "flash-edl.py no longer references the display-enabled sparkler lk2nd image" fi if check_target nokia-coconut; then for variant in normal diagnostic display; do case "$variant" in normal) image="$BASE_DIR/images/boot-lk2nd-nokia-coconut.img" opts="--expect-fastboot 0" label="source-built nokia-coconut lk2nd" ;; diagnostic) image="$BASE_DIR/images/boot-lk2nd-nokia-coconut-diagnostic.img" opts="--expect-fastboot 1" label="nokia-coconut forced-fastboot diagnostic image" ;; display) image="$BASE_DIR/images/boot-lk2nd-nokia-coconut-display.img" opts="--expect-fastboot 0 --expect-display 1" label="nokia-coconut display lk2nd image with Fastboot reboot cookie" ;; esac if [ ! -f "$image" ]; then echo "[skip] local build output ${image#"$BASE_DIR/"} is absent; prepare-release.sh will rebuild it" continue fi # shellcheck disable=SC2086 if ! python3 "$BASE_DIR/scripts/check-lk2nd-coconut.py" \ --image "$image" $opts; then fail "$label validation failed" fi done fi if check_target nokia-sparkler nokia-leo; then for variant in normal diagnostic display; do case "$variant" in normal) image="$BASE_DIR/images/boot-lk2nd-nokia-sparkler.img" opts="--expect-fastboot 0" label="source-built nokia-sparkler lk2nd" ;; diagnostic) image="$BASE_DIR/images/boot-lk2nd-nokia-sparkler-diagnostic.img" opts="--expect-fastboot 1" label="nokia-sparkler forced-fastboot diagnostic image" ;; display) image="$BASE_DIR/images/boot-lk2nd-nokia-sparkler-display.img" opts="--expect-fastboot 0 --expect-display 1" label="nokia-sparkler display lk2nd image with Fastboot reboot cookie" ;; esac if [ ! -f "$image" ]; then echo "[skip] local build output ${image#"$BASE_DIR/"} is absent; prepare-release.sh will rebuild it" continue fi # shellcheck disable=SC2086 if ! python3 "$BASE_DIR/scripts/check-lk2nd-sparkler.py" \ --image "$image" $opts; then fail "$label validation failed" fi done fi if [ -f "$BASE_DIR/scripts/make-beatles-lk2nd-bootimg.py" ]; then fail "obsolete binary-patch lk2nd script is still present" fi for lk_script in scripts/build-lk2nd-beatles.sh \ scripts/build-lk2nd-coconut.sh \ scripts/build-lk2nd-sparkler.sh; do if grep -qE 'bananarchy-(beatles|coconut|sparkler)-[a-z][0-9]{4}' "$BASE_DIR/$lk_script"; then fail "$lk_script still hardcodes an OS version tag in LK2ND_VERSION" fi done if grep -q 'target_parts\[0\]\[1\]' "$BASE_DIR/flash-edl.py"; then fail "flash-edl.py still writes only the first lk2nd target slot" fi if ! grep -q 'write_partition(fh, args.lun, part, source)' "$BASE_DIR/flash-edl.py"; then fail "flash-edl.py lost the multi-target write loop" fi if ! grep -q 'def source_for(name):' "$BASE_DIR/flash-edl.py"; then fail "flash-edl.py lost the Argon-shaped hybrid per-slot source" fi if [ ! -f "$BASE_DIR/scripts/dump-edl-crash.py" ]; then fail "missing scripts/dump-edl-crash.py" fi if ! grep -q '^UNLOCK_DEFAULT_DEVICES' "$BASE_DIR/flash-edl.py"; then fail "flash-edl.py is missing the locked-bootloader unlock default" fi if ! grep -q '^def unlock_devinfo' "$BASE_DIR/flash-edl.py"; then fail "flash-edl.py is missing the devinfo unlock helper" fi if ! grep -q '^OEM_UNLOCK_PARTITIONS' "$BASE_DIR/flash-edl.py"; then fail "flash-edl.py is missing the RPMB unlock prerequisite map" fi if ! grep -q '^def enable_oem_unlock' "$BASE_DIR/flash-edl.py"; then fail "flash-edl.py is missing the config/frp OEM unlock helper" fi if [ ! -f "$BASE_DIR/scripts/make-oem-unlock-config.py" ]; then fail "missing scripts/make-oem-unlock-config.py" fi if [ ! -f "$BASE_DIR/scripts/make-unlocked-devinfo.py" ]; then fail "missing scripts/make-unlocked-devinfo.py" fi if ! grep -q 'boot-bananarchy-\$TARGET_DEVICE.img' "$BASE_DIR/rebuild-image.sh"; then fail "rebuild-image.sh no longer exports a standalone boot.img" fi if [ ! -L "$BASE_DIR/overlay/rootfs/sbin/init" ] || \ [ "$(readlink "$BASE_DIR/overlay/rootfs/sbin/init")" != "/bin/busybox" ]; then fail "overlay/rootfs/sbin/init is no longer a /bin/busybox symlink" fi for cmdline_file in "$BASE_DIR"/devices/*/kernel-cmdline.conf \ "$BASE_DIR"/overlay/rootfs/usr/lib/kernel-cmdline.d/50-device-*.conf; do if grep -qxF 'earlycon' "$cmdline_file"; then fail "$(basename "$cmdline_file") still contains earlycon" fi if grep -qF 'console=ttyMSM0' "$cmdline_file"; then fail "$(basename "$cmdline_file") still contains console=ttyMSM0" fi done # A pre-existing rootfs/ build tree is reused by rebuild-image.sh, so its # copies of the device cmdline fragments must stay in sync with the overlay. for cmdline_file in "$BASE_DIR"/rootfs/usr/lib/kernel-cmdline.d/50-device-*.conf; do [ -f "$cmdline_file" ] || continue if grep -qxF 'earlycon' "$cmdline_file"; then fail "rootfs/usr/lib/kernel-cmdline.d/$(basename "$cmdline_file") still contains earlycon" fi if grep -qF 'console=ttyMSM0' "$cmdline_file"; then fail "rootfs/usr/lib/kernel-cmdline.d/$(basename "$cmdline_file") still contains console=ttyMSM0" fi done echo "[check] BusyBox applet symlinks..." APPLET_LIST="$BASE_DIR/scripts/busybox-applets.txt" if [ ! -f "$APPLET_LIST" ]; then fail "missing scripts/busybox-applets.txt" fi for applet in ash grep sed ps; do if ! grep -qxF "$applet" "$APPLET_LIST"; then fail "scripts/busybox-applets.txt is missing $applet" fi done if ! grep -q 'busybox-applets.txt' "$BASE_DIR/scripts/apply-bananarchy-overlay.sh"; then fail "the overlay no longer restores missing BusyBox applet symlinks" fi for applet_file in "$BASE_DIR/scripts/busybox-usr-bin-applets.txt" \ "$BASE_DIR/scripts/busybox-usr-sbin-applets.txt"; do if [ ! -f "$applet_file" ]; then fail "missing ${applet_file#"$BASE_DIR/"}" fi done if [ -f "$BASE_DIR/scripts/busybox-usr-bin-applets.txt" ]; then if ! grep -qxF 'free' "$BASE_DIR/scripts/busybox-usr-bin-applets.txt"; then fail "scripts/busybox-usr-bin-applets.txt is missing free" fi if grep -qxF 'pkill' "$BASE_DIR/scripts/busybox-usr-bin-applets.txt"; then fail "scripts/busybox-usr-bin-applets.txt must omit pkill" fi fi if ! grep -qF 'busybox-usr-bin-applets.txt' "$BASE_DIR/scripts/apply-bananarchy-overlay.sh" || \ ! grep -qF 'busybox-usr-sbin-applets.txt' "$BASE_DIR/scripts/apply-bananarchy-overlay.sh" || \ ! grep -qF 'rm -f "$TARGET_ROOTFS/usr/bin/pkill"' "$BASE_DIR/scripts/apply-bananarchy-overlay.sh"; then fail "apply-bananarchy-overlay.sh no longer manages /usr/bin and /usr/sbin BusyBox symlinks" fi # The shipped rootfs is validated by scripts/sync-beatles-bootfs.py --check # and by an explicit image build; the overlay script above is the source of # truth for the applet symlinks, so avoid extracting a 1.3 GiB partition here. RAW_IMAGE="$BASE_DIR/images/bananarchy-nokia-beatles.img" if check_target nokia-beatles && [ -f "$RAW_IMAGE" ] && [ "$(stat -c %s "$RAW_IMAGE")" -lt 1000000000 ]; then fail "the shipped raw image is truncated" fi echo "[check] Known-good flashable image set..." for pair in \ "34490465fe0f6ec89283495d0c1afc754205cfc8b6048895d8452ab4e677048e images/bananarchy-nokia-argon.img" \ "c77b1fbfff31a08ce34d28ee950ea04211074bf07a2d45c97b7d24dabad178c4 images/bananarchy-nokia-beatles.img" \ "e42f548a025a1b902995333dedd1b5807a7bf750e758c8aa0ab8843cf45a3227 images/boot-bananarchy-nokia-beatles.img" \ "f13db705a714aaebd2d8fcc2e0f7266d0e40268c0a276208117dfdf9d8f45351 images/boot-lk2nd-nokia-beatles-display.img" \ "b2189eb9f3be83af33770abce61574047d3232a49760aac4894600f9e5d2b8cd images/bananarchy-nokia-coconut.img" \ "379fd1ca70671505520609d4a2745b4eb1784152bbc2dca2d80b438b3d65e382 images/boot-bananarchy-nokia-coconut.img" \ "9a5bd2da6cfd95c745d9c1acb2e3bc61afa339824810e3d160bf079e17b23192 images/boot-lk2nd-nokia-coconut-display.img" \ "3ebd73a99f63a849282f84f4aeba08cf499346a600b5adedb66633d1588414db images/bananarchy-nokia-sparkler.img" \ "d00909d3b970af8cd93a7e53d3ef6a291b5ed55518ba858aae034439fa2acf02 images/boot-bananarchy-nokia-sparkler.img" \ "120ade81bc5416263a1afd95a29981675358b98516e105e5ed611edf258a29f7 images/boot-lk2nd-nokia-sparkler-display.img"; do set -- $pair want=$1 artifact_matches_target "$2" || continue if [ "$SKIP_PINNED_HASHES" -eq 1 ]; then case "$2" in images/bananarchy-*.img|images/boot-bananarchy-*.img) continue ;; esac fi path="$BASE_DIR/$2" if [ ! -f "$path" ]; then echo "[skip] local build output $2 is absent; prepare-release.sh will rebuild it" continue elif [ "$(sha256sum "$path" | cut -d' ' -f1)" != "$want" ]; then fail "$2 no longer matches the pinned release image" fi done echo "[check] Compiled idle daemons..." DAEMONS="bananarchy-lid bananarchy-cover-idle bananarchy-volume-keys bananarchy-dsds bananarchy-modemmonitor bananarchy-soundmonitor bananarchy-notifmonitor bananarchy-run-aligned bananarchy-session-loop bananarchy-imsctl bananarchy-imsd" for daemon in $DAEMONS; do for artifact in "prebuilt/bananarchy-daemons/usr/bin/$daemon" \ "overlay/rootfs/usr/bin/$daemon"; do path="$BASE_DIR/$artifact" if [ ! -x "$path" ]; then fail "missing compiled daemon: $artifact" continue fi if [ "$(head -c 4 "$path" | od -An -tx1 | tr -d ' \n')" != "7f454c46" ] || \ ! readelf -h "$path" 2>/dev/null | grep -q 'Machine:.*ARM'; then fail "$artifact is not an ARM ELF binary" fi done if ! cmp -s "$BASE_DIR/prebuilt/bananarchy-daemons/usr/bin/$daemon" \ "$BASE_DIR/overlay/rootfs/usr/bin/$daemon"; then fail "compiled daemon drift: $daemon" fi done if ! "$BASE_DIR/scripts/build-bananarchy-daemons.sh" --check >/dev/null 2>&1; then fail "compiled idle daemon build check failed" fi for src in src/bananarchy-daemons/common.h \ src/bananarchy-daemons/ims_mbn.h \ src/bananarchy-daemons/ims_qrtr.h \ src/bananarchy-daemons/bananarchy-lid.c \ src/bananarchy-daemons/bananarchy-cover-idle.c \ src/bananarchy-daemons/bananarchy-volume-keys.c \ src/bananarchy-daemons/bananarchy-dsds.c \ src/bananarchy-daemons/bananarchy-modemmonitor.c \ src/bananarchy-daemons/bananarchy-soundmonitor.c \ src/bananarchy-daemons/bananarchy-notifmonitor.c \ src/bananarchy-daemons/bananarchy-run-aligned.c \ src/bananarchy-daemons/bananarchy-session-loop.c \ src/bananarchy-daemons/bananarchy-imsctl.c \ src/bananarchy-daemons/bananarchy-imsd.c \ src/bananarchy-daemons/mm-wds-bind.c; do if [ ! -f "$BASE_DIR/$src" ]; then fail "missing C daemon source: $src" fi done for wds_lib in prebuilt/bananarchy-daemons/usr/lib/libmm-wds-bind.so \ overlay/rootfs/usr/lib/libmm-wds-bind.so; do path="$BASE_DIR/$wds_lib" if [ ! -x "$path" ] || \ [ "$(head -c 4 "$path" | od -An -tx1 | tr -d ' \n')" != "7f454c46" ] || \ ! readelf -h "$path" 2>/dev/null | grep -q 'Type:.*DYN' || \ ! readelf -h "$path" 2>/dev/null | grep -q 'Machine:.*ARM'; then fail "$wds_lib is missing, not executable, or not an ARM ELF DYN library" fi done if ! cmp -s "$BASE_DIR/prebuilt/bananarchy-daemons/usr/lib/libmm-wds-bind.so" \ "$BASE_DIR/overlay/rootfs/usr/lib/libmm-wds-bind.so"; then fail "compiled library drift: libmm-wds-bind.so" fi if ! grep -q 'CLOSED_MASK' "$BASE_DIR/src/bananarchy-daemons/bananarchy-lid.c" || \ ! grep -q 'bananarchy-lid-state.sh' "$BASE_DIR/src/bananarchy-daemons/bananarchy-lid.c" || \ ! grep -q 'sxmo_state.sh' \ "$BASE_DIR/overlay/rootfs/usr/bin/bananarchy-lid-state.sh" || \ ! grep -q 'strcmp(level, "low")' "$BASE_DIR/src/bananarchy-daemons/bananarchy-lid.c"; then fail "the compiled lid daemon lost its raw hall GPIO fallback" fi if ! grep -q 'SOCK_DGRAM' "$BASE_DIR/src/bananarchy-daemons/bananarchy-cover-idle.c" || \ ! grep -q 'STATUS' "$BASE_DIR/src/bananarchy-daemons/bananarchy-cover-idle.c"; then fail "the compiled cover daemon lost the coverctl protocol" fi if grep -qF 'mmap(' "$BASE_DIR/src/bananarchy-daemons/bananarchy-cover-idle.c" || \ ! grep -qF 'write_all' "$BASE_DIR/src/bananarchy-daemons/bananarchy-cover-idle.c" || \ ! grep -qF 'fb_geometry' "$BASE_DIR/src/bananarchy-daemons/bananarchy-cover-idle.c"; then fail "the cover renderer lost the 32-bpp fbdev write() path" fi if ! grep -q 'flock' "$BASE_DIR/src/bananarchy-daemons/common.h" || \ ! grep -q 'prune_devices' "$BASE_DIR/src/bananarchy-daemons/common.h" || \ ! grep -q 'setuid(SESSION_UID)' "$BASE_DIR/src/bananarchy-daemons/common.h" || \ ! grep -q 'KEY_VOLUMEUP' "$BASE_DIR/src/bananarchy-daemons/common.h"; then fail "the compiled daemons lost singleton/stale-fd/privilege guards" fi if grep -RInE "bananarchy-(lid|cover-idle|volume-keys)\.py" \ "$BASE_DIR/overlay/rootfs/etc/init.d" "$BASE_DIR/src/bananarchy-daemons" \ >/dev/null 2>&1; then fail "a Python daemon reference remains in the idle service wiring" fi for stale in overlay/rootfs/usr/bin/bananarchy-lid.py \ overlay/rootfs/usr/bin/bananarchy-cover-idle.py \ overlay/rootfs/usr/bin/bananarchy-volume-keys.py \ rootfs/usr/bin/bananarchy-lid.py \ rootfs/usr/bin/bananarchy-cover-idle.py \ rootfs/usr/bin/bananarchy-volume-keys.py; do if [ -e "$BASE_DIR/$stale" ] || [ -L "$BASE_DIR/$stale" ]; then fail "retired Python daemon still present: $stale" fi done for svc in bananarchy-lid bananarchy-cover-display bananarchy-volume-keys; do case "$svc" in bananarchy-lid) want='command="/usr/bin/bananarchy-lid"' ;; bananarchy-cover-display) want='command="/usr/bin/bananarchy-cover-idle"' ;; bananarchy-volume-keys) want='command="/usr/bin/bananarchy-volume-keys"' ;; esac if ! grep -qF "$want" "$BASE_DIR/overlay/rootfs/etc/init.d/$svc"; then fail "$svc does not start its compiled daemon" fi done if ! grep -qF 'xset r rate 300 25' \ "$BASE_DIR/overlay/rootfs/usr/bin/bananarchy-x11-session.sh"; then fail "the X session no longer lowers keypad auto-repeat delay" fi for hook in overlay/rootfs/usr/share/sxmo/default_hooks/sxmo_hook_start.sh \ overlay/rootfs/etc/skel/.config/sxmo/hooks/sxmo_hook_start.sh \ overlay/rootfs/home/user/.config/sxmo/hooks/sxmo_hook_start.sh; do if ! grep -qF 'superctl stop sxmo_networkmonitor' "$BASE_DIR/$hook" || \ ! grep -qF 'bananarchy_kill_matches "nmcli device monitor"' "$BASE_DIR/$hook"; then fail "$hook no longer stops the nmcli device monitor poller" fi done echo "[check] Camera, volume keys and cover spidev wiring..." HW_MODULES="$BASE_DIR/overlay/rootfs/etc/modules-load.d/bananarchy-hardware.conf" if [ ! -f "$HW_MODULES" ] || ! grep -q '^msm8905-cam' "$HW_MODULES"; then fail "the camera driver is no longer loaded at boot" fi if ! grep -q 'msm8905-cam' "$BASE_DIR/overlay/rootfs/etc/local.d/10-bananarchy-hardware.start"; then fail "the local.d hardware fallback no longer loads the camera driver" fi CAM_DRIVER="$BASE_DIR/src/msm8905-cam/msm8905-cam.c" if ! grep -qF 'of_machine_is_compatible("nokia,beatles")' "$CAM_DRIVER" || \ ! grep -qF 'of_machine_is_compatible("nokia,sparkler")' "$CAM_DRIVER" || \ ! grep -qF 'of_machine_is_compatible("nokia,leo")' "$CAM_DRIVER" || \ ! grep -qF 'row_buf' "$CAM_DRIVER" || \ ! grep -qF 'msm8905_cam_demosaic(cam->raw_dma_buf, dst_rgb, cam->rotate_180);' \ "$CAM_DRIVER"; then fail "msm8905-cam orientation (beatles/sparkler/leo) or cached-row demosaic check failed" fi if [ ! -f "$BASE_DIR/scripts/busybox-sbin-applets.txt" ] || \ ! grep -qxF 'reboot' "$BASE_DIR/scripts/busybox-sbin-applets.txt"; then fail "the /sbin BusyBox applet list is missing reboot (Sxmo power menu)" fi if ! grep -q 'busybox-sbin-applets.txt' "$BASE_DIR/scripts/apply-bananarchy-overlay.sh"; then fail "the overlay no longer restores /sbin BusyBox applets" fi if ! grep -qF 'rm -f "$TARGET_ROOTFS/bin/$applet"' \ "$BASE_DIR/scripts/apply-bananarchy-overlay.sh" || \ ! grep -qF 'rm -f "$TARGET_ROOTFS/sbin/$applet"' \ "$BASE_DIR/scripts/apply-bananarchy-overlay.sh"; then fail "the overlay no longer repairs dangling BusyBox applet symlinks" fi if ! grep -q 'bananarchy_set_sink_volume' "$BASE_DIR/overlay/rootfs/usr/bin/sxmo_audio.sh"; then fail "sxmo_audio.sh no longer mirrors volume into the PipeWire sink" fi if ! grep -q 'bananarchy_vol_debounce' "$BASE_DIR/overlay/rootfs/usr/bin/sxmo_audio.sh"; then fail "double volume steps are no longer debounced" fi if ! grep -q 'poll(fds' "$BASE_DIR/src/bananarchy-daemons/bananarchy-volume-keys.c" || \ ! grep -q 'drop_device' "$BASE_DIR/src/bananarchy-daemons/bananarchy-volume-keys.c"; then fail "the compiled volume daemon lost its stale-fd pruning" fi if grep -q '/usr/bin/su' "$BASE_DIR/src/bananarchy-daemons/"*.c; then fail "the compiled daemons still call the nonexistent /usr/bin/su" fi if ! grep -q 'proc/uptime' "$BASE_DIR/overlay/rootfs/usr/bin/sxmo_audio.sh"; then fail "the volume debounce is no longer timestamp based" fi if ! grep -q 'bananarchy-volume-keys' "$BASE_DIR/overlay/rootfs/etc/init.d/bananarchy-volume-keys"; then fail "the volume-key service is missing" fi if check_target nokia-beatles; then if ! grep -q 'spidev@1' "$BASE_DIR/devices/nokia-beatles/qcom-msm8905-nokia-beatles.dts"; then fail "the cover panel spidev@1 node is missing from the shipping DTS/DTB" elif command -v dtc >/dev/null 2>&1 && \ ! dtc -q -I dtb -O dts "$BASE_DIR/devices/nokia-beatles/qcom-msm8905-nokia-beatles.dtb" 2>/dev/null | \ sed 's/\\0/", "/g' | grep -q 'spidev@1'; then fail "the cover panel spidev@1 node is missing from the shipping DTS/DTB" fi if command -v dtc >/dev/null 2>&1 && \ ! dtc -q -I dtb -O dts "$BASE_DIR/devices/nokia-beatles/qcom-msm8905-nokia-beatles.dtb" 2>/dev/null | \ sed 's/\\0/", "/g' | sed -n '/display@0 {/,/^ };/p' | \ grep -q 'spi-max-frequency = <0x17d7840>'; then fail "the beatles main panel lost its 25 MHz high-backlight-safe SPI timing" fi if ! grep -q '^dc_gpio = -1' "$BASE_DIR/overlay/rootfs/etc/bananarchy/cover-display.conf"; then fail "the cover daemon config would collide with the internal panel DC GPIO" fi fi echo "[check] USB SSH access and boot splash..." PAM_SSHD="$BASE_DIR/overlay/rootfs/etc/pam.d/sshd" SSHD_ACCESS="$BASE_DIR/overlay/rootfs/etc/ssh/sshd_config.d/90-bananarchy-access.conf" if [ ! -f "$PAM_SSHD" ] || ! grep -q 'pam_unix.so' "$PAM_SSHD"; then fail "overlay/rootfs/etc/pam.d/sshd is missing (UsePAM yes cannot authenticate)" fi if [ ! -f "$SSHD_ACCESS" ] || \ ! grep -q '^PasswordAuthentication yes' "$SSHD_ACCESS" || \ ! grep -q '^KbdInteractiveAuthentication yes' "$SSHD_ACCESS"; then fail "sshd access drop-in no longer enables password authentication" fi if [ -f "$BASE_DIR/keys/phone_id_ed25519.pub" ]; then for ak in "$BASE_DIR"/overlay/rootfs/etc/skel/.ssh/authorized_keys \ "$BASE_DIR"/overlay/rootfs/home/user/.ssh/authorized_keys \ "$BASE_DIR"/overlay/rootfs/root/.ssh/authorized_keys; do if [ ! -f "$ak" ] || ! cmp -s "$ak" "$BASE_DIR/keys/phone_id_ed25519.pub"; then fail "${ak#$BASE_DIR/} no longer carries the phone SSH key" fi done else echo "[skip] local SSH key keys/phone_id_ed25519.pub is absent; password SSH remains enabled" fi if ! grep -q 'chmod 700 "$ssh_home"' "$BASE_DIR/scripts/apply-bananarchy-overlay.sh" || \ ! grep -q 'chown -R 10000:10000' "$BASE_DIR/scripts/apply-bananarchy-overlay.sh"; then fail "the overlay no longer fixes authorized_keys ownership/modes" fi if ! grep -q 'SSHD_BINARY="/usr/sbin/sshd.pam"' "$BASE_DIR/overlay/rootfs/etc/conf.d/sshd"; then fail "the PAM-enabled sshd binary is no longer pinned" fi if ! grep -q '^ListenAddress 172.16.42.1:2222' "$BASE_DIR/overlay/rootfs/etc/ssh/sshd_config_debug" || \ grep -qE '^[[:space:]]*UsePAM' "$BASE_DIR/overlay/rootfs/etc/ssh/sshd_config_debug"; then fail "the USB-only fallback sshd config is no longer PAM-free and USB-only" fi if ! grep -q 'def release_cmdline' "$BASE_DIR/scripts/sync-beatles-bootfs.py" || \ ! grep -q "missing 'quiet splash'" "$BASE_DIR/scripts/sync-beatles-bootfs.py"; then fail "sync-beatles-bootfs.py no longer restores/guards the quiet splash cmdline" fi if ! grep -q "Plymouth never starts" "$BASE_DIR/scripts/check-beatles-bootimg.py"; then fail "check-beatles-bootimg.py no longer guards the splash cmdline" fi echo "[check] Keypad and Xorg DRM card pinning..." for f in overlay/rootfs/usr/lib/udev/rules.d/99-bananarchy-keypad.rules \ overlay/rootfs/usr/share/X11/xorg.conf.d/60-bananarchy-keypad.conf \ overlay/rootfs/usr/bin/bananarchy-keypad-diagnose.sh; do if [ ! -f "$BASE_DIR/$f" ]; then fail "missing $f" fi done if ! grep -q 'MatchProduct "keypad"' \ "$BASE_DIR/overlay/rootfs/usr/share/X11/xorg.conf.d/60-bananarchy-keypad.conf"; then fail "the keypad Xorg InputClass lost its explicit MatchProduct" fi if ! grep -q 'ID_INPUT_KEYBOARD' \ "$BASE_DIR/overlay/rootfs/usr/lib/udev/rules.d/99-bananarchy-keypad.rules"; then fail "the keypad udev rule no longer forces ID_INPUT_KEYBOARD" fi if ! grep -q 'TAG+="seat"' \ "$BASE_DIR/overlay/rootfs/etc/udev/rules.d/99-bananarchy-input-seat.rules"; then fail "the input seat udev rule no longer tags event nodes for elogind" fi if ! grep -qF 'Option "kmsdev" "/dev/dri/card0"' \ "$BASE_DIR/overlay/rootfs/etc/X11/xorg.conf.d/10-bananarchy-msm8909.conf"; then fail "Xorg no longer pins the main DRM card" fi if check_target nokia-beatles; then echo "[check] 2720 Flip keypad and cover display support..." for f in overlay/rootfs/usr/bin/bananarchy-coverd \ overlay/rootfs/usr/bin/bananarchy-cover-msg \ overlay/rootfs/usr/bin/bananarchy-lid-gate.sh \ overlay/rootfs/usr/bin/bananarchy-lid-state.sh \ overlay/rootfs/etc/init.d/bananarchy-cover-display \ overlay/rootfs/etc/bananarchy/cover-display.conf \ devices/nokia-beatles/cover-panel.dtsi \ devices/nokia-beatles/nokia,beatles-gc9305-ext-panel.bin \ devices/nokia-beatles/nokia,beatles-gc9305-ext-panel.txt; do if [ ! -f "$BASE_DIR/$f" ]; then fail "missing $f" fi done if [ "$(head -c 4 "$BASE_DIR/overlay/rootfs/usr/bin/bananarchy-coverd" | od -An -tx1 | tr -d ' \n')" != "7f454c46" ]; then fail "bananarchy-coverd is no longer the compiled armv7 daemon" fi if ! cmp -s "$BASE_DIR/prebuilt/bananarchy-coverd/usr/bin/bananarchy-coverd" \ "$BASE_DIR/overlay/rootfs/usr/bin/bananarchy-coverd"; then fail "the cover daemon binary drifted from prebuilt/" fi if ! grep -q 'lid-profile' "$BASE_DIR/overlay/rootfs/etc/init.d/bananarchy-cover-display" || \ ! grep -q 'lid-profile' "$BASE_DIR/overlay/rootfs/etc/init.d/bananarchy-lid" || \ ! grep -q 'lid-profile' "$BASE_DIR/overlay/rootfs/etc/init.d/bananarchy-volume-keys"; then fail "the flip-device services lost their lid-profile gate" fi if ! grep -qF 'LID_PROFILE="slider"' "$BASE_DIR/scripts/apply-bananarchy-overlay.sh" || \ ! grep -qF 'LID_PROFILE="flip"' "$BASE_DIR/scripts/apply-bananarchy-overlay.sh" || \ ! grep -qF '$TARGET_ROOTFS/usr/share/bananarchy/lid-profile' \ "$BASE_DIR/scripts/apply-bananarchy-overlay.sh"; then fail "apply-bananarchy-overlay.sh no longer isolates flip vs slider lid profiles" fi if command -v dtc >/dev/null 2>&1; then COVER_SCRATCH="$(mktemp -d "${TMPDIR:-/tmp}/bananarchy-cover-check.XXXXXX")" COVER_DTBO="$COVER_SCRATCH/cover-panel-check.dtbo" COVER_DTS="$COVER_SCRATCH/beatles-cover-check.dts" COVER_DTS_BUILD="$COVER_SCRATCH/beatles-dts-check.dtb" BEATLES_DTB="$BASE_DIR/devices/nokia-beatles/qcom-msm8905-nokia-beatles.dtb" BEATLES_DTS="$BASE_DIR/devices/nokia-beatles/qcom-msm8905-nokia-beatles.dts" if ! dtc -@ -I dts -O dtb -o "$COVER_DTBO" \ "$BASE_DIR/devices/nokia-beatles/cover-panel.dtsi" >/dev/null 2>&1; then fail "devices/nokia-beatles/cover-panel.dtsi does not compile" fi if ! dtc -I dts -O dtb -o "$COVER_DTS_BUILD" "$BEATLES_DTS" >/dev/null 2>&1; then fail "the shipping beatles DTS does not compile" elif ! cmp -s "$COVER_DTS_BUILD" "$BEATLES_DTB"; then fail "the shipping beatles DTB drifted from its DTS source" fi if ! dtc -I dtb -O dts -o "$COVER_DTS" "$BEATLES_DTB" >/dev/null 2>&1; then fail "the shipping beatles DTB cannot be decompiled" else sed 's/\\0/", "/g' "$COVER_DTS" > "$COVER_DTS.norm" mv "$COVER_DTS.norm" "$COVER_DTS" for token in 'qcom,msm-id = <0x14b 0x00>;' \ 'qcom,board-id = <0x1000b 0x100>;' \ 'qcom,pmic-id = <0x1000d 0x00 0x00 0x00>;'; do if ! grep -qF "$token" "$COVER_DTS"; then fail "the shipping beatles DTB lost a stock Qualcomm ID ($token)" fi done if grep -qF 'compatible = "spi-mux"' "$COVER_DTS" || \ grep -qF 'compatible = "gpio-mux"' "$COVER_DTS" || \ grep -qF 'display@1 {' "$COVER_DTS"; then fail "the shipping beatles DTB applies the hardware-gated cover overlay" fi if ! grep -A4 'spidev@1 {' "$COVER_DTS" | grep -qF 'status = "okay"'; then fail "the shipping beatles DTB lost the spidev@1 diagnostic fallback" fi fi rm -rf "$COVER_SCRATCH" fi for f in "$BASE_DIR/overlay/rootfs/usr/share/mkinitfs/files/00-nokia-argon-display.files" \ "$BASE_DIR/devices/nokia-beatles/00-nokia-beatles-display.files"; do if ! grep -qxF '/lib/firmware/nokia,beatles-gc9305-ext-panel.bin' "$f"; then fail "${f#"$BASE_DIR/"} no longer ships the cover firmware in the initramfs" fi done for opt in CONFIG_MULTIPLEXER=m CONFIG_MUX_GPIO=m CONFIG_SPI_MUX=m; do if ! grep -qxF "$opt" "$BASE_DIR/patches/kernel/config-bananarchy-msm8909.armv7"; then fail "kernel config is missing $opt (cover panel spi-mux)" fi done fi if check_target nokia-beatles; then echo "[check] 2720 Flip appended DTB..." BEATLES_DTS="$BASE_DIR/devices/nokia-beatles/qcom-msm8905-nokia-beatles.dts" if ! grep -qF 'qcom,msm-id = <0x14b 0x00>;' "$BEATLES_DTS"; then fail "nokia-beatles DTS lost the stock MSM8905 msm-id" fi if ! grep -qF 'qcom,board-id = <0x1000b 0x100>;' "$BEATLES_DTS"; then fail "nokia-beatles DTS lost the exact stock QRD SKUB board-id" fi if ! grep -qF 'qcom,pmic-id = <0x1000d 0x00 0x00 0x00>;' "$BEATLES_DTS"; then fail "nokia-beatles DTS lost the stock pmic-id" fi if ! grep -qF 'reg = <0x80000000 0x20000000>;' "$BEATLES_DTS"; then fail "nokia-beatles DTS lost the 512 MiB memory fallback" fi if [ "$SKIP_PINNED_HASHES" -eq 1 ]; then echo "[skip] --for-rebuild: skipping pre-rebuild 2720 boot/raw image checks" else if [ -f "$BASE_DIR/images/boot-bananarchy-nokia-beatles.img" ]; then if ! python3 "$BASE_DIR/scripts/check-beatles-bootimg.py"; then fail "2720 boot image validation failed" fi else echo "[skip] local build output images/boot-bananarchy-nokia-beatles.img is absent; prepare-release.sh will rebuild it" fi if [ -f "$BASE_DIR/images/bananarchy-nokia-beatles.img" ]; then if ! python3 "$BASE_DIR/scripts/sync-beatles-bootfs.py" --check --raw-image "$BASE_DIR/images/bananarchy-nokia-beatles.img"; then fail "2720 raw image pmOS_boot filesystem is damaged or stale" fi else echo "[skip] local build output images/bananarchy-nokia-beatles.img is absent; prepare-release.sh will rebuild it" fi fi fi if check_target nokia-coconut; then echo "[check] 800 Tough (nokia-coconut) appended DTB..." COCONUT_DTS="$BASE_DIR/devices/nokia-coconut/qcom-msm8905-nokia-coconut.dts" if ! grep -qF 'qcom,msm-id = <0x14b 0x00>;' "$COCONUT_DTS"; then fail "nokia-coconut DTS lost the stock MSM8905 msm-id" fi if ! grep -qF 'qcom,board-id = <0x1000b 0x100>;' "$COCONUT_DTS"; then fail "nokia-coconut DTS lost the exact stock QRD SKUB board-id" fi if ! grep -qF 'qcom,pmic-id = <0x1000d 0x00 0x00 0x00>;' "$COCONUT_DTS"; then fail "nokia-coconut DTS lost the stock pmic-id" fi if ! grep -qF 'reg = <0x80000000 0x20000000>;' "$COCONUT_DTS"; then fail "nokia-coconut DTS lost the 512 MiB memory fallback" fi if grep -q 'switch-lid-' "$COCONUT_DTS"; then fail "nokia-coconut DTS still carries phantom slider lid-switch nodes" fi if [ "$SKIP_PINNED_HASHES" -eq 1 ]; then echo "[skip] --for-rebuild: skipping pre-rebuild 800 Tough boot image check" elif [ -f "$BASE_DIR/images/boot-bananarchy-nokia-coconut.img" ]; then if ! python3 "$BASE_DIR/scripts/check-beatles-bootimg.py" --device nokia-coconut; then fail "800 Tough boot image validation failed" fi else echo "[skip] local build output images/boot-bananarchy-nokia-coconut.img is absent; prepare-release.sh will rebuild it" fi if [ "$SKIP_PINNED_HASHES" -eq 1 ]; then echo "[skip] --for-rebuild: skipping pre-rebuild 800 Tough raw image bootfs check" elif [ -f "$BASE_DIR/images/bananarchy-nokia-coconut.img" ]; then if ! python3 "$BASE_DIR/scripts/sync-beatles-bootfs.py" --check --device nokia-coconut --raw-image "$BASE_DIR/images/bananarchy-nokia-coconut.img"; then fail "800 Tough raw image pmOS_boot filesystem is damaged or stale" fi else echo "[skip] local build output images/bananarchy-nokia-coconut.img is absent; prepare-release.sh will rebuild it" fi fi if check_target nokia-sparkler nokia-leo; then echo "[check] 8000 4G (nokia-sparkler) appended DTB..." SPARKLER_DTS="$BASE_DIR/devices/nokia-sparkler/qcom-msm8909-nokia-sparkler.dts" if ! grep -qF 'qcom,msm-id = <0xf5 0x00>;' "$SPARKLER_DTS"; then fail "nokia-sparkler DTS lost the stock MSM8909 msm-id" fi if ! grep -qF 'qcom,board-id = <0x08 0x100>;' "$SPARKLER_DTS"; then fail "nokia-sparkler DTS lost the stock MTP board-id" fi if ! grep -qF 'qcom,pmic-id = <0x1000d 0x00 0x00 0x00>;' "$SPARKLER_DTS"; then fail "nokia-sparkler DTS lost the stock pmic-id" fi if ! grep -qF 'reg = <0x80000000 0x20000000>;' "$SPARKLER_DTS"; then fail "nokia-sparkler DTS lost the 512 MiB memory fallback" fi for node in 'sound@7702000' 'vibrator@c000' 'audio-codec@f000'; do if ! grep -qF "$node" "$SPARKLER_DTS"; then fail "nokia-sparkler DTS is missing $node" fi done if [ "$SKIP_PINNED_HASHES" -eq 1 ]; then echo "[skip] --for-rebuild: skipping pre-rebuild 8000 4G boot image check" elif [ -f "$BASE_DIR/images/boot-bananarchy-nokia-sparkler.img" ]; then if ! python3 "$BASE_DIR/scripts/check-beatles-bootimg.py" --device nokia-sparkler; then fail "8000 4G boot image validation failed" fi else echo "[skip] local build output images/boot-bananarchy-nokia-sparkler.img is absent; prepare-release.sh will rebuild it" fi if [ "$SKIP_PINNED_HASHES" -eq 1 ]; then echo "[skip] --for-rebuild: skipping pre-rebuild 8000 4G raw image bootfs check" elif [ -f "$BASE_DIR/images/bananarchy-nokia-sparkler.img" ]; then if ! python3 "$BASE_DIR/scripts/sync-beatles-bootfs.py" --check --device nokia-sparkler --raw-image "$BASE_DIR/images/bananarchy-nokia-sparkler.img"; then fail "8000 4G raw image pmOS_boot filesystem is damaged or stale" fi else echo "[skip] local build output images/bananarchy-nokia-sparkler.img is absent; prepare-release.sh will rebuild it" fi fi echo "[check] Release hygiene..." KCONFIG="$BASE_DIR/patches/kernel/config-bananarchy-msm8909.armv7" for cfg in "$KCONFIG" \ "$BASE_DIR/prebuilt/kernel-6.12.1-msm8916/kernel-config" \ "$BASE_DIR/overlay/rootfs/boot/config"; do if grep -qE '^CONFIG_PSTORE_BLK(_[A-Z0-9_]+)?=' "$cfg" 2>/dev/null || \ grep -qx 'CONFIG_PSTORE_ZONE=y' "$cfg" 2>/dev/null || \ ! grep -qxF '# CONFIG_PSTORE_BLK is not set' "$cfg"; then fail "${cfg#"$BASE_DIR/"} still carries the abandoned pstore_blk diagnostic config" fi done for sysmap in "$BASE_DIR/prebuilt/kernel-6.12.1-msm8916/System.map" \ "$BASE_DIR/overlay/rootfs/boot/System.map"; do if grep -q 'pstore_blk_get_config' "$sysmap"; then fail "${sysmap#"$BASE_DIR/"} was built with pstore_blk" fi done for art in prebuilt/kernel-6.12.1-msm8916/mux/mux-core.ko.zst \ prebuilt/kernel-6.12.1-msm8916/mux/mux-gpio.ko.zst \ prebuilt/kernel-6.12.1-msm8916/spi/spi-mux.ko.zst; do if [ ! -f "$BASE_DIR/$art" ]; then fail "missing built spi-mux module: $art" fi done if ! grep -q 'M=drivers/mux modules' "$BASE_DIR/scripts/build-kernel-audio.sh" || \ ! grep -q 'M=drivers/spi modules' "$BASE_DIR/scripts/build-kernel-audio.sh"; then fail "build-kernel-audio.sh no longer builds the spi-mux modules" fi for mod in mux-core mux-gpio spi-mux; do if ! grep -qxF "$mod" "$BASE_DIR/overlay/rootfs/etc/modules-load.d/bananarchy-hardware.conf"; then fail "modules-load.d is missing $mod" fi done echo "[check] Reboot-to-bootloader Fastboot cookie..." TORCH_SRC="$BASE_DIR/src/leds-msm8905-torch/leds-msm8905-torch.c" for token in '#define FASTBOOT_COOKIE_LOW 0x02U' \ '#define FASTBOOT_COOKIE_DUAL 0x0aU' \ 'of_machine_is_compatible("nokia,beatles")' \ 'regmap_write(pon_regmap, QPNP_PON_SOFT_RB_SPARE, cookie)'; do if ! grep -qF "$token" "$TORCH_SRC"; then fail "the torch reboot cookie lost the target-aware lk2nd Fastboot path ($token)" fi done for f in scripts/check-lk2nd-beatles.py scripts/build-lk2nd-beatles.sh \ scripts/test-lk2nd-beatles-port.py; do if grep -qF -- '--allow-missing-cookie' "$BASE_DIR/$f" || \ grep -qF 'allow_missing_cookie' "$BASE_DIR/$f"; then fail "$f still permits a display lk2nd image without the reboot cookie" fi done if ! grep -qF 'opts="--expect-fastboot 0 --expect-display 1"' "$BASE_DIR/scripts/check-rebuild.sh"; then fail "check-rebuild.sh no longer requires the display lk2nd reboot cookie" fi for f in src/sxmo-dmenu/dmenu.c \ overlay/rootfs/usr/bin/sxmo_appmenu.sh \ overlay/rootfs/usr/share/sxmo/default_hooks/sxmo_hook_contextmenu.sh; do if ! grep -qF 'Reboot to loader' "$BASE_DIR/$f"; then fail "$f lost the Reboot to loader menu item" fi if grep -qF 'Reboot to bootloader' "$BASE_DIR/$f"; then fail "$f still uses the long Reboot to bootloader label" fi done POWER_DMENU_SO="$BASE_DIR/prebuilt/sxmo-x11/usr/lib/dwm/plugins/dmenu.so" POWER_DMENU_OVERLAY_SO="$BASE_DIR/overlay/rootfs/usr/lib/dwm/plugins/dmenu.so" for so in "$POWER_DMENU_SO" "$POWER_DMENU_OVERLAY_SO"; do if ! strings "$so" 2>/dev/null | grep -qF '%s Reboot to loader'; then fail "$(basename "$so") lacks the compact Reboot to loader label" fi if strings "$so" 2>/dev/null | grep -qF '%s Reboot to bootloader'; then fail "$(basename "$so") still contains the long bootloader label" fi done if ! grep -qF 'set_kernel_reboot_mode "bootloader"' \ "$BASE_DIR/overlay/rootfs/usr/bin/sxmo_power.sh" || \ ! grep -qF 'force_reboot_cmd "bootloader"' \ "$BASE_DIR/overlay/rootfs/usr/bin/sxmo_power.sh"; then fail "sxmo_power.sh no longer reboots through the canonical bootloader mode" fi if check_target nokia-beatles; then for stale in images/boot-bananarchy-nokia-beatles-debug.img \ images/boot-bananarchy-nokia-beatles-ramoops.img; do if [ -f "$BASE_DIR/$stale" ]; then fail "stale diagnostic boot image is still present: $stale" fi done fi LK2ND_PATCH="$BASE_DIR/bootloader/lk2nd/nokia-beatles.patch" if ! grep -qF 'platform/msm_shared/reboot.c' "$LK2ND_PATCH" || \ ! grep -qF 'beatles low-bit reboot cookie' "$LK2ND_PATCH"; then fail "lk2nd patch is missing the low-bit Fastboot menu reboot cookie" fi if grep -q -- '--debug-boot' "$BASE_DIR/flash-edl.py" || \ grep -q 'resolve_beatles_debug_boot_image' "$BASE_DIR/flash-edl.py"; then fail "flash-edl.py still references the abandoned debug boot image" fi PREPARE_REL="$BASE_DIR/prepare-release.sh" if ! grep -qF 'DISPLAY_IMAGE="images/boot-lk2nd-nokia-beatles-display.img"' "$PREPARE_REL" || \ ! grep -qF 'BOOT_IMAGE="images/boot-bananarchy-nokia-beatles.img"' "$PREPARE_REL" || \ ! grep -qF 'cp "$BOOT_IMAGE" "$RELDIR/"' "$PREPARE_REL" || \ ! grep -qF 'cp "$DISPLAY_IMAGE" "$RELDIR/"' "$PREPARE_REL" || \ ! grep -qF 'python3 scripts/check-beatles-bootimg.py' "$PREPARE_REL" || \ ! grep -qF 'python3 scripts/sync-beatles-bootfs.py --check' "$PREPARE_REL" || \ ! grep -qF 'rm -rf "$RELDIR" "${RELDIR}.zip"' "$PREPARE_REL" || \ grep -qF 'for f in images/boot-bananarchy-nokia-beatles.img "$DISPLAY_IMAGE"' "$PREPARE_REL"; then fail "prepare-release.sh lost decoupled beatles boot/lk2nd validation or clean zip replacement" fi echo "[check] Plugin artifacts..." for source in "$BASE_DIR"/src/dwm-plugins/*_plugin.cpp; do name="$(basename "$source" _plugin.cpp)" if [ ! -f "$BASE_DIR/prebuilt/sxmo-x11/usr/lib/dwm/plugins/$name.so" ]; then fail "missing prebuilt plugin: $name.so" fi done echo "[check] Overlay artifact sync..." if ! "$BASE_DIR/scripts/sync-prebuilt-overlay.sh" --check; then fail "overlay/rootfs artifacts differ from prebuilt/" fi echo "[check] SMS long-message rendering..." SMS_SRC="$BASE_DIR/src/dwm-plugins/sms_plugin.cpp" SMS_HDR="$BASE_DIR/src/dwm-plugins/phone_data.h" if grep -qE '^[[:space:]]*pango_xft_render_layout\(' "$SMS_SRC"; then fail "sms_plugin.cpp must not bulk-render multiline message bodies" fi if ! grep -q 'pango_xft_render_layout_line(' "$SMS_SRC"; then fail "sms_plugin.cpp lost its line-by-line message body renderer" fi for token in msgScrollPx smsTextMetrics stripSmsSimTag; do if ! grep -q "$token" "$SMS_SRC" && ! grep -q "$token" "$SMS_HDR"; then fail "sms plugin lost $token" fi done echo "[check] Local agent config stays ignored..." if [ -d "$BASE_DIR/.git" ]; then if ! git -C "$BASE_DIR" check-ignore -q .bantam.cfg; then fail ".bantam.cfg is no longer gitignored" fi elif ! grep -qxF '.bantam.cfg' "$BASE_DIR/.gitignore"; then fail ".bantam.cfg ignore rule is missing" fi echo "[check] Device initramfs module lists..." for dev in nokia-argon nokia-beatles nokia-coconut nokia-sparkler; do if [ ! -f "$BASE_DIR/devices/$dev/modules-initfs" ]; then fail "missing devices/$dev/modules-initfs" fi done if ! grep -q 'MODULES_INITFS' "$BASE_DIR/scripts/apply-bananarchy-overlay.sh" || \ ! grep -q 'initramfs.load' "$BASE_DIR/scripts/apply-bananarchy-overlay.sh"; then fail "apply-bananarchy-overlay.sh no longer installs the device initramfs module list" fi if [ ! -x "$BASE_DIR/overlay/rootfs/etc/boot-deploy/hooks/10-initramfs-depmod.sh" ] || \ ! sh -n "$BASE_DIR/overlay/rootfs/etc/boot-deploy/hooks/10-initramfs-depmod.sh" 2>/dev/null || \ ! grep -q -- 'DEPMOD_BIN' "$BASE_DIR/overlay/rootfs/etc/boot-deploy/hooks/10-initramfs-depmod.sh" || \ ! grep -q -- '-b' "$BASE_DIR/overlay/rootfs/etc/boot-deploy/hooks/10-initramfs-depmod.sh"; then fail "10-initramfs-depmod.sh hook is missing, not executable, or invalid" fi if ! grep -q '10-initramfs-depmod.sh' "$BASE_DIR/scripts/apply-bananarchy-overlay.sh"; then fail "apply-bananarchy-overlay.sh no longer sets permissions on 10-initramfs-depmod.sh" fi if grep -qE '"\$\{?BASE_DIR\}?/prebuilt/kernel-6\.12\.1-msm8916/(leds|camera)/"\*\.ko\*' "$BASE_DIR/scripts/apply-bananarchy-overlay.sh"; then fail "apply-bananarchy-overlay.sh still copies uncompressed .ko files via *.ko* wildcard" fi for dev_img in images/bananarchy-nokia-argon.img images/bananarchy-nokia-beatles.img images/bananarchy-nokia-coconut.img images/bananarchy-nokia-sparkler.img; do artifact_matches_target "$dev_img" || continue if [ ! -f "$BASE_DIR/$dev_img" ]; then echo "[skip] local build output $dev_img is absent; skipping initramfs depmod check" continue fi if ! python3 - "$BASE_DIR/$dev_img" <<'PYEOF' import gzip, os, shutil, struct, subprocess, sys, tempfile img = sys.argv[1] debugfs_bin = shutil.which("debugfs") or "/sbin/debugfs" with open(img, "rb") as f: mbr = f.read(512) start_lba, sectors = struct.unpack_from(" 0: chunk = src.read(min(remaining, 1024 * 1024)) if not chunk: break dst.write(chunk) remaining -= len(chunk) subprocess.run( [debugfs_bin, "-R", f"dump /initramfs {initramfs_gz}", boot_part], check=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, ) with open(initramfs_gz, "rb") as f: raw = gzip.decompress(f.read()) files = {} pos = 0 n = len(raw) while pos + 110 <= n: if raw[pos:pos + 6] not in (b"070701", b"070702"): sys.stderr.write(f"bad cpio header at {pos} in {img}\n") sys.exit(1) namesize = int(raw[pos + 94:pos + 102], 16) filesize = int(raw[pos + 54:pos + 62], 16) name_start = pos + 110 name_end = name_start + namesize name = raw[name_start:name_end - 1].decode("utf-8", errors="replace") if name.startswith("./"): name = name[2:] elif name == ".": name = "" data_start = (name_end + 3) & ~3 data_end = data_start + filesize if name == "TRAILER!!!": break files[name] = raw[data_start:data_end] if name.startswith("usr/lib/modules/") else b"" pos = (data_end + 3) & ~3 mod_base = "usr/lib/modules/6.12.1-msm8916" dep_key = f"{mod_base}/modules.dep" alias_key = f"{mod_base}/modules.alias" if dep_key not in files or not files[dep_key]: sys.stderr.write(f"missing or empty {dep_key} in {img}\n") sys.exit(1) if alias_key not in files or not files[alias_key]: sys.stderr.write(f"missing or empty {alias_key} in {img}\n") sys.exit(1) dep_text = files[dep_key].decode("utf-8", errors="replace") alias_text = files[alias_key].decode("utf-8", errors="replace") for line in dep_text.splitlines(): for tok in line.split(): tok = tok.rstrip(":") if not tok: continue if f"{mod_base}/{tok}" not in files: sys.stderr.write(f"initramfs {img} modules.dep references missing {tok}\n") sys.exit(1) for stale in ("qcom_pil_info", "snd-soc-qcom-common"): if stale in dep_text or stale in alias_text: sys.stderr.write(f"initramfs {img} contains stale metadata for {stale}\n") sys.exit(1) PYEOF then fail "$dev_img initramfs depmod validation failed" fi done echo "[check] Network time synchronisation..." for f in overlay/rootfs/etc/chrony/chrony.conf \ overlay/rootfs/usr/bin/bananarchy-time-sync.sh \ overlay/rootfs/usr/bin/bananarchy-sync-net-time.sh \ overlay/rootfs/etc/init.d/bananarchy-time-sync \ overlay/rootfs/etc/NetworkManager/dispatcher.d/20-bananarchy-time-sync.sh; do if [ ! -f "$BASE_DIR/$f" ]; then fail "missing $f" fi done for f in overlay/rootfs/usr/bin/bananarchy-time-sync.sh \ overlay/rootfs/usr/bin/bananarchy-sync-net-time.sh \ overlay/rootfs/etc/init.d/bananarchy-time-sync \ overlay/rootfs/etc/NetworkManager/dispatcher.d/20-bananarchy-time-sync.sh; do if [ -f "$BASE_DIR/$f" ] && ! sh -n "$BASE_DIR/$f" 2>/dev/null; then fail "shell syntax: $f" fi done if ! grep -q 'Sync net time' "$BASE_DIR/src/sxmo-dmenu/dmenu.c" || \ ! grep -q 'bananarchy-sync-net-time.sh' "$BASE_DIR/src/sxmo-dmenu/dmenu.c"; then fail "Config menu no longer offers Sync net time" fi if ! grep -q 'sync_now' "$BASE_DIR/overlay/rootfs/usr/bin/bananarchy-time-sync.sh" || \ ! grep -q 'bananarchy-sync-net-time.sh' "$BASE_DIR/scripts/apply-bananarchy-overlay.sh"; then fail "manual network time sync is no longer installed" fi if ! grep -q 'iburst' "$BASE_DIR/overlay/rootfs/etc/chrony/chrony.conf" || \ ! grep -q 'cmdport 0' "$BASE_DIR/overlay/rootfs/etc/chrony/chrony.conf"; then fail "chrony.conf must keep iburst and the closed UDP command port" fi if ! grep -q 'bananarchy-time-sync' "$BASE_DIR/scripts/apply-bananarchy-overlay.sh" || \ ! grep -q 'var/lib/chrony' "$BASE_DIR/scripts/apply-bananarchy-overlay.sh"; then fail "overlay no longer enables the time-sync service and chrony driftfile owner" fi if ! grep -q 'var/lib/chrony' "$BASE_DIR/rebuild-image.sh"; then fail "rebuild-image.sh no longer fixes chrony driftfile ownership" fi echo "[check] xkopher link focus visibility..." SMALLWEB_SRC="$BASE_DIR/src/dwm-plugins/smallweb_plugin.cpp" if ! grep -q 'buildRenderRows' "$SMALLWEB_SRC"; then fail "smallweb_plugin.cpp lost its shared wrapped-row builder" fi if ! grep -q 'ensureFocusedLinkVisible' "$SMALLWEB_SRC"; then fail "smallweb_plugin.cpp lost focused-link viewport scrolling" fi if grep -q 'scrollTopLine = std::max(0, static_cast(i) - 4);' "$SMALLWEB_SRC"; then fail "link focus still scrolls by logical line index instead of display rows" fi FOCUS_CALLS="$(grep -c 'ensureFocusedLinkVisible();' "$SMALLWEB_SRC" 2>/dev/null || echo 0)" if [ "$FOCUS_CALLS" -lt 2 ]; then fail "link focus and wrap toggle must both call ensureFocusedLinkVisible" fi if check_target nokia-beatles; then echo "[check] Flip lid responsiveness..." LID_SRC="$BASE_DIR/src/bananarchy-daemons/bananarchy-lid.c" for token in '#define LID_DEBOUNCE_MS 20' '#define HALL_EDGE_MS 20' \ '#define LID_LOOP_MS 20' 'BA_EVIOCGSW' 'LID_STATE_FILE' \ 'LOCKER_FIFO' 'hall_observed' 'fast_until' \ 'if(edge)' 'write_session_file(state, "screenoff")' \ 'write_session_file(state, "lock")' 'cover_send("OPEN")' \ 'locker_send("LOCK\n")' 'run_sxmo_state("lock", "open")' \ 'LID_GENERATION_FILE' 'run_dpms' \ 'bananarchy-lid-state.sh'; do if ! grep -qF "$token" "$LID_SRC"; then fail "the compiled lid daemon lost the instant EV_SW/hall path ($token)" fi done if grep -qF 'unlink(LOCK_FLAG)' "$LID_SRC"; then fail "the lid daemon still auto-unlocks the desktop when the flip opens" fi if grep -qF 'closed != was_closed' "$LID_SRC" || \ grep -qF '#define LID_STABLE_MS 600' "$LID_SRC" || \ grep -qF '#define LID_STABLE_MS 80' "$LID_SRC" || \ grep -qF 'observed = (switch_mask &' "$LID_SRC"; then fail "the compiled lid daemon still oscillates on a stale EV_SW mask" fi echo "[check] Closed-flip main-panel gate..." LID_GATE="$BASE_DIR/overlay/rootfs/usr/bin/bananarchy-lid-gate.sh" if [ ! -x "$LID_GATE" ] || ! sh -n "$LID_GATE" 2>/dev/null; then fail "bananarchy-lid-gate.sh is missing or has bad syntax" fi DPMS_SYNC="$BASE_DIR/overlay/rootfs/usr/bin/bananarchy-display-power-sync" if ! grep -qF 'COVER_MARKER=/run/bananarchy/cover-backlight' "$DPMS_SYNC" || \ ! grep -qF 'kernel_backlight_invert' "$DPMS_SYNC" || \ ! grep -qF 'FORCE=0' "$DPMS_SYNC" || \ ! grep -qF 'STATE_CACHE' "$DPMS_SYNC" || \ ! grep -qF 'LIT_BR="$COVER_BL_LEVEL"' "$DPMS_SYNC" || \ ! grep -qF 'LIT_BR=0' "$DPMS_SYNC" || \ ! grep -qF 'exit 0' "$DPMS_SYNC"; then fail "display-power-sync no longer handles the shared cover backlight" fi for f in overlay/rootfs/usr/bin/sxmo_wm.sh \ overlay/rootfs/usr/bin/sxmo_state.sh \ overlay/rootfs/usr/bin/bananarchy-screen-wake.sh \ overlay/rootfs/usr/bin/bananarchy-display-power-sync \ overlay/rootfs/usr/share/sxmo/default_hooks/sxmo_hook_inputhandler.sh \ overlay/rootfs/etc/skel/.config/sxmo/hooks/sxmo_hook_inputhandler.sh; do if ! grep -qF 'bananarchy-lid-gate.sh' "$BASE_DIR/$f"; then fail "$f can still light the main panel with the flip closed" fi done if ! grep -qF 'coverctl WAKE' \ "$BASE_DIR/overlay/rootfs/usr/bin/bananarchy-cover-event.sh" || \ ! grep -qF 'bananarchy-cover-event.sh ring' \ "$BASE_DIR/overlay/rootfs/usr/share/sxmo/default_hooks/sxmo_hook_ring.sh" || \ ! grep -qF 'bananarchy-cover-event.sh notification' \ "$BASE_DIR/overlay/rootfs/usr/share/sxmo/default_hooks/sxmo_hook_notification.sh"; then fail "closed-flip events are no longer forwarded to the cover display" fi if ! grep -qF 'cover_wake' "$BASE_DIR/src/bananarchy-daemons/bananarchy-cover-idle.c" || \ ! grep -qF 'strcmp(command, "WAKE")' \ "$BASE_DIR/src/bananarchy-daemons/bananarchy-cover-idle.c"; then fail "the cover daemon no longer honours a closed-flip WAKE" fi if ! grep -qF 'probe_cases' \ "$BASE_DIR/src/bananarchy-daemons/bananarchy-cover-idle.c" || \ ! grep -qF 'spi_word_bits' \ "$BASE_DIR/overlay/rootfs/etc/bananarchy/cover-display.conf" || \ ! grep -qF 'KEY_POWER' "$BASE_DIR/src/bananarchy-daemons/common.h" || \ [ ! -x "$BASE_DIR/overlay/rootfs/usr/bin/bananarchy-cover-probe.sh" ]; then fail "the cover hardware sign-off probe, 9-bit mode or KEY_POWER watch is missing" fi if [ ! -x "$BASE_DIR/scripts/test-lid-gate.py" ] || \ ! "$BASE_DIR/scripts/test-lid-gate.py" >/dev/null 2>&1; then fail "host instant-lid / closed-flip gate test failed" fi LID_WRAPPER="$BASE_DIR/overlay/rootfs/usr/bin/bananarchy-lid-state.sh" if [ ! -x "$LID_WRAPPER" ] || \ ! grep -qF 'lid-generation' "$LID_WRAPPER" || \ ! grep -qF 'lid-generation' "$LID_SRC"; then fail "the guarded lid hook wrapper / generation check is missing" fi fi echo "[check] Fast X startup and boot keypad state..." if ! grep -q '^rc_parallel="YES"' "$BASE_DIR/overlay/rootfs/etc/rc.conf"; then fail "OpenRC parallel startup is disabled" fi if grep -qF 'after *' "$BASE_DIR/overlay/rootfs/etc/init.d/local"; then fail "the local service still deadlocks with parallel startup via 'after *'" fi if ! grep -q '^udev_settle_timeout=2' \ "$BASE_DIR/overlay/rootfs/etc/conf.d/udev-settle"; then fail "udev-settle can still hold X startup behind missing modem firmware" fi if ! grep -qF '/run/bananarchy/lid-state' \ "$BASE_DIR/overlay/rootfs/usr/bin/bananarchy-x11-session.sh"; then fail "X no longer uses the debounced lid state at boot" fi if ! grep -qF 'Keep the first 10 s of an open-lid boot unlocked' \ "$BASE_DIR/overlay/rootfs/usr/bin/bananarchy-x11-session.sh"; then fail "X lost the open-lid boot unlock guard against transient xlocker state" fi if ! grep -qF 'dwm-plugin dmenu close' \ "$BASE_DIR/overlay/rootfs/usr/bin/bananarchy-x11-session.sh" || \ ! grep -qF 'xdotool key --clearmodifiers Escape' \ "$BASE_DIR/overlay/rootfs/usr/bin/bananarchy-x11-session.sh"; then fail "X lost the one-shot stale startup keyboard grab cleanup" fi if ! grep -qF 'before bananarchy-cover-display tinydm' \ "$BASE_DIR/overlay/rootfs/etc/init.d/bananarchy-lid"; then fail "the lid daemon no longer starts before tinydm" fi for f in etc/rc.conf etc/conf.d/udev-settle \ usr/bin/bananarchy-x11-session.sh etc/init.d/bananarchy-lid \ etc/init.d/bananarchy-sshd-debug etc/init.d/local \ etc/local.d/20-bananarchy-sshd-debug.start; do # A clean clone has no rootfs yet; rebuild-image.sh bootstraps/overlays it next. [ "$SKIP_PINNED_HASHES" -eq 0 ] || continue [ -e "$BASE_DIR/rootfs/$f" ] || continue if ! cmp -s "$BASE_DIR/overlay/rootfs/$f" "$BASE_DIR/rootfs/$f"; then fail "live rootfs copy drifted from overlay: $f" fi done if [ ! -L "$BASE_DIR/overlay/rootfs/etc/runlevels/default/bananarchy-sshd-debug" ]; then fail "the USB diagnostic sshd is missing from the default runlevel" fi if ! grep -qF 'rc-service bananarchy-sshd-debug status' \ "$BASE_DIR/overlay/rootfs/etc/local.d/20-bananarchy-sshd-debug.start" || \ ! grep -qF 'ln -sf /etc/init.d/bananarchy-sshd-debug' \ "$BASE_DIR/scripts/apply-bananarchy-overlay.sh"; then fail "the USB diagnostic sshd fallback is not independently started" fi if ! grep -qF 'cmd == "CLOSE" || cmd == "UNLOCK"' \ "$BASE_DIR/src/dwm-plugins/locker_plugin.cpp" || \ ! grep -qF 'unlockPhone(false);' \ "$BASE_DIR/src/dwm-plugins/locker_plugin.cpp"; then fail "locker.so no longer releases a stale grab on a trusted unlock CLOSE" fi echo "[check] Known-good keypad wake guard..." if ! grep -qF 'last_wake_ms) < 350' "$BASE_DIR/src/sxmo-dwm/dwm.c" || \ grep -qF 'WAKE_KEY_DEBOUNCE_MS' "$BASE_DIR/src/sxmo-dwm/dwm.c"; then fail "dwm no longer uses the known-good 350 ms wake guard" fi if ! grep -qF 'writeSoftkeySuppress(nowMs() + 120)' \ "$BASE_DIR/src/dwm-plugins/locker_plugin.cpp" || \ grep -qF 'lockActivatedMs < 80' \ "$BASE_DIR/src/dwm-plugins/locker_plugin.cpp"; then fail "locker still suppresses unlock keypad input too long" fi echo "[check] Status bar clock freshness..." DMENU_SRC="$BASE_DIR/src/sxmo-dmenu/dmenu.c" UNLOCK_HOOK="$BASE_DIR/overlay/rootfs/usr/share/sxmo/default_hooks/sxmo_hook_unlock.sh" STATUS_HOOK="$BASE_DIR/overlay/rootfs/usr/share/sxmo/default_hooks/sxmo_hook_statusbar.sh" for token in refresh_status_time write_status_cache 099-time sxmo_status_bar_cache; do if ! grep -q "$token" "$DMENU_SRC"; then fail "dmenu.c no longer refreshes the status clock/cache ($token)" fi done if ! grep -q 'sxmo_hook_statusbar.sh time' "$UNLOCK_HOOK"; then fail "unlock hook no longer refreshes the clock synchronously" fi if ! grep -q 'force_bar' "$STATUS_HOOK"; then fail "statusbar hook no longer forces a root-name refresh on unlock" fi for f in "$UNLOCK_HOOK" "$STATUS_HOOK"; do if ! sh -n "$f" 2>/dev/null; then fail "shell syntax: ${f#$BASE_DIR/}" fi done echo "[check] Event-driven network status..." NET_EVENT="$BASE_DIR/overlay/rootfs/usr/bin/bananarchy-network-event.sh" NET_DISPATCH="$BASE_DIR/overlay/rootfs/etc/NetworkManager/dispatcher.d/30-bananarchy-network-status.sh" for f in "$NET_EVENT" "$NET_DISPATCH"; do if [ ! -f "$f" ]; then fail "missing ${f#$BASE_DIR/}" elif ! sh -n "$f" 2>/dev/null; then fail "shell syntax: ${f#$BASE_DIR/}" fi done for hook in "$BASE_DIR/overlay/rootfs/usr/share/sxmo/default_hooks/sxmo_hook_start.sh" \ "$BASE_DIR/overlay/rootfs/etc/skel/.config/sxmo/hooks/sxmo_hook_start.sh" \ "$BASE_DIR/overlay/rootfs/home/user/.config/sxmo/hooks/sxmo_hook_start.sh"; do if grep -q 'superctl start sxmo_networkmonitor' "$hook"; then fail "${hook#$BASE_DIR/} still starts the nmcli device monitor poller" fi if ! grep -q '30-bananarchy-network-status.sh' "$hook"; then fail "${hook#$BASE_DIR/} no longer documents the dispatcher replacement" fi if ! grep -q 'superctl disable sxmo_networkmonitor' "$hook"; then fail "${hook#$BASE_DIR/} no longer disables the sxmo_networkmonitor superd unit" fi done if ! grep -q 'bananarchy-network-event.sh' "$BASE_DIR/scripts/apply-bananarchy-overlay.sh"; then fail "apply-bananarchy-overlay.sh no longer installs the network event helper" fi echo "[check] Battery longevity settings..." for f in "$BASE_DIR"/devices/*/deviceinfo "$BASE_DIR"/devices/*/deviceinfo.nokia-leo; do [ -f "$f" ] || continue if ! grep -q 'deviceinfo_zram_swap_algo="lz4"' "$f"; then fail "${f#$BASE_DIR/} no longer selects the lz4 zram algorithm" fi done if ! grep -q 'vm.compaction_proactiveness=0' \ "$BASE_DIR/overlay/rootfs/etc/sysctl.d/99-bananarchy-power.conf"; then fail "sysctl.d no longer disables proactive compaction" fi if ! grep -q 'compaction_proactiveness' \ "$BASE_DIR/overlay/rootfs/etc/local.d/10-power-save.start"; then fail "10-power-save.start no longer disables proactive compaction" fi if ! grep -qF 'chgrp video /sys/class/devfreq/1c00000.gpu/governor' \ "$BASE_DIR/overlay/rootfs/etc/local.d/10-power-save.start" || \ ! grep -qF 'GPU_GOV_PATH=/sys/class/devfreq/1c00000.gpu/governor' \ "$BASE_DIR/overlay/rootfs/usr/bin/bananarchy-display-power-sync" || \ ! strings "$BASE_DIR/prebuilt/sxmo-x11/usr/lib/dwm/plugins/locker.so" 2>/dev/null | \ grep -qF '1c00000.gpu/governor'; then fail "GPU devfreq powersave governor permissions or sync paths are missing" fi if ! grep -qF 'open_input_inotify' "$BASE_DIR/src/bananarchy-daemons/common.h" || \ ! grep -qF 'open_input_inotify' "$BASE_DIR/src/bananarchy-daemons/bananarchy-lid.c" || \ ! grep -qF 'open_input_inotify' "$BASE_DIR/src/bananarchy-daemons/bananarchy-volume-keys.c" || \ ! grep -qF 'open_input_inotify_fd' "$BASE_DIR/overlay/rootfs/usr/bin/bananarchy-bt-obex"; then fail "idle input daemons or Bluetooth gamepad bridge reverted to periodic polling" fi if ! grep -qF '/etc/bananarchy-no-deep-standby' \ "$BASE_DIR/overlay/rootfs/usr/share/sxmo/default_hooks/sxmo_hook_screenoff.sh"; then fail "screenoff hook spawns sxmo_autosuspend.sh even when deep standby is disabled" fi if [ ! -f "$BASE_DIR/patches/kernel/0008-msm8909-standby-power-icc-wifi-usb-panel.patch" ] || \ ! grep -qF '0008-msm8909-standby-power-icc-wifi-usb-panel.patch' "$BASE_DIR/scripts/build-kernel-audio.sh" || \ [ ! -f "$BASE_DIR/patches/kernel/0009-msm8909-deep-standby-rpm-usb-wifi-ddr.patch" ] || \ ! grep -qF '0009-msm8909-deep-standby-rpm-usb-wifi-ddr.patch' "$BASE_DIR/scripts/build-kernel-audio.sh" || \ ! grep -qF 'M=drivers/gpu/drm drm_mipi_dbi.ko' "$BASE_DIR/scripts/build-kernel-audio.sh" || \ ! grep -qF 'M=drivers/gpu/drm/tiny modules' "$BASE_DIR/scripts/build-kernel-audio.sh" || \ ! grep -qF 'drm_mipi_dbi.ko.zst' "$BASE_DIR/scripts/apply-bananarchy-overlay.sh" || \ ! grep -qF 'panel-mipi-dbi.ko.zst' "$BASE_DIR/scripts/apply-bananarchy-overlay.sh"; then fail "deep-standby kernel patches 0008/0009 or MIPI DBI module build/install wiring is missing" fi if [ ! -f "$BASE_DIR/prebuilt/kernel-6.12.1-msm8916/drm/drm_mipi_dbi.ko.zst" ] || \ [ ! -f "$BASE_DIR/overlay/rootfs/lib/modules/6.12.1-msm8916/kernel/drivers/gpu/drm/drm_mipi_dbi.ko.zst" ] || \ [ ! -f "$BASE_DIR/prebuilt/kernel-6.12.1-msm8916/drm/panel-mipi-dbi.ko.zst" ] || \ [ ! -f "$BASE_DIR/overlay/rootfs/lib/modules/6.12.1-msm8916/kernel/drivers/gpu/drm/tiny/panel-mipi-dbi.ko.zst" ]; then fail "prebuilt or overlay drm_mipi_dbi.ko.zst / panel-mipi-dbi.ko.zst artifact is missing" fi for kopt in CONFIG_INTERCONNECT_QCOM=y CONFIG_INTERCONNECT_QCOM_MSM8909=y CONFIG_INTERCONNECT_QCOM_SMD_RPM=y CONFIG_FW_DEVLINK_SYNC_STATE_TIMEOUT=y; do if ! grep -qxF "$kopt" "$BASE_DIR/patches/kernel/config-bananarchy-msm8909.armv7"; then fail "kernel config is missing $kopt" fi done if ! grep -qxF 'CONFIG_FW_DEVLINK_SYNC_STATE_TIMEOUT=y' "$BASE_DIR/prebuilt/kernel-6.12.1-msm8916/kernel-config"; then fail "prebuilt kernel-config is missing CONFIG_FW_DEVLINK_SYNC_STATE_TIMEOUT=y" fi if ! grep -q ' qcom_icc_rpm_set$' "$BASE_DIR/prebuilt/kernel-6.12.1-msm8916/System.map" || \ ! grep -q ' ci_hdrc_msm_runtime_suspend$' "$BASE_DIR/prebuilt/kernel-6.12.1-msm8916/System.map" || \ ! grep -q ' rpm_smd_clk_late_cleanup$' "$BASE_DIR/prebuilt/kernel-6.12.1-msm8916/System.map"; then fail "shipped kernel System.map is missing interconnect, ChipIdea USB runtime PM, or RPM clock cleanup symbols" fi if command -v modinfo >/dev/null 2>&1; then if ! modinfo "$BASE_DIR/prebuilt/kernel-6.12.1-msm8916/wcn36xx/wcn36xx.ko.zst" 2>/dev/null | \ grep -q 'screen_off_offload'; then fail "prebuilt wcn36xx.ko.zst is missing the screen_off_offload parameter" fi fi if ! zstd -dc "$BASE_DIR/prebuilt/kernel-6.12.1-msm8916/wcn36xx/wcn36xx.ko.zst" 2>/dev/null | \ strings | grep -qF 'wcn36xx_smd_wlan_host_suspend_ind'; then fail "prebuilt wcn36xx.ko.zst is missing wcn36xx_smd_wlan_host_suspend_ind" fi for dts in \ "$BASE_DIR/devices/nokia-argon/qcom-msm8905-nokia-argon.dts" \ "$BASE_DIR/devices/nokia-beatles/qcom-msm8905-nokia-beatles.dts" \ "$BASE_DIR/devices/nokia-beatles/qcom-msm8905-nokia-beatles-cover.dts" \ "$BASE_DIR/devices/nokia-coconut/qcom-msm8905-nokia-coconut.dts" \ "$BASE_DIR/devices/nokia-sparkler/qcom-msm8909-nokia-sparkler.dts" \ "$BASE_DIR/devices/nokia-sparkler/qcom-msm8909-nokia-leo.dts"; do artifact_matches_target "$dts" || continue if ! grep -qF 'qcom,msm8909-bimc' "$dts" || \ ! grep -qF 'qcom,msm8909-pcnoc' "$dts" || \ ! grep -qF 'qcom,msm8909-snoc' "$dts" || \ ! grep -qF 'interconnects = <0xa0 0x00 0xa0 0x06>;' "$dts" || \ ! grep -qF 'interconnects = <0xa0 0x01 0xa0 0x06>;' "$dts" || \ ! grep -qF 'interconnect-names = "gfx-mem";' "$dts" || \ ! grep -qF 'opp-peak-kBps = <0x25800>;' "$dts"; then fail "${dts#"$BASE_DIR/"} is missing MSM8909 interconnect/GPU-BIMC/OPP bandwidth nodes or 0x25800 floor" elif grep -qF 'regulator-system-load' "$dts"; then fail "${dts#"$BASE_DIR/"} still sets static regulator-system-load instead of pure set_load" fi done if ! grep -qxF 'MODEM_DRX_MODE=0' "$BASE_DIR/overlay/rootfs/etc/bananarchy-power-policy.conf" || \ ! grep -qxF 'DSDS_SECONDARY_MODE=active' "$BASE_DIR/overlay/rootfs/etc/bananarchy-power-policy.conf" || \ ! grep -qxF 'CPU_RPM_SLEEP=0' "$BASE_DIR/overlay/rootfs/etc/bananarchy-power-policy.conf" || \ ! grep -qxF 'CPU_L2_SLEEP=0' "$BASE_DIR/overlay/rootfs/etc/bananarchy-power-policy.conf" || \ ! grep -qxF 'WIFI_LISTEN_INTERVAL=8' "$BASE_DIR/overlay/rootfs/etc/bananarchy-power-policy.conf" || \ ! grep -qxF 'WIFI_SCREEN_OFF_IPV6_MUTE=1' "$BASE_DIR/overlay/rootfs/etc/bananarchy-power-policy.conf" || \ ! grep -qxF 'WIFI_STANDBY_RAT=gsm' "$BASE_DIR/overlay/rootfs/etc/bananarchy-power-policy.conf" || \ ! grep -qF 'if [ "$port" = "all" ]; then' "$BASE_DIR/overlay/rootfs/usr/libexec/msm-modem-uim-selection" || \ ! grep -qF 'exec /usr/bin/bananarchy-dsds' "$BASE_DIR/overlay/rootfs/usr/libexec/msm-modem-uim-selection" || \ grep -qF 'dsds-daemon <<' "$BASE_DIR/overlay/rootfs/usr/libexec/msm-modem-uim-selection" || \ ! grep -qF 'screen_is_idle(' "$BASE_DIR/src/bananarchy-daemons/bananarchy-dsds.c" || \ ! grep -qF 'ExecStart=/usr/bin/bananarchy-modemmonitor' "$BASE_DIR/overlay/rootfs/usr/share/superd/services/sxmo_modemmonitor.service" || \ ! grep -qF 'ExecStart=/usr/bin/bananarchy-soundmonitor' "$BASE_DIR/overlay/rootfs/usr/share/superd/services/sxmo_soundmonitor.service" || \ ! grep -qF 'ExecStart=/usr/bin/bananarchy-notifmonitor' "$BASE_DIR/overlay/rootfs/usr/share/superd/services/sxmo_notificationmonitor.service" || \ ! grep -qF 'exec /usr/bin/bananarchy-run-aligned' "$BASE_DIR/overlay/rootfs/usr/bin/sxmo_run_aligned.sh" || \ ! grep -qF 'exec /usr/bin/bananarchy-session-loop' "$BASE_DIR/overlay/rootfs/usr/bin/bananarchy-x11-session.sh" || \ ! grep -qF 'for dev in /dev/wwan0at*;' "$BASE_DIR/overlay/rootfs/usr/bin/bananarchy-power-policy.sh" || \ ! grep -qF 'modem-ready) modem_ready ;;' "$BASE_DIR/overlay/rootfs/usr/bin/bananarchy-power-policy.sh" || \ ! grep -qF 'wifi-up) wifi_up ;;' "$BASE_DIR/overlay/rootfs/usr/bin/bananarchy-power-policy.sh" || \ ! grep -qF '/usr/bin/bananarchy-power-policy.sh wifi-up' "$BASE_DIR/overlay/rootfs/etc/NetworkManager/dispatcher.d/10-bananarchy-dpm.sh" || \ ! grep -qF '/usr/bin/bananarchy-power-policy.sh unpark-rat' "$BASE_DIR/overlay/rootfs/etc/NetworkManager/dispatcher.d/10-bananarchy-dpm.sh" || \ ! grep -qF '/usr/bin/bananarchy-power-policy.sh modem-ready' "$BASE_DIR/overlay/rootfs/usr/share/sxmo/default_hooks/sxmo_hook_modem.sh" || \ ! grep -qF 'WIFI_OFFLOAD_PATH=/sys/module/wcn36xx/parameters/screen_off_offload' \ "$BASE_DIR/overlay/rootfs/usr/bin/bananarchy-display-power-sync" || \ ! grep -qF 'SPM_SCREEN_OFF_PATH=/sys/module/cpuidle_qcom_spm/parameters/screen_off' \ "$BASE_DIR/overlay/rootfs/usr/bin/bananarchy-display-power-sync" || \ ! grep -qF 'SPM_RPM_SLEEP_PATH=/sys/module/cpuidle_qcom_spm/parameters/rpm_sleep' \ "$BASE_DIR/overlay/rootfs/usr/bin/bananarchy-display-power-sync" || \ ! grep -qF 'BMS_SCREEN_OFF_PATH=/sys/module/pm8916_bms_vm/parameters/screen_off' \ "$BASE_DIR/overlay/rootfs/usr/bin/bananarchy-display-power-sync" || \ ! grep -qF 'sync_bms_screen_off' \ "$BASE_DIR/overlay/rootfs/usr/bin/bananarchy-display-power-sync" || \ ! grep -qF 'sync_spm_screen_off' \ "$BASE_DIR/overlay/rootfs/usr/bin/bananarchy-display-power-sync" || \ ! grep -qF 'CPU_GOV_PATH=/sys/devices/system/cpu/cpufreq/policy0/scaling_governor' \ "$BASE_DIR/overlay/rootfs/usr/bin/bananarchy-display-power-sync" || \ ! grep -qF 'sync_cpu_governor' \ "$BASE_DIR/overlay/rootfs/usr/bin/bananarchy-display-power-sync" || \ ! grep -qF 'sync_standby_policy' \ "$BASE_DIR/overlay/rootfs/usr/bin/bananarchy-display-power-sync" || \ ! grep -qF 'sync_schedutil_rate_limit' \ "$BASE_DIR/overlay/rootfs/usr/bin/bananarchy-display-power-sync"; then fail "userspace DSDS DRX, compiled C daemons, CPU/L2/Wi-Fi power policy, or wcn36xx screen_off_offload sync is missing" fi if [ "$(grep -c 'sxmo_modem\.voicecalls\.lock' "$BASE_DIR/overlay/rootfs/usr/bin/sxmo_modem.sh" 2>/dev/null || echo 0)" -lt 2 ] || \ ! grep -qF 'is_recent_hangup_requested' "$BASE_DIR/overlay/rootfs/usr/bin/sxmo_modem.sh" || \ ! grep -qF 'alreadyClosedBlanked' "$BASE_DIR/src/dwm-plugins/locker_plugin.cpp" || \ ! grep -qF 'lastRejectedCallId' "$BASE_DIR/src/dwm-plugins/callscreen_plugin.cpp"; then fail "voice call lock serialization, stale hangup expiry, or closed-flip hangup guard is missing" fi echo "[check] ZRAM, NetworkManager DNS filter, and target pkill cleanup..." ZRAMSTART="$BASE_DIR/overlay/rootfs/usr/bin/zramstart" NM_DNS_FILTER="$BASE_DIR/overlay/rootfs/usr/lib/NetworkManager/dispatcher.d/50-dns-filter.sh" NM_DNS_CONF="$BASE_DIR/overlay/rootfs/etc/NetworkManager/conf.d/20-bananarchy-dns.conf" BASE_RESOLV="$BASE_DIR/overlay/rootfs/etc/resolv.conf" USB_NMCONN="$BASE_DIR/overlay/rootfs/usr/lib/NetworkManager/system-connections/USB_Networking.nmconnection" CLOUD_SETUP="$BASE_DIR/overlay/rootfs/usr/lib/NetworkManager/dispatcher.d/pre-up.d/90-nm-cloud-setup.sh" if [ ! -x "$ZRAMSTART" ] || ! sh -n "$ZRAMSTART" 2>/dev/null || \ ! grep -qF 'MemTotal' "$ZRAMSTART"; then fail "overlay zramstart is missing, not executable, has bad syntax, or lost MemTotal sizing" fi if [ ! -x "$NM_DNS_FILTER" ] || ! sh -n "$NM_DNS_FILTER" 2>/dev/null || \ ! grep -qF '[ "$_ipcfg" = "/" ]' "$NM_DNS_FILTER" || \ grep -q 'logger -i' "$NM_DNS_FILTER" || \ ! grep -qF 'dhcp4-change' "$NM_DNS_FILTER" || \ ! grep -qF 'dns-change' "$NM_DNS_FILTER"; then fail "overlay NM 50-dns-filter.sh is missing, not executable, has bad syntax, or drifted from DNS resolution invariants" fi if [ ! -f "$NM_DNS_CONF" ] || \ ! grep -qxF 'rc-manager=file' "$NM_DNS_CONF" || \ ! grep -qxF 'dns=dnsmasq' "$NM_DNS_CONF" || \ [ ! -f "$BASE_RESOLV" ] || \ ! grep -qxF 'nameserver 127.0.0.1' "$BASE_RESOLV" || \ [ ! -f "$USB_NMCONN" ] || \ ! grep -qxF 'never-default=true' "$USB_NMCONN" || \ ! grep -qxF 'ignore-auto-dns=true' "$USB_NMCONN" || \ [ ! -x "$CLOUD_SETUP" ] || ! sh -n "$CLOUD_SETUP" 2>/dev/null || \ ! grep -qF 'command -v systemctl' "$CLOUD_SETUP"; then fail "overlay NetworkManager DNS config, baseline resolv.conf, USB_Networking.nmconnection, or 90-nm-cloud-setup.sh guard is invalid" fi for no_pkill in \ "$BASE_DIR/overlay/rootfs/usr/bin/bananarchy-x11-session.sh" \ "$BASE_DIR/overlay/rootfs/usr/share/sxmo/default_hooks/sxmo_hook_start.sh" \ "$BASE_DIR/overlay/rootfs/etc/skel/.config/sxmo/hooks/sxmo_hook_start.sh" \ "$BASE_DIR/overlay/rootfs/home/user/.config/sxmo/hooks/sxmo_hook_start.sh" \ "$BASE_DIR/overlay/rootfs/usr/bin/sxmo_modemaudio.sh" \ "$BASE_DIR/overlay/rootfs/usr/bin/bananarchy-privacy-ctl"; do if grep -q 'pkill' "$no_pkill"; then fail "${no_pkill#"$BASE_DIR/"} still depends on pkill" fi done if [ -x "$BASE_DIR/scripts/test-dns-resolution.py" ] && \ command -v python3 >/dev/null 2>&1 && \ ! python3 -B "$BASE_DIR/scripts/test-dns-resolution.py" >/dev/null 2>&1; then fail "scripts/test-dns-resolution.py failed" fi echo "[check] Boot ICC/OPP/USB/Q6ASM kernel patch 0011 and DTS guards..." if [ ! -f "$BASE_DIR/patches/kernel/0011-msm8909-boot-icc-opp-usb-audio-fixes.patch" ] || \ ! grep -qF '0011-msm8909-boot-icc-opp-usb-audio-fixes.patch' "$BASE_DIR/scripts/build-kernel-audio.sh"; then fail "kernel patch 0011 or its build-kernel-audio.sh wiring is missing" fi for dts in \ "$BASE_DIR/devices/nokia-argon/qcom-msm8905-nokia-argon.dts" \ "$BASE_DIR/devices/nokia-beatles/qcom-msm8905-nokia-beatles.dts" \ "$BASE_DIR/devices/nokia-beatles/qcom-msm8905-nokia-beatles-cover.dts" \ "$BASE_DIR/devices/nokia-coconut/qcom-msm8905-nokia-coconut.dts" \ "$BASE_DIR/devices/nokia-sparkler/qcom-msm8909-nokia-sparkler.dts" \ "$BASE_DIR/devices/nokia-sparkler/qcom-msm8909-nokia-leo.dts"; do artifact_matches_target "$dts" || continue if [ "$(grep -c 'clock-latency-ns' "$dts" 2>/dev/null || echo 0)" -ne 9 ]; then fail "${dts#"$BASE_DIR/"} must declare clock-latency-ns on all 9 opp nodes" fi done for dts in \ "$BASE_DIR/devices/nokia-argon/qcom-msm8905-nokia-argon.dts" \ "$BASE_DIR/devices/nokia-beatles/qcom-msm8905-nokia-beatles.dts" \ "$BASE_DIR/devices/nokia-beatles/qcom-msm8905-nokia-beatles-cover.dts" \ "$BASE_DIR/devices/nokia-coconut/qcom-msm8905-nokia-coconut.dts" \ "$BASE_DIR/devices/nokia-sparkler/qcom-msm8909-nokia-sparkler.dts"; do artifact_matches_target "$dts" || continue if ! grep -A 3 'dai-link-multimedia3 {' "$dts" | grep -qF 'status = "disabled";'; then fail "${dts#"$BASE_DIR/"} must keep dai-link-multimedia3 disabled" fi done for q6cfg in \ "$BASE_DIR/overlay/rootfs/usr/share/q6voiced/q6voiced.conf" \ "$BASE_DIR/overlay/rootfs/etc/conf.d/q6voiced"; do if [ ! -f "$q6cfg" ] || ! grep -qxF 'q6voice_device=3' "$q6cfg"; then fail "${q6cfg#"$BASE_DIR/"} must set q6voice_device=3 for VoiceMMode1 with dai-link-multimedia3 disabled" fi done if [ ! -f "$BASE_DIR/patches/kernel/0010-msm8909-rpm-lpm-bimc-wcd-ldo-uart.patch" ] || \ ! grep -qF '0010-msm8909-rpm-lpm-bimc-wcd-ldo-uart.patch' "$BASE_DIR/scripts/build-kernel-audio.sh" || \ [ ! -f "$BASE_DIR/patches/kernel/0013-msm8909-early-scm-smp-cpufreq.patch" ] || \ ! grep -qF '0013-msm8909-early-scm-smp-cpufreq.patch' "$BASE_DIR/scripts/build-kernel-audio.sh" || \ ! grep -qxF 'CONFIG_QCOM_RPM_MASTER_STATS=y' "$BASE_DIR/patches/kernel/config-bananarchy-msm8909.armv7" || \ ! grep -qxF 'CONFIG_QCOM_RPM_MASTER_STATS=y' "$BASE_DIR/prebuilt/kernel-6.12.1-msm8916/kernel-config" || \ ! grep -q ' qcom_mpm_enter_sleep$' "$BASE_DIR/prebuilt/kernel-6.12.1-msm8916/System.map" || \ ! grep -q ' spm_get_l2_device$' "$BASE_DIR/prebuilt/kernel-6.12.1-msm8916/System.map" || \ ! grep -q ' qcom_msm8909_gdsc_is_active$' "$BASE_DIR/prebuilt/kernel-6.12.1-msm8916/System.map" || \ ! grep -q ' qcom_iommu_resume$' "$BASE_DIR/prebuilt/kernel-6.12.1-msm8916/System.map" || \ ! grep -q ' qcom_scm_set_boot_addr_mc$' "$BASE_DIR/prebuilt/kernel-6.12.1-msm8916/System.map"; then fail "deep-standby kernel patch 0010/0013, RPM master stats config, or vMPM/L2-SAW/IOMMU/early-SCM symbols are missing" fi for dts in \ "$BASE_DIR/devices/nokia-argon/qcom-msm8905-nokia-argon.dts" \ "$BASE_DIR/devices/nokia-beatles/qcom-msm8905-nokia-beatles.dts" \ "$BASE_DIR/devices/nokia-beatles/qcom-msm8905-nokia-beatles-cover.dts" \ "$BASE_DIR/devices/nokia-coconut/qcom-msm8905-nokia-coconut.dts" \ "$BASE_DIR/devices/nokia-sparkler/qcom-msm8909-nokia-sparkler.dts" \ "$BASE_DIR/devices/nokia-sparkler/qcom-msm8909-nokia-leo.dts"; do artifact_matches_target "$dts" || continue if ! grep -qF 'compatible = "qcom,mpm";' "$dts" || \ ! grep -qF 'qcom,msm8909-saw2-v3.0-scu' "$dts" || \ ! grep -qF 'compatible = "qcom,msm8916-rpm-stats";' "$dts" || \ ! grep -qF 'compatible = "qcom,rpm-master-stats";' "$dts" || \ grep -qF 'stdout-path = "serial0";' "$dts"; then fail "${dts#"$BASE_DIR/"} is missing vMPM/L2-SAW/RPM-stats nodes or still exposes serial0 console" fi done if ! grep -qF -- '--dpm-open-port=' "$BASE_DIR/overlay/rootfs/etc/init.d/msm8909-modem-wwan-port" || \ grep -qF '_need_dpm' "$BASE_DIR/overlay/rootfs/etc/init.d/msm8909-modem-wwan-port" || \ grep -qF 'bananarchy-dpm.sh close' "$BASE_DIR/overlay/rootfs/etc/NetworkManager/dispatcher.d/10-bananarchy-dpm.sh" || \ ! grep -qF 'run_qmi_voice_ussd "$ussd_mode" "$ussd_code" "1"' "$BASE_DIR/overlay/rootfs/usr/libexec/msm-modem-uim-selection" || \ ! grep -qF 'run_qmi_voice_ussd "$ussd_mode" "$ussd_code" "0"' "$BASE_DIR/overlay/rootfs/usr/libexec/msm-modem-uim-selection"; then fail "BAM-DMUX wwan0 boot open for ModemManager or QMI VOICE USSD sub=0/sub=1 fallback regressed" fi for dpm_script in \ "$BASE_DIR/overlay/rootfs/etc/init.d/msm8909-modem-wwan-port" \ "$BASE_DIR/overlay/rootfs/etc/NetworkManager/dispatcher.d/10-bananarchy-dpm.sh" \ "$BASE_DIR/overlay/rootfs/usr/bin/bananarchy-dpm.sh" \ "$BASE_DIR/overlay/rootfs/usr/libexec/msm-modem-uim-selection"; do if ! sh -n "$dpm_script" 2>/dev/null; then fail "${dpm_script#"$BASE_DIR/"} has shell syntax errors" fi done echo "[check] Abjects IRC default network..." IRC_SRC="$BASE_DIR/src/dwm-plugins/irc_plugin.cpp" IRC_TSV="$BASE_DIR/overlay/rootfs/home/user/.config/sxmo/irc_servers.tsv" IRC_SKEL="$BASE_DIR/overlay/rootfs/etc/skel/.config/sxmo/irc_servers.tsv" for f in "$IRC_SRC" "$IRC_TSV" "$IRC_SKEL"; do if [ ! -f "$f" ]; then fail "missing ${f#$BASE_DIR/}" fi done if ! grep -q 'irc.abjects.net' "$IRC_SRC" || \ ! grep -q 'Abjects' "$IRC_SRC" || \ ! grep -q '#bananarchy' "$IRC_SRC"; then fail "irc_plugin.cpp no longer defaults to Abjects / #bananarchy" fi for f in "$IRC_TSV" "$IRC_SKEL"; do if ! awk -F '\t' ' $1 == "Abjects" && $2 == "irc.abjects.net" && $3 == "6697" && $4 == "1" && $10 == "#bananarchy" { found = 1 } END { exit !found }' "$f"; then fail "${f#$BASE_DIR/} is not preconfigured for Abjects over TLS 6697" fi done if ! grep -q 'Abjects' "$BASE_DIR/MANUAL.md" || \ ! grep -q 'Abjects' "$BASE_DIR/README.md"; then fail "IRC documentation is not synchronized with the Abjects default" fi echo "[check] Status bar charge icon and clock refresh..." BATTERY_HOOK="$BASE_DIR/overlay/rootfs/usr/share/sxmo/default_hooks/sxmo_hook_battery.sh" TIME_SYNC="$BASE_DIR/overlay/rootfs/usr/bin/bananarchy-time-sync.sh" BATTERY_CASE="$(sed -n '/^ battery)/,/^ ;;/p' "$STATUS_HOOK")" TIME_CASE="$(sed -n '/^ time)/,/^ ;;/p' "$STATUS_HOOK")" if ! printf '%s\n' "$BATTERY_CASE" | grep -q 'set_time' || \ ! printf '%s\n' "$BATTERY_CASE" | grep -q 'force_bar=1'; then fail "battery events no longer republish the charge icon and clock" fi if ! printf '%s\n' "$TIME_CASE" | grep -q 'set_time' || \ printf '%s\n' "$TIME_CASE" | grep -q 'is_screen_dark && exit'; then fail "time action no longer keeps the clock file current while dark" fi if ! grep -q '^ refresh)' "$STATUS_HOOK" || \ ! grep -q 'refresh_statusbar' "$TIME_SYNC"; then fail "post-sync status bar refresh is missing" fi if ! grep -q 'sxmo_hook_statusbar.sh battery' "$BATTERY_HOOK"; then fail "battery hook no longer writes the charge icon" fi if ! grep -q 'rm -f "$ICON_FILE"' "$BATTERY_HOOK"; then fail "forced battery refresh no longer republishes an unchanged charge icon" fi for f in "$BASE_DIR/overlay/rootfs/usr/share/sxmo/default_hooks/sxmo_hook_start.sh" \ "$BASE_DIR/overlay/rootfs/etc/skel/.config/sxmo/hooks/sxmo_hook_start.sh" \ "$BASE_DIR/overlay/rootfs/home/user/.config/sxmo/hooks/sxmo_hook_start.sh"; do if ! grep -q 'statusbar_clock' "$f" || \ ! grep -q 'sxmo_run_aligned.sh 60' "$f"; then fail "${f#$BASE_DIR/} no longer refreshes the clock every minute" fi if ! sh -n "$f" 2>/dev/null; then fail "shell syntax: ${f#$BASE_DIR/}" fi done for f in "$BATTERY_HOOK" "$TIME_SYNC" "$STATUS_HOOK"; do if ! sh -n "$f" 2>/dev/null; then fail "shell syntax: ${f#$BASE_DIR/}" fi done echo "[check] Docker availability..." if ! command -v docker >/dev/null 2>&1; then fail "docker is not installed" fi echo "[check] Version helper..." # Pin the release under test so the check does not break when the wall clock # rolls past the release date (version.sh otherwise derives it from today). for pair in "a1125 ampere" "a1120 cocojamboo" "a1114 carbonara" "a1111 lennon"; do set -- $pair want_ver=$1 want_codename=$2 VERSION="$(BANANARCHY_VERSION="$want_ver" BANANARCHY_CODENAME="" \ "$BASE_DIR/scripts/version.sh" --print 2>/dev/null || true)" CODENAME="$(BANANARCHY_VERSION="$want_ver" BANANARCHY_CODENAME="" \ "$BASE_DIR/scripts/version.sh" --print-codename 2>/dev/null || true)" if [ "$VERSION" != "$want_ver" ]; then fail "scripts/version.sh --print must return $want_ver" fi if [ "$CODENAME" != "$want_codename" ]; then fail "scripts/version.sh --print-codename must return $want_codename for $want_ver" fi done for f in overlay/rootfs/etc/os-release overlay/rootfs/usr/lib/os-release overlay/rootfs/etc/issue overlay/rootfs/etc/motd; do if [ ! -f "$BASE_DIR/$f" ]; then fail "missing $f" elif ! grep -q '@BANANARCHY_VERSION@' "$BASE_DIR/$f" || ! grep -q '@BANANARCHY_CODENAME@' "$BASE_DIR/$f"; then fail "$f lost its version/codename placeholders" fi done echo "[check] Webarchy WebKit renderer profile..." WEBARCHY_SRC="$BASE_DIR/src/dwm-plugins/webarchy_plugin.cpp" WEBARCHY_SO="$BASE_DIR/prebuilt/sxmo-x11/usr/lib/dwm/plugins/webarchy.so" for token in 'webarchySoftwareRendererPreferred' 'configureWebkitRenderer' \ 'WEBKIT_HARDWARE_ACCELERATION_POLICY_NEVER' 'nokia,beatles'; do if ! grep -qF "$token" "$WEBARCHY_SRC"; then fail "webarchy_plugin.cpp is missing the $token renderer fallback" fi done if grep -qF 'WEBKIT_DISABLE_DMABUF_RENDERER", "0"' "$WEBARCHY_SRC" || \ grep -qF 'WEBKIT_DISABLE_COMPOSITING_MODE", "0"' "$WEBARCHY_SRC"; then fail "WebKit presence flags must never be defined as 0" fi if ! strings "$WEBARCHY_SO" 2>/dev/null | grep -qF 'nokia,beatles'; then fail "shipped webarchy.so is stale: rebuild with scripts/build-sxmo-x11.sh" fi if [ ! -x "$BASE_DIR/scripts/test-webarchy-renderer.py" ]; then fail "missing host unit test scripts/test-webarchy-renderer.py" fi if command -v g++ >/dev/null 2>&1 && \ ! "$BASE_DIR/scripts/test-webarchy-renderer.py" >/dev/null 2>&1; then fail "host webarchy renderer profile test failed" fi echo "[check] Webarchy GSettings schemas..." GS_SCHEMA_COMPILER="$BASE_DIR/scripts/compile-gsettings-schemas.sh" if [ ! -x "$GS_SCHEMA_COMPILER" ]; then fail "missing or non-executable scripts/compile-gsettings-schemas.sh" fi if ! command -v glib-compile-schemas >/dev/null 2>&1; then fail "glib-compile-schemas is required to build WebKitGTK rootfs images" fi if ! command -v gsettings >/dev/null 2>&1; then fail "gsettings is required to verify compiled WebKitGTK schemas" fi if [ ! -x "$BASE_DIR/scripts/test-webkit-gsettings.py" ]; then fail "missing host unit test scripts/test-webkit-gsettings.py" fi if ! "$BASE_DIR/scripts/test-webkit-gsettings.py" >/dev/null 2>&1; then fail "host WebKit GSettings schema test failed" fi echo "[check] Idle blank screenlock wiring..." IDLE_BLANK="$BASE_DIR/overlay/rootfs/usr/bin/bananarchy-idle-blank.sh" IDLE_LOCK="$BASE_DIR/overlay/rootfs/usr/bin/bananarchy-idle-lock.sh" SCREEN_WAKE="$BASE_DIR/overlay/rootfs/usr/bin/bananarchy-screen-wake.sh" UNLOCK_HOOK="$BASE_DIR/overlay/rootfs/usr/share/sxmo/default_hooks/sxmo_hook_unlock.sh" for f in "$IDLE_BLANK" "$IDLE_LOCK" "$SCREEN_WAKE" "$UNLOCK_HOOK"; do if [ ! -x "$f" ]; then fail "${f#$BASE_DIR/} is missing or not executable" fi if ! sh -n "$f" 2>/dev/null; then fail "shell syntax: ${f#$BASE_DIR/}" fi done if ! grep -q '"$LOCK_HELPER" arm' "$IDLE_BLANK" || \ ! grep -q 'bananarchy-idle-lock.sh' "$IDLE_BLANK" || \ ! grep -q 'set screenoff' "$IDLE_LOCK"; then fail "idle blanking no longer arms the trusted screenoff lock" fi for f in "$SCREEN_WAKE" "$UNLOCK_HOOK"; do if ! grep -q 'bananarchy-idle-lock.sh' "$f"; then fail "${f#$BASE_DIR/} no longer cancels a pending idle lock on wake" fi done if ! grep -q 'bananarchy-idle-lock.sh' "$BASE_DIR/scripts/apply-bananarchy-overlay.sh"; then fail "apply-bananarchy-overlay.sh no longer installs the idle lock helper" fi if [ -x "$BASE_DIR/scripts/test-idle-blank-lock.py" ] && \ command -v python3 >/dev/null 2>&1 && \ ! "$BASE_DIR/scripts/test-idle-blank-lock.py" >/dev/null 2>&1; then fail "host idle-blank screenlock integration test failed" fi echo "[check] Bluetooth scan stream parsing..." NET_SRC="$BASE_DIR/src/dwm-plugins/networks_plugin.cpp" NET_SO="$BASE_DIR/prebuilt/sxmo-x11/usr/lib/dwm/plugins/networks.so" for token in 'parseBtScanDevices' 'queryBtDevices(const std::string& scanRaw' \ 'queryBtDevices(scanRaw)' 'bluetoothctl power on' \ 'scan on 2>/dev/null'; do if ! grep -qF "$token" "$NET_SRC"; then fail "networks_plugin.cpp is missing the Bluetooth scan fix: $token" fi done if ! strings "$NET_SO" 2>/dev/null | \ grep -qF 'timeout 16 bluetoothctl --timeout 15 scan on'; then fail "shipped networks.so is stale: rebuild with scripts/build-sxmo-x11.sh" fi if [ ! -x "$BASE_DIR/scripts/test-bluetooth-scan.py" ]; then fail "missing host unit test scripts/test-bluetooth-scan.py" fi if command -v g++ >/dev/null 2>&1 && \ ! "$BASE_DIR/scripts/test-bluetooth-scan.py" >/dev/null 2>&1; then fail "host Bluetooth scan parser test failed" fi echo "[check] Live Bluetooth discovery wrapper..." BT_WRAPPER="$BASE_DIR/overlay/rootfs/usr/local/bin/bluetoothctl" BT_HELPER="$BASE_DIR/overlay/rootfs/usr/bin/bananarchy-bt-scan.sh" for f in "$BT_WRAPPER" "$BT_HELPER"; do if [ ! -x "$f" ]; then fail "${f#$BASE_DIR/} is missing or not executable" fi if ! sh -n "$f" 2>/dev/null; then fail "shell syntax: ${f#$BASE_DIR/}" fi done for token in 'BANANARCHY_REAL_BLUETOOTHCTL' 'BANANARCHY_BT_SCAN_HELPER' \ '" scan on "' 'exec "$REAL" "$@"'; do if ! grep -qF "$token" "$BT_WRAPPER"; then fail "bluetoothctl wrapper is missing $token" fi done for token in 'script -q -c' 'transport auto' 'duplicate-data off' \ 'scan off' 'BANANARCHY_BT_SCAN_SECONDS'; do if ! grep -qF "$token" "$BT_HELPER"; then fail "live Bluetooth scan helper is missing $token" fi done if grep -qF 'duplicate-data on' "$BT_HELPER"; then fail "live Bluetooth scan helper must keep duplicate-data off to avoid bluetoothd floods" fi if ! grep -q '^util-linux-misc$' "$PKGS_FILE"; then fail "rootfs package set is missing util-linux-misc (script)" fi if ! grep -q '^bluez-btmgmt$' "$PKGS_FILE"; then fail "rootfs package set is missing bluez-btmgmt (LE enable)" fi LE_HELPER="$BASE_DIR/overlay/rootfs/usr/bin/bananarchy-bt-le-enable.sh" BT_DOAS="$BASE_DIR/overlay/rootfs/etc/doas.d/60-bananarchy-bluetooth.conf" if [ ! -x "$LE_HELPER" ] || ! sh -n "$LE_HELPER" 2>/dev/null; then fail "bananarchy-bt-le-enable.sh is missing or has bad syntax" fi if ! grep -qF 'btmgmt -i hci0 le on' "$LE_HELPER" || \ ! grep -qF 'bananarchy-bt-le-enable.sh' "$BT_HELPER" || \ [ ! -f "$BT_DOAS" ] || \ ! grep -qF 'bananarchy-bt-le-enable.sh' "$BT_DOAS"; then fail "live Bluetooth scan is missing the LE enable helper or doas rule" fi if ! grep -qF 'usr/local/bin/bluetoothctl' \ "$BASE_DIR/scripts/apply-bananarchy-overlay.sh" || \ ! grep -qF 'usr/bin/bananarchy-bt-scan.sh' \ "$BASE_DIR/scripts/apply-bananarchy-overlay.sh"; then fail "apply-bananarchy-overlay.sh no longer installs the live Bluetooth scan wrapper" fi if [ ! -x "$BASE_DIR/scripts/test-bluetooth-live-scan.py" ]; then fail "missing host unit test scripts/test-bluetooth-live-scan.py" fi if ! "$BASE_DIR/scripts/test-bluetooth-live-scan.py" >/dev/null 2>&1; then fail "host live Bluetooth discovery test failed" fi echo "[check] Bluetooth HID connections..." BT_MAIN_CONF="$BASE_DIR/overlay/rootfs/etc/bluetooth/main.conf" BT_INPUT_CONF="$BASE_DIR/overlay/rootfs/etc/bluetooth/input.conf" BT_OBEX="$BASE_DIR/overlay/rootfs/usr/bin/bananarchy-bt-obex" BT_HID_TEST="$BASE_DIR/scripts/test-bluetooth-hid.py" if [ ! -f "$BT_MAIN_CONF" ] || \ ! grep -q '^ControllerMode = dual$' "$BT_MAIN_CONF" || \ grep -q '^ControllerMode = bredr$' "$BT_MAIN_CONF"; then fail "BlueZ main.conf must use dual mode so the HOGP profile can register" fi for token in 'UserspaceHID=true' 'LEAutoSecurity=true' \ 'ClassicBondedOnly=false' 'IdleTimeout=0'; do if ! grep -qF "$token" "$BT_INPUT_CONF"; then fail "BlueZ input.conf is missing the HOGP setting $token" fi done if [ ! -x "$BT_OBEX" ]; then fail "bananarchy-bt-obex is missing or not executable" fi for token in 'prepare_bt_controller()' 'set_hog_preferred_bearer' \ 'PreferredBearer' 'if not do_pair and orig_unbonded'; do if ! grep -qF "$token" "$BT_OBEX"; then fail "bananarchy-bt-obex is missing the connection fix: $token" fi done if grep -qF '["pkill", "-f"' "$BT_OBEX"; then fail "bananarchy-bt-obex stop path depends on the missing process killer" fi if [ ! -x "$BT_HID_TEST" ]; then fail "missing host unit test scripts/test-bluetooth-hid.py" fi if ! "$BT_HID_TEST" >/dev/null 2>&1; then fail "host Bluetooth HID connection test failed" fi echo "[check] Bluetooth 5.x/6.x headset A2DP/HFP, AVRCP, SCO, and power policy..." BT_HEADSET_TEST="$BASE_DIR/scripts/test-bluetooth-headset.py" if [ ! -x "$BT_HEADSET_TEST" ]; then fail "missing host unit test scripts/test-bluetooth-headset.py" fi if ! "$BT_HEADSET_TEST" >/dev/null 2>&1; then fail "host Bluetooth headset verification failed" fi echo "[check] Bluetooth OBEX phone CoD, L2CAP SEQPACKET, pairing agent, and confirmation dialog..." BT_OBEX_TEST="$BASE_DIR/scripts/test-bluetooth-obex.py" if [ ! -x "$BT_OBEX_TEST" ]; then fail "missing host unit test scripts/test-bluetooth-obex.py" fi if ! grep -qF 'Class = 0x5a020c' "$BT_MAIN_CONF" || \ ! grep -qF 'PairableTimeout = 0' "$BT_MAIN_CONF" || \ ! grep -qF 'btmgmt -i hci0 ssp on' "$BASE_DIR/overlay/rootfs/usr/bin/bananarchy-bt-le-enable.sh" || \ ! grep -qF '"KeyboardDisplay"' "$BT_OBEX" || \ ! grep -qF 'PAIR_PROMPT' "$BASE_DIR/src/dwm-plugins/networks_plugin.cpp" || \ ! grep -qF 'BtPairingPrompt' "$BASE_DIR/src/dwm-plugins/networks_plugin.cpp"; then fail "Bluetooth OBEX or KeyboardDisplay pairing dialog configuration is missing" fi if ! "$BT_OBEX_TEST" >/dev/null 2>&1; then fail "host Bluetooth OBEX verification failed" fi BT_CONFD="$BASE_DIR/overlay/rootfs/etc/conf.d/bluetooth" NETWORKS_SO="$BASE_DIR/prebuilt/sxmo-x11/usr/lib/dwm/plugins/networks.so" if [ ! -f "$BT_CONFD" ] || \ ! grep -qF 'supervisor=supervise-daemon' "$BT_CONFD" || \ ! grep -qF -- '--noplugin=hfp,bap,bass,mcp,vcp,micp,csip,ccp,tmap,gmap,asha,midi,neard' "$BT_CONFD"; then fail "overlay/rootfs/etc/conf.d/bluetooth is missing supervise-daemon or --noplugin CPU busy-loop guard" fi if grep -qE '^ReconnectUUIDs=.*(0000111f-|00001112-|0000110a-)' "$BT_MAIN_CONF"; then fail "main.conf ReconnectUUIDs must exclude gateway UUIDs (111f/1112/110a)" fi if ! grep -qF 'format_managed_objects_tsv' "$BT_OBEX" || \ ! grep -qF 'dump-state' "$BT_OBEX" || \ [ ! -f "$NETWORKS_SO" ] || \ ! grep -aqF 'bt_state.tsv' "$NETWORKS_SO" || \ ! grep -aqF 'dump-state' "$NETWORKS_SO"; then fail "Bluetooth ObjectManager bt_state.tsv / dump-state cache is missing from daemon or networks.so" fi echo "[check] Charger plug/unplug charge icon..." BATTERY_RULES="$BASE_DIR/overlay/rootfs/etc/udev/rules.d/85-bananarchy-battery.rules" CHARGE_EVENT="$BASE_DIR/overlay/rootfs/usr/bin/bananarchy-battery-charge-event.sh" if [ ! -x "$CHARGE_EVENT" ] || ! sh -n "$CHARGE_EVENT" 2>/dev/null; then fail "bananarchy-battery-charge-event.sh is missing or has bad syntax" fi if ! grep -q 'bananarchy-battery-charge-event.sh' "$BATTERY_RULES" || \ ! grep -q 'KERNEL=="pm8916-lbc-chgr"' "$BATTERY_RULES" || \ ! grep -q 'POWER_SUPPLY_ONLINE' "$BATTERY_RULES"; then fail "battery udev rules no longer force a charge icon refresh on VBUS events" fi if ! grep -q '"$HOOK" force' "$CHARGE_EVENT" || \ ! grep -q 'flock -n 9' "$CHARGE_EVENT"; then fail "charger event helper no longer forces and coalesces icon refreshes" fi if ! grep -q 'bananarchy-battery-charge-event.sh' \ "$BASE_DIR/scripts/apply-bananarchy-overlay.sh"; then fail "apply-bananarchy-overlay.sh no longer installs the charger event helper" fi if [ -x "$BASE_DIR/scripts/test-battery-charge-event.py" ] && \ command -v python3 >/dev/null 2>&1 && \ ! "$BASE_DIR/scripts/test-battery-charge-event.py" >/dev/null 2>&1; then fail "host charger plug/unplug event test failed" fi echo "[check] GPS-only time source..." GPS_TIME="$BASE_DIR/overlay/rootfs/usr/bin/bananarchy-gps-time-sync.sh" GPS_MODEM="$BASE_DIR/overlay/rootfs/usr/bin/bananarchy-gps-modem.sh" GPS_WRAPPER="$BASE_DIR/overlay/rootfs/usr/bin/bananarchy-sync-gps-time.sh" GPS_CLI="$BASE_DIR/overlay/rootfs/usr/bin/bananarchy-gps" GPS_SRC="$BASE_DIR/src/dwm-plugins/gps_plugin.cpp" DMENU_SRC="$BASE_DIR/src/sxmo-dmenu/dmenu.c" for f in "$GPS_TIME" "$GPS_MODEM" "$GPS_WRAPPER" "$GPS_CLI" \ "$BASE_DIR/overlay/rootfs/usr/bin/bananarchy-time-sync.sh"; do if [ ! -x "$f" ]; then fail "${f#$BASE_DIR/} is missing or not executable" fi if ! sh -n "$f" 2>/dev/null; then fail "shell syntax: ${f#$BASE_DIR/}" fi done for token in 'bananarchy-gps-modem.sh' 'gpsModemArg' \ '--location-enable-3gpp'; do if ! grep -qF -- "$token" "$GPS_SRC"; then fail "gps_plugin.cpp is missing the GPS modem fix: $token" fi done for token in 'Sync GPS time' '@toggle:time_source' 'read_time_source'; do if ! grep -qF "$token" "$DMENU_SRC"; then fail "dmenu.c is missing the GPS time source option: $token" fi done if ! grep -qF 'GPS is the sole time source' \ "$BASE_DIR/overlay/rootfs/usr/bin/bananarchy-time-sync.sh"; then fail "network time helper no longer honours the GPS-only source" fi if ! strings "$BASE_DIR/prebuilt/sxmo-x11/usr/lib/dwm/plugins/gps.so" 2>/dev/null | \ grep -qF 'bananarchy-gps-modem.sh'; then fail "shipped gps.so is stale: rebuild with scripts/build-sxmo-x11.sh" fi if ! strings "$BASE_DIR/prebuilt/sxmo-x11/usr/lib/dwm/plugins/dmenu.so" 2>/dev/null | \ grep -qF 'Sync GPS time'; then fail "shipped dmenu.so is stale: rebuild with scripts/build-sxmo-x11.sh" fi if ! grep -q 'bananarchy-gps-time-sync.sh' "$BASE_DIR/scripts/apply-bananarchy-overlay.sh"; then fail "apply-bananarchy-overlay.sh no longer installs the GPS time helper" fi if [ -x "$BASE_DIR/scripts/test-gps-time-sync.py" ] && \ command -v python3 >/dev/null 2>&1 && \ ! "$BASE_DIR/scripts/test-gps-time-sync.py" >/dev/null 2>&1; then fail "host GPS-only time source test failed" fi if [ -x "$BASE_DIR/scripts/test-time-timezone-sync.py" ] && \ command -v python3 >/dev/null 2>&1 && \ ! "$BASE_DIR/scripts/test-time-timezone-sync.py" >/dev/null 2>&1; then fail "host network time and live timezone sync test failed" fi if check_target nokia-beatles; then echo "[check] Cover display behaviour..." COVER_SRC="$BASE_DIR/src/bananarchy-daemons/bananarchy-cover-idle.c" VOL_SRC="$BASE_DIR/src/bananarchy-daemons/bananarchy-volume-keys.c" COVER_CONF="$BASE_DIR/overlay/rootfs/etc/bananarchy/cover-display.conf" COVER_EVENT="$BASE_DIR/overlay/rootfs/usr/bin/bananarchy-cover-event.sh" COVER_STATUS="$BASE_DIR/overlay/rootfs/usr/bin/bananarchy-cover-status.sh" COVER_INIT="$BASE_DIR/overlay/rootfs/etc/init.d/bananarchy-cover-display" NET_EVENT="$BASE_DIR/overlay/rootfs/usr/bin/bananarchy-network-event.sh" for token in 'BUTTON' 'NETWORK' 'blank_timeout_ms' 'set_backlight' \ 'idle_blank_timeout' 'CLOCK_REDRAW_MS' 'FBIOBLANK' \ 'FB_BLANK_POWERDOWN' 'cover_is_lit'; do if ! grep -qF -- "$token" "$COVER_SRC"; then fail "bananarchy-cover-idle.c is missing cover behaviour: $token" fi done for token in 'cover_button' 'lid_is_closed' 'KEY_POWER'; do if ! grep -qF -- "$token" "$VOL_SRC"; then fail "bananarchy-volume-keys.c no longer wakes the cover: $token" fi done if ! grep -qF 'blank_timeout = auto' "$COVER_CONF" || \ ! grep -qF 'wake_blank_timeout = 8' "$COVER_CONF" || \ ! grep -qF 'backlight_path' "$COVER_CONF"; then fail "cover display config no longer shares the Screen blank timeout" fi for f in "$COVER_EVENT" "$COVER_STATUS" "$NET_EVENT" "$COVER_INIT"; do if ! sh -n "$f" 2>/dev/null; then fail "shell syntax: ${f#$BASE_DIR/}" fi done if [ ! -x "$COVER_STATUS" ]; then fail "bananarchy-cover-status.sh is missing or not executable" fi if ! grep -qF 'bananarchy-cover-status.sh' "$COVER_EVENT" || \ ! grep -qF 'BUTTON' "$COVER_EVENT" || \ ! grep -qF 'network)' "$COVER_EVENT"; then fail "cover event bridge lost the network/button commands" fi for token in 'mute-ring)' 'hangup-call)' 'HANGUP_CLOSE' 'MUTE_RING'; do if ! grep -qF -- "$token" "$COVER_EVENT"; then fail "cover event bridge is missing closed-flip call control: $token" fi done if ! grep -qF 'bananarchy-cover-event.sh network' "$NET_EVENT" || \ ! grep -qF 'bananarchy-cover-event.sh network' "$COVER_INIT"; then fail "network indicators are not published to the cover daemon" fi for f in "$BASE_DIR/prebuilt/bananarchy-daemons/usr/bin/bananarchy-cover-idle" \ "$BASE_DIR/prebuilt/bananarchy-daemons/usr/bin/bananarchy-volume-keys"; do if ! strings "$f" 2>/dev/null | grep -qF 'BUTTON'; then fail "${f#$BASE_DIR/} is stale: rebuild with scripts/build-bananarchy-daemons.sh" fi done if [ ! -x "$BASE_DIR/scripts/test-cover-idle.py" ]; then fail "missing host integration test scripts/test-cover-idle.py" fi if command -v gcc >/dev/null 2>&1 && \ ! "$BASE_DIR/scripts/test-cover-idle.py" >/dev/null 2>&1; then fail "host cover display behaviour test failed" fi echo "[check] Closed-flip external panel backend..." for token in 'cover_hw_release' 'cover_spi_draw' 'hw_init_panel' \ 'mux_closed_level' 'reset_assert_level' 'spi_speed_hz' \ 'BANANARCHY_COVER_SPI_SIM' 'BA_GPIO_GET_LINEHANDLE' \ 'BA_SPI_IOC_MESSAGE' 'MIPI DBI' \ 'cover_main_panel_is_off'; do if ! grep -qF -- "$token" "$COVER_SRC"; then fail "bananarchy-cover-idle.c lost the closed-flip spidev backend: $token" fi done for token in 'backend = kernel' 'main_fb_device = /dev/fb0' \ 'kernel_dpms_helper = /usr/bin/bananarchy-cover-dpms.sh' \ 'kernel_power_sync_helper = /usr/bin/bananarchy-display-power-sync' \ 'kernel_command_path = /sys/kernel/debug/dri/0/command' \ 'kernel_backlight_path = /sys/class/backlight/backlight/brightness' \ 'kernel_backlight_power_path = /sys/class/backlight/backlight/bl_power' \ 'kernel_backlight_marker = /run/bananarchy/cover-backlight' \ 'kernel_backlight_level = 14' \ 'kernel_backlight_invert = 0' \ 'kernel_internal_sleep = 0' \ 'gpiochip_device = auto' \ 'spi_device = /dev/spidev0.1' \ 'spi_mux_gpio = 13' 'spi_dc_gpio = 21' 'spi_reset_gpio = 23' \ 'mux_closed_level = 1' 'mux_open_level = 0' \ 'dc_command_level = 0' 'dc_data_level = 1' \ 'reset_assert_level = 0' 'reset_idle_level = 1' \ 'spi_speed_hz = 25000000'; do if ! grep -qF -- "$token" "$COVER_CONF"; then fail "cover display config lost the spidev polarity key: $token" fi done if ! grep -qF 'flip_open' "$COVER_SRC" || \ ! grep -qF 'cover_bus_release(hw)' "$COVER_SRC" || \ ! grep -qF 'cover_draw(&hw, fb_path, &state)' "$COVER_SRC"; then fail "the cover daemon no longer gates the shared bus on the flip state" fi for token in 'cover_kernel_draw' 'cover_kernel_command' \ 'cover_kernel_replay_firmware' 'cover_kernel_reset' \ 'cover_kernel_backlight' 'cover_kernel_open_backlight' \ 'cover_kernel_marker' 'cover_kernel_power_sync' \ 'cover_kernel_restore_internal' \ 'cover_kernel_display_off' 'kernel_bl_invert' \ 'KERNEL_REDRAW_MS 1000' 'cover_main_panel_is_off' \ 'BA_GPIO_GET_CHIPINFO' 'hw_ensure_gpiochip'; do if ! grep -qF "$token" "$COVER_SRC"; then fail "the kernel-owned cover backend lost $token" fi done if ! grep -qF 'reinit' \ "$BASE_DIR/overlay/rootfs/usr/bin/bananarchy-cover-dpms.sh" || \ [ ! -x "$BASE_DIR/overlay/rootfs/usr/bin/bananarchy-cover-dpms.sh" ]; then fail "the kernel-owned cover backend or its DPMS re-init helper is missing" fi if ! grep -qF 'bananarchy-cover-dpms.sh' \ "$BASE_DIR/src/bananarchy-daemons/bananarchy-lid.c"; then fail "the lid daemon no longer re-initialises the kernel panel on open" fi if [ ! -x "$BASE_DIR/scripts/test-cover-kernel.py" ]; then fail "missing host test scripts/test-cover-kernel.py" elif command -v gcc >/dev/null 2>&1 && \ ! "$BASE_DIR/scripts/test-cover-kernel.py" >/dev/null 2>&1; then fail "host kernel-owned cover panel test failed" fi if [ ! -x "$BASE_DIR/scripts/test-cover-spidev.py" ]; then fail "missing host test scripts/test-cover-spidev.py" fi if command -v gcc >/dev/null 2>&1 && \ ! "$BASE_DIR/scripts/test-cover-spidev.py" >/dev/null 2>&1; then fail "host closed-flip external panel backend test failed" fi for f in "$BASE_DIR/prebuilt/bananarchy-daemons/usr/bin/bananarchy-cover-idle" \ "$BASE_DIR/overlay/rootfs/usr/bin/bananarchy-cover-idle"; do if ! strings "$f" 2>/dev/null | grep -qF 'kernel cmd %s' || \ ! strings "$f" 2>/dev/null | grep -qF 'kernel backlight %u'; then fail "${f#"$BASE_DIR/"} is stale: rebuild with scripts/build-bananarchy-daemons.sh" fi done for f in "$BASE_DIR/prebuilt/bananarchy-daemons/usr/bin/bananarchy-lid" \ "$BASE_DIR/overlay/rootfs/usr/bin/bananarchy-lid"; do if ! strings "$f" 2>/dev/null | grep -qxF 'LOCK'; then fail "${f#"$BASE_DIR/"} is stale: rebuild with scripts/build-bananarchy-daemons.sh" fi done echo "[check] 2720 Flip external panel (opt-in DT)..." if [ ! -f "$BASE_DIR/devices/nokia-beatles/qcom-msm8905-nokia-beatles-cover.dts" ] || \ [ ! -x "$BASE_DIR/scripts/build-beatles-cover-panel.py" ] || \ [ ! -x "$BASE_DIR/scripts/test-cover-dt.py" ]; then fail "missing the opt-in cover DT source or its host validation tools" fi if command -v dtc >/dev/null 2>&1; then if ! "$BASE_DIR/scripts/build-beatles-cover-panel.py" --check >/dev/null 2>&1; then fail "opt-in two-panel DTB validation failed" fi COVER_DT_ARGS="" [ "$SKIP_PINNED_HASHES" -eq 1 ] && COVER_DT_ARGS="--for-rebuild" if ! "$BASE_DIR/scripts/test-cover-dt.py" $COVER_DT_ARGS >/dev/null 2>&1; then fail "host 2720 Flip DT wiring validation failed" fi fi echo "[check] Cover panel diagnostics..." COVER_DIAG="$BASE_DIR/overlay/rootfs/usr/bin/bananarchy-cover-diagnose.sh" if [ ! -x "$COVER_DIAG" ] || ! sh -n "$COVER_DIAG" 2>/dev/null; then fail "bananarchy-cover-diagnose.sh is missing or has bad syntax" fi if ! grep -qF '/dev/fb1' "$COVER_DIAG" || \ ! grep -qF '/sys/class/graphics/fb1' "$COVER_DIAG" || \ ! grep -qF '/dev/spidev0.1' "$COVER_DIAG" || \ ! grep -qF 'spi_mux_gpio' "$COVER_DIAG" || \ ! grep -qF 'bananarchy-coverctl' "$COVER_DIAG"; then fail "cover diagnostics no longer inspect fb1, spidev and the daemon" fi if ! grep -qF 'bananarchy-cover-diagnose.sh' \ "$BASE_DIR/scripts/apply-bananarchy-overlay.sh"; then fail "apply-bananarchy-overlay.sh no longer installs the cover diagnostics" fi echo "[check] 2720 Flip initramfs mux modules..." MODULES_INITFS="$BASE_DIR/devices/nokia-beatles/modules-initfs" for mod in mux-core mux-gpio spi-mux panel-mipi-dbi; do if ! grep -qxF "$mod" "$MODULES_INITFS"; then fail "devices/nokia-beatles/modules-initfs no longer loads $mod in the initramfs" fi done for ko in "$BASE_DIR/overlay/rootfs/lib/modules/6.12.1-msm8916/kernel/drivers/mux/mux-core.ko.zst" \ "$BASE_DIR/overlay/rootfs/lib/modules/6.12.1-msm8916/kernel/drivers/mux/mux-gpio.ko.zst" \ "$BASE_DIR/overlay/rootfs/lib/modules/6.12.1-msm8916/kernel/drivers/spi/spi-mux.ko.zst"; do if [ ! -f "$ko" ]; then fail "${ko#"$BASE_DIR/"} is missing from the overlay module tree" fi done echo "[check] 2720 Flip single-panel rollback..." if [ ! -x "$BASE_DIR/scripts/build-beatles-no-cover-dtb.py" ]; then fail "missing rollback builder scripts/build-beatles-no-cover-dtb.py" elif command -v dtc >/dev/null 2>&1 && \ ! "$BASE_DIR/scripts/build-beatles-no-cover-dtb.py" --check >/dev/null 2>&1; then fail "the single-panel rollback DTB failed validation" fi if ! grep -qF 'parser.add_argument("--dtb"' \ "$BASE_DIR/scripts/sync-beatles-bootfs.py" || \ ! grep -qF 'parser.add_argument("--boot-image"' \ "$BASE_DIR/scripts/sync-beatles-bootfs.py"; then fail "sync-beatles-bootfs.py lost its DTB/boot-image overrides" fi fi echo "[check] Lock call-preservation and Power menu hygiene..." LOCK_HOOK="$BASE_DIR/overlay/rootfs/usr/share/sxmo/default_hooks/sxmo_hook_lock.sh" if grep -qF 'HANGUP_CLOSE' "$LOCK_HOOK"; then fail "sxmo_hook_lock.sh still contains HANGUP_CLOSE call termination" fi for f in "$DMENU_SRC" \ "$BASE_DIR/overlay/rootfs/usr/bin/sxmo_appmenu.sh" \ "$BASE_DIR/overlay/rootfs/usr/share/sxmo/default_hooks/sxmo_hook_contextmenu.sh"; do if grep -qF 'Logout' "$f" || grep -qF 'confirm_logout' "$f"; then fail "${f#"$BASE_DIR/"} still exposes the removed Logout menu item" fi done if ! grep -qF 'isLiveSxmoCallFile' "$BASE_DIR/src/dwm-plugins/phone_data.h" || \ ! grep -qF 'isLiveSxmoCallFile' "$BASE_DIR/src/dwm-plugins/callscreen_plugin.cpp" || \ ! grep -qF 'is_live_sxmo_call_file' "$DMENU_SRC" || \ ! grep -qF 'isLiveSxmoCallFileNeoui' "$BASE_DIR/src/neoui/neoui.cpp" || \ ! grep -qF 'isLiveSxmoCallFileXdrawer' "$BASE_DIR/src/xdrawer/xdrawer.cpp" || \ ! grep -qF 'is_live_call_entry' "$BASE_DIR/src/bananarchy-daemons/bananarchy-dsds.c"; then fail "one or more sxmo_calls readers lost post-call marker filtering" fi echo "[check] 72-hour standby battery optimizations (patch 0012, codec analog, DTS set-load, policy)..." if [ ! -f "$BASE_DIR/patches/kernel/0012-msm8909-standby-wifi-wcd-panel-ldo-bms.patch" ] || \ ! grep -qF '0012-msm8909-standby-wifi-wcd-panel-ldo-bms.patch' "$BASE_DIR/scripts/build-kernel-audio.sh" || \ ! grep -qF 'mmc->ios.vdd ? 200000 : 0' "$BASE_DIR/patches/kernel/0012-msm8909-standby-wifi-wcd-panel-ldo-bms.patch" || \ ! grep -qF 'regulator_set_load(msm_host->mmc->supply.vmmc, 200000)' "$BASE_DIR/patches/kernel/0012-msm8909-standby-wifi-wcd-panel-ldo-bms.patch" || \ ! grep -qF 'regulator_set_load(mmc->supply.vqmmc, 20000)' "$BASE_DIR/patches/kernel/0012-msm8909-standby-wifi-wcd-panel-ldo-bms.patch" || \ ! grep -qF 'regulator_set_load(host->mmc->supply.vmmc, 2000)' "$BASE_DIR/patches/kernel/0012-msm8909-standby-wifi-wcd-panel-ldo-bms.patch" || \ ! grep -qF 'MMC_CAP_AGGRESSIVE_PM' "$BASE_DIR/patches/kernel/0012-msm8909-standby-wifi-wcd-panel-ldo-bms.patch" || \ grep -qF 'caps2 |= MMC_CAP2_FULL_PWR_CYCLE' "$BASE_DIR/patches/kernel/0012-msm8909-standby-wifi-wcd-panel-ldo-bms.patch" || \ ! grep -qF 'pm_runtime_get_sync(&pdev->dev);' "$BASE_DIR/patches/kernel/0012-msm8909-standby-wifi-wcd-panel-ldo-bms.patch" || \ ! grep -qF 'gcc_mss_q6_bimc_axi_clk' "$BASE_DIR/patches/kernel/0012-msm8909-standby-wifi-wcd-panel-ldo-bms.patch" || \ ! grep -qF 'qcom_q6v5_mss.c' "$BASE_DIR/patches/kernel/0012-msm8909-standby-wifi-wcd-panel-ldo-bms.patch" || \ ! grep -qF 'opp-99999975' "$BASE_DIR/patches/kernel/0012-msm8909-standby-wifi-wcd-panel-ldo-bms.patch"; then fail "kernel patch 0012, sdhci-msm HPM/LPM/aggressive-PM, MSS proxy/BIMC, 100 MHz OPP, or build-kernel-audio.sh wiring is missing" fi for ko in "$BASE_DIR/prebuilt/kernel-6.12.1-msm8916/codecs/snd-soc-msm8916-analog.ko.zst" \ "$BASE_DIR/overlay/rootfs/lib/modules/6.12.1-msm8916/kernel/sound/soc/codecs/snd-soc-msm8916-analog.ko.zst"; do if [ ! -f "$ko" ]; then fail "${ko#"$BASE_DIR/"} is missing; rebuild with scripts/build-kernel-audio.sh" fi done for dts in \ "$BASE_DIR/devices/nokia-argon/qcom-msm8905-nokia-argon.dts" \ "$BASE_DIR/devices/nokia-beatles/qcom-msm8905-nokia-beatles.dts" \ "$BASE_DIR/devices/nokia-beatles/qcom-msm8905-nokia-beatles-cover.dts" \ "$BASE_DIR/devices/nokia-coconut/qcom-msm8905-nokia-coconut.dts" \ "$BASE_DIR/devices/nokia-sparkler/qcom-msm8909-nokia-sparkler.dts" \ "$BASE_DIR/devices/nokia-sparkler/qcom-msm8909-nokia-leo.dts"; do artifact_matches_target "$dts" || continue if [ "$(grep -c 'regulator-allow-set-load;' "$dts" 2>/dev/null || echo 0)" -lt 3 ] || \ ! grep -qF 'opp-99999975' "$dts"; then fail "${dts#"$BASE_DIR/"} is missing regulator-allow-set-load on l8/l12 or opp-99999975" fi done if ! grep -qF 'msm8905_cam_spmi_restore' "$BASE_DIR/src/msm8905-cam/msm8905-cam.c" || \ ! grep -qF 'regulator_get_optional' "$BASE_DIR/src/msm8905-cam/msm8905-cam.c" || \ grep -qF 'PM8909_LDO6_EN_CTL' "$BASE_DIR/src/msm8905-cam/msm8905-cam.c" || \ ! grep -qF 'should_skip_while_dark' "$BASE_DIR/src/bananarchy-daemons/bananarchy-run-aligned.c" || \ ! grep -qF -- '--sig-hysteresis' "$BASE_DIR/src/bananarchy-daemons/bananarchy-dsds.c" || \ ! grep -qF 'effective_blank_ms' "$BASE_DIR/src/bananarchy-daemons/bananarchy-cover-idle.c" || \ ! grep -qF 'unpark-rat' "$BASE_DIR/overlay/rootfs/etc/NetworkManager/dispatcher.d/10-bananarchy-dpm.sh" || \ ! grep -qF 'ipv6.method=ignore' "$BASE_DIR/overlay/rootfs/etc/NetworkManager/conf.d/10-power.conf" || \ ! grep -qF 'DISABLE_IPV6' "$BASE_DIR/overlay/rootfs/usr/bin/bananarchy-power-policy.sh" || \ ! grep -qF 'bt_enabled' "$BASE_DIR/overlay/rootfs/usr/bin/sxmo_bluetoothtoggle.sh" || \ ! grep -qF 'bt_enabled' "$BASE_DIR/overlay/rootfs/etc/local.d/10-power-save.start" || \ grep -qE '^for svc in .*bluetooth' "$BASE_DIR/scripts/bootstrap-rootfs-container.sh" || \ ! grep -qF 'runlevels/default/bluetooth' "$BASE_DIR/scripts/apply-bananarchy-overlay.sh" || \ grep -qF 'wifi.scan-interval' "$BASE_DIR/overlay/rootfs/etc/NetworkManager/conf.d/10-power.conf"; then fail "one or more 72h standby optimization guards failed" fi if [ ! -x "$BASE_DIR/scripts/test-standby-power-policy.py" ]; then fail "missing host test scripts/test-standby-power-policy.py" elif ! "$BASE_DIR/scripts/test-standby-power-policy.py" >/dev/null 2>&1; then fail "host standby power policy test failed" fi echo "[check] System-core keypad debouncer (patch 0014, DTS scan/debounce, X11 repeat)..." if [ ! -f "$BASE_DIR/patches/kernel/0014-input-core-keypad-debouncer.patch" ] || \ ! grep -qF '0014-input-core-keypad-debouncer.patch' "$BASE_DIR/scripts/build-kernel-audio.sh" || \ ! grep -qF 'ba_filter_key_bounce' "$BASE_DIR/patches/kernel/0014-input-core-keypad-debouncer.patch" || \ grep -qF 'a/include/linux/input.h' "$BASE_DIR/patches/kernel/0014-input-core-keypad-debouncer.patch" || \ ! grep -qF '/sys/module/input_core/parameters/key_debounce_ms' "$BASE_DIR/overlay/rootfs/etc/local.d/10-power-save.start"; then fail "0014 system-core keypad debouncer patch, build wiring, or boot tuning is missing" fi if [ ! -x "$BASE_DIR/scripts/test-keypad-debouncer.py" ]; then fail "missing executable host test scripts/test-keypad-debouncer.py" elif ! "$BASE_DIR/scripts/test-keypad-debouncer.py" >/dev/null 2>&1; then fail "host keypad debouncer test failed" fi echo "[check] WCD 48 kHz interpolators, CAJON_2_0 analog codec, PipeWire downmix, and gain staging..." if [ ! -x "$BASE_DIR/scripts/test-audio-quality.py" ]; then fail "missing executable host test scripts/test-audio-quality.py" elif ! "$BASE_DIR/scripts/test-audio-quality.py" >/dev/null 2>&1; then fail "host audio quality test failed" fi echo "[check] microSD sdhci@7864000 non-removable and zero-polling invariants..." for dts in \ "$BASE_DIR/devices/nokia-argon/qcom-msm8905-nokia-argon.dts" \ "$BASE_DIR/devices/nokia-beatles/qcom-msm8905-nokia-beatles.dts" \ "$BASE_DIR/devices/nokia-beatles/qcom-msm8905-nokia-beatles-cover.dts" \ "$BASE_DIR/devices/nokia-coconut/qcom-msm8905-nokia-coconut.dts" \ "$BASE_DIR/devices/nokia-sparkler/qcom-msm8909-nokia-sparkler.dts" \ "$BASE_DIR/devices/nokia-sparkler/qcom-msm8909-nokia-leo.dts"; do artifact_matches_target "$dts" || continue if grep -qF 'cd-gpios' "$dts" || grep -qF 'sdc2-cd-' "$dts" || grep -qF 'broken-cd' "$dts"; then fail "${dts#"$BASE_DIR/"} still uses cd-gpios, sdc2-cd-*, or broken-cd on microSD" fi if [ "$(grep -c 'non-removable;' "$dts" 2>/dev/null || echo 0)" -lt 2 ]; then fail "${dts#"$BASE_DIR/"} is missing non-removable; on sdhci@7864000" fi if ! awk '/l11 \{/,/\};/ { if ($0 ~ /regulator-min-microvolt = <0x2d0370>;/) ok=1; if ($0 ~ /0x1b7740/) bad=1 } END { exit((ok && !bad) ? 0 : 1) }' \ "$dts"; then fail "${dts#"$BASE_DIR/"} l11 must set regulator-min-microvolt = <0x2d0370> (2.95 V)" fi done if command -v dtc >/dev/null 2>&1; then for dtb in "$BASE_DIR"/prebuilt/kernel-6.12.1-msm8916/dtbs/*.dtb; do [ -f "$dtb" ] || continue artifact_matches_target "$dtb" || continue dec_dts="$(dtc -q -I dtb -O dts "$dtb" 2>/dev/null | sed 's/\\0/", "/g' || true)" if [ -z "$dec_dts" ]; then fail "failed to decompile ${dtb#"$BASE_DIR/"}" elif printf "%s\n" "$dec_dts" | grep -qE 'cd-gpios|broken-cd'; then fail "${dtb#"$BASE_DIR/"} still contains cd-gpios or broken-cd" elif printf "%s\n" "$dec_dts" | grep -qF 'regulator-system-load'; then fail "${dtb#"$BASE_DIR/"} still contains static regulator-system-load" elif [ "$(printf "%s\n" "$dec_dts" | grep -c 'non-removable;' || echo 0)" -lt 2 ]; then fail "${dtb#"$BASE_DIR/"} is missing non-removable; on sdhci@7864000" elif ! printf "%s\n" "$dec_dts" | awk '/l11 \{/,/\};/ { if ($0 ~ /regulator-min-microvolt = <0x2d0370>;/) ok=1; if ($0 ~ /0x1b7740/) bad=1 } END { exit((ok && !bad) ? 0 : 1) }'; then fail "${dtb#"$BASE_DIR/"} l11 must set regulator-min-microvolt = <0x2d0370> (2.95 V)" fi done fi if check_target nokia-coconut; then echo "[check] Nokia 800 Tough (nokia-coconut) 4x6 keypad DTS/DTB & dual LED invariants..." COCONUT_DTS="$BASE_DIR/devices/nokia-coconut/qcom-msm8905-nokia-coconut.dts" if ! grep -qF '"gpio0", "gpio3", "gpio7", "gpio99", "gpio6", "gpio1"' "$COCONUT_DTS" || \ grep -qF '"gpio52", "gpio56"' "$COCONUT_DTS" || \ ! grep -qF '0x3030067' "$COCONUT_DTS" || \ ! grep -qF '0x304006c' "$COCONUT_DTS" || \ ! grep -qF '0x105000e' "$COCONUT_DTS" || \ ! grep -qF '0x500d4' "$COCONUT_DTS"; then fail "devices/nokia-coconut/qcom-msm8905-nokia-coconut.dts is missing the 6-column 22-key keypad layout" fi if ! awk '/key-end \{/,/\};/ { if ($0 ~ /linux,code = <0x74>;/) found=1 } END { exit(found ? 0 : 1) }' \ "$COCONUT_DTS"; then fail "devices/nokia-coconut/qcom-msm8905-nokia-coconut.dts key-end (gpio98) must map to KEY_POWER (0x74)" fi if ! awk '/resin \{/,/\};/ { if ($0 ~ /linux,code = <0x6c>;/) found=1 } END { exit(found ? 0 : 1) }' \ "$COCONUT_DTS"; then fail "devices/nokia-coconut/qcom-msm8905-nokia-coconut.dts pm8941_resin must map to KEY_DOWN (0x6c)" fi COCONUT_DTB="$BASE_DIR/prebuilt/kernel-6.12.1-msm8916/dtbs/qcom-msm8905-nokia-coconut.dtb" if command -v dtc >/dev/null 2>&1 && [ -f "$COCONUT_DTB" ]; then dec_coco="$(dtc -q -I dtb -O dts "$COCONUT_DTB" 2>/dev/null | sed 's/\\0/", "/g' || true)" if ! printf "%s\n" "$dec_coco" | grep -qF '"gpio0", "gpio3", "gpio7", "gpio99", "gpio6", "gpio1"' || \ printf "%s\n" "$dec_coco" | grep -qF '"gpio52", "gpio56"' || \ ! printf "%s\n" "$dec_coco" | grep -qF '0x3030067' || \ ! printf "%s\n" "$dec_coco" | grep -qF '0x304006c' || \ ! printf "%s\n" "$dec_coco" | grep -qF '0x105000e' || \ ! printf "%s\n" "$dec_coco" | \ awk '/key-end \{/,/\};/ { if ($0 ~ /linux,code = <0x74>;/) found=1 } END { exit(found ? 0 : 1) }' || \ ! printf "%s\n" "$dec_coco" | \ awk '/resin \{/,/\};/ { if ($0 ~ /linux,code = <0x6c>;/) found=1 } END { exit(found ? 0 : 1) }' then fail "prebuilt/kernel-6.12.1-msm8916/dtbs/qcom-msm8905-nokia-coconut.dtb drifted from the 4x6 keypad layout" fi fi if ! grep -qF 'of_machine_is_compatible("nokia,coconut")' "$TORCH_SRC" || \ ! grep -qF '.name = "camera:flash"' "$TORCH_SRC" || \ ! grep -qF '/sys/class/leds/camera:flash/brightness' "$BASE_DIR/src/dwm-plugins/camera_plugin.cpp" || \ ! grep -qF '/sys/class/leds/camera:flash/brightness' "$BASE_DIR/overlay/rootfs/usr/bin/bananarchy-photo"; then fail "nokia-coconut dual LED separation (GPIO_13 white:torch vs GPIO_32 camera:flash) is incomplete" fi fi if check_target nokia-sparkler nokia-leo; then echo "[check] Nokia 8000 4G (nokia-sparkler) keypad, audio, initfs, DRM & dual-GPIO torch invariants..." SPARKLER_DEVINFO="$BASE_DIR/devices/nokia-sparkler/deviceinfo" SPARKLER_INITFS="$BASE_DIR/devices/nokia-sparkler/modules-initfs" SPARKLER_DTB="$BASE_DIR/prebuilt/kernel-6.12.1-msm8916/dtbs/qcom-msm8909-nokia-sparkler.dtb" TORCH_KO="$BASE_DIR/prebuilt/kernel-6.12.1-msm8916/leds/leds-msm8905-torch.ko" if ! grep -qxF 'deviceinfo_drm="true"' "$SPARKLER_DEVINFO"; then fail "devices/nokia-sparkler/deviceinfo must set deviceinfo_drm=\"true\"" fi if ! grep -qxF 'matrix_keypad' "$SPARKLER_INITFS" || \ ! grep -qxF 'matrix_keymap' "$SPARKLER_INITFS"; then fail "devices/nokia-sparkler/modules-initfs must include matrix_keypad and matrix_keymap" fi if ! grep -qF '0x500d4' "$SPARKLER_DTS" || \ ! grep -qF '0x100007f' "$SPARKLER_DTS" || \ ! grep -qF '0x205000e' "$SPARKLER_DTS" || \ ! grep -qF '0x301009e' "$SPARKLER_DTS" || \ ! grep -qF 'clock-frequency = <1094400000>;' "$SPARKLER_DTS" || \ ! awk '/vibrator@c000 \{/,/\};/ { if ($0 ~ /status = "disabled";/) found=1 } END { exit(found ? 0 : 1) }' "$SPARKLER_DTS" || \ grep -qE '0x5008b|0x10002b8|0x20501be|0x30102b9' "$SPARKLER_DTS"; then fail "devices/nokia-sparkler/qcom-msm8909-nokia-sparkler.dts drifted from Sxmo keypad, CPU clock, or haptic invariants" fi if command -v dtc >/dev/null 2>&1 && [ -f "$SPARKLER_DTB" ]; then dec_sparkler="$(dtc -q -I dtb -O dts "$SPARKLER_DTB" 2>/dev/null | sed 's/\\0/", "/g' || true)" if ! printf "%s\n" "$dec_sparkler" | grep -qF 'qcom,msm-id = <0xf5 0x00>;' || \ ! printf "%s\n" "$dec_sparkler" | grep -qF 'qcom,board-id = <0x08 0x100>;' || \ ! printf "%s\n" "$dec_sparkler" | grep -qF 'reg = <0x80000000 0x20000000>;' || \ ! printf "%s\n" "$dec_sparkler" | grep -qF 'sound@7702000' || \ ! printf "%s\n" "$dec_sparkler" | \ awk '/vibrator@c000 \{/,/\};/ { if ($0 ~ /status = "disabled";/) found=1 } END { exit(found ? 0 : 1) }' || \ ! printf "%s\n" "$dec_sparkler" | grep -qF 'audio-codec@f000' || \ ! printf "%s\n" "$dec_sparkler" | grep -qF '0x500d4' || \ ! printf "%s\n" "$dec_sparkler" | grep -qF '0x100007f' || \ ! printf "%s\n" "$dec_sparkler" | grep -qF '0x205000e' || \ ! printf "%s\n" "$dec_sparkler" | grep -qF '0x301009e' || \ printf "%s\n" "$dec_sparkler" | grep -qE '0x5008b|0x10002b8|0x20501be|0x30102b9' then fail "prebuilt/kernel-6.12.1-msm8916/dtbs/qcom-msm8909-nokia-sparkler.dtb drifted from Sparkler DTS invariants" fi fi if ! grep -qF 'vibrate_haptic_audio' "$BASE_DIR/src/dwm-plugins/sxmo_vibrate.c" || \ ! grep -qF '157.0' "$BASE_DIR/src/dwm-plugins/sxmo_vibrate.c" || \ ! grep -qF 'nokia,sparkler' "$BASE_DIR/src/dwm-plugins/sxmo_vibrate.c" || \ ! grep -qF 'SND_PCM_FORMAT_FLOAT_LE' "$BASE_DIR/src/dwm-plugins/sxmo_vibrate.c" || \ ! grep -qF 'pa_sw_volume_to_linear' "$BASE_DIR/src/dwm-plugins/sxmo_vibrate.c" || \ ! grep -qF 'HAPTIC_REF_RX3_VOL' "$BASE_DIR/src/dwm-plugins/sxmo_vibrate.c" || \ ! grep -qF 'isHapticAudioSpeakerDevice' "$BASE_DIR/src/dwm-plugins/music_plugin.cpp" || \ ! grep -qF 'bandreject=f=157' "$BASE_DIR/src/dwm-plugins/music_plugin.cpp" || \ ! grep -qF 'isHapticAudioSpeakerDevice' "$BASE_DIR/src/dwm-plugins/files_plugin.cpp" || \ ! grep -qF 'isHapticAudioSpeakerDevice' "$BASE_DIR/src/dwm-plugins/ringtones_plugin.cpp" || \ ! grep -qF 'AUDIO_ROUTE' "$BASE_DIR/overlay/rootfs/usr/bin/sxmo_audio.sh" || \ ! grep -qF '/etc/mpv/mpv.conf' "$BASE_DIR/scripts/apply-bananarchy-overlay.sh" || \ ! grep -qF 'libpulse' "$BASE_DIR/scripts/build-dwm-plugins.sh" || \ ! grep -qF 'libpulse' "$BASE_DIR/scripts/build-sxmo-x11.sh"; then fail "sxmo_vibrate.c, media player LRA isolation, or plugin build lost nokia-sparkler audio invariants" fi if ! grep -qF 'of_machine_is_compatible("nokia,sparkler")' "$TORCH_SRC" || \ ! grep -qF 'MSM8905_TLMM_GPIO31_PHYS' "$TORCH_SRC" || \ { [ -f "$TORCH_KO" ] && ! grep -qaF 'GPIO_32/GPIO_31 (BC847BS)' "$TORCH_KO"; }; then fail "nokia-sparkler dual-GPIO BC847BS torch support in leds-msm8905-torch is incomplete" fi fi echo "[check] Universal keypad-friendly timer (sxmo_timer.sh, dmenu, hooks)..." TIMER_SH="$BASE_DIR/overlay/rootfs/usr/bin/sxmo_timer.sh" if [ ! -x "$TIMER_SH" ] || ! sh -n "$TIMER_SH" 2>/dev/null; then fail "overlay/rootfs/usr/bin/sxmo_timer.sh is missing, not executable, or has invalid syntax" fi if grep -qE 'boottime_alarm|pkill' "$TIMER_SH" || \ ! grep -qF '# title="$icon_clk Timer"' "$TIMER_SH" || \ ! grep -qF 'HUP INT TERM EXIT' "$TIMER_SH" || \ ! grep -qF 'stop_ringing()' "$TIMER_SH"; then fail "overlay/rootfs/usr/bin/sxmo_timer.sh failed permissionless/cancellation invariants" fi if ! grep -qF 'timer_menu_state' "$DMENU_SRC" || \ ! grep -qF '/usr/bin/sxmo_timer.sh stop_ringing' "$BASE_DIR/overlay/rootfs/usr/share/sxmo/default_hooks/sxmo_hook_mute_ring.sh" || \ ! grep -qF '/usr/bin/sxmo_timer.sh stop_ringing' "$BASE_DIR/overlay/rootfs/usr/share/sxmo/default_hooks/sxmo_hook_discard.sh"; then fail "dmenu or ring mute/discard hooks are missing timer stop integration" fi if ! python3 "$BASE_DIR/scripts/test-timer.py" >/dev/null 2>&1; then fail "scripts/test-timer.py failed" fi echo "[check] Quagr NeoUI pager plugin, opt-in daemon, and cover alerts..." COVER_SRC="$BASE_DIR/src/bananarchy-daemons/bananarchy-cover-idle.c" COVER_EVENT="$BASE_DIR/overlay/rootfs/usr/bin/bananarchy-cover-event.sh" for artifact in \ src/dwm-plugins/quagr_plugin.cpp \ prebuilt/sxmo-x11/usr/lib/dwm/plugins/quagr.so \ overlay/rootfs/usr/lib/dwm/plugins/quagr.so \ scripts/test-quagr.py; do if [ ! -f "$BASE_DIR/$artifact" ]; then fail "missing Quagr artifact: $artifact" fi done for link in \ prebuilt/sxmo-x11/usr/bin/xquagr \ prebuilt/sxmo-x11/usr/bin/quagr \ overlay/rootfs/usr/bin/xquagr \ overlay/rootfs/usr/bin/quagr; do if [ ! -L "$BASE_DIR/$link" ]; then fail "missing Quagr runner symlink: $link" fi done if ! grep -qF 'shouldAutostartQuagr' "$BASE_DIR/src/dwm-plugins/quagr_plugin.cpp" || \ ! grep -qF 'quagr_active' "$COVER_SRC" || \ ! grep -qF 'quagr)' "$COVER_EVENT" || \ ! grep -qF '"xquagr.pid"' "$DMENU_SRC" || \ ! grep -qF 'xquagr' "$BASE_DIR/overlay/rootfs/usr/share/sxmo/default_hooks/sxmo_hook_apps.sh"; then fail "Quagr plugin, cover screen integration, dmenu wiring, or apps hook is incomplete" fi if [ -x "$BASE_DIR/scripts/test-quagr.py" ] && \ command -v python3 >/dev/null 2>&1 && \ ! python3 "$BASE_DIR/scripts/test-quagr.py" >/dev/null 2>&1; then fail "scripts/test-quagr.py failed" fi echo "[check] IMS MBN profile manager, VoLTE, and VoWiFi stack..." for artifact in \ src/bananarchy-daemons/ims_mbn.h \ src/bananarchy-daemons/ims_qrtr.h \ src/bananarchy-daemons/bananarchy-imsctl.c \ src/bananarchy-daemons/bananarchy-imsd.c \ src/dwm-plugins/amr_rtp.h \ src/dwm-plugins/vowifi_aka.h \ src/dwm-plugins/vowifi_ikev2.h \ src/dwm-plugins/bananarchy_vowifi.cpp \ prebuilt/bananarchy-daemons/usr/bin/bananarchy-imsctl \ overlay/rootfs/usr/bin/bananarchy-imsctl \ prebuilt/bananarchy-daemons/usr/bin/bananarchy-imsd \ overlay/rootfs/usr/bin/bananarchy-imsd \ prebuilt/sxmo-x11/usr/bin/bananarchy-vowifi \ overlay/rootfs/usr/bin/bananarchy-vowifi \ overlay/rootfs/etc/bananarchy/ims.conf \ overlay/rootfs/etc/init.d/bananarchy-imsd \ overlay/rootfs/usr/bin/bananarchy-ims-bearer.sh \ overlay/rootfs/etc/NetworkManager/dispatcher.d/40-bananarchy-ims.sh \ scripts/test-ims-mbn.py \ scripts/test-imsd-volte.py \ scripts/test-vowifi-swu-ims.py; do if [ ! -f "$BASE_DIR/$artifact" ]; then fail "missing IMS/VoLTE/VoWiFi artifact: $artifact" fi done for bin in \ prebuilt/sxmo-x11/usr/bin/bananarchy-vowifi \ overlay/rootfs/usr/bin/bananarchy-vowifi; do path="$BASE_DIR/$bin" if [ ! -x "$path" ] || \ [ "$(head -c 4 "$path" | od -An -tx1 | tr -d ' \n')" != "7f454c46" ] || \ ! readelf -h "$path" 2>/dev/null | grep -q 'Machine:.*ARM'; then fail "$bin is missing, not executable, or not an ARM ELF binary" fi done if ! cmp -s "$BASE_DIR/prebuilt/sxmo-x11/usr/bin/bananarchy-vowifi" \ "$BASE_DIR/overlay/rootfs/usr/bin/bananarchy-vowifi"; then fail "compiled bananarchy-vowifi drift between prebuilt and overlay" fi if [ ! -L "$BASE_DIR/overlay/rootfs/etc/runlevels/default/bananarchy-imsd" ]; then fail "missing OpenRC default runlevel link for bananarchy-imsd" fi if [ ! -d "$BASE_DIR/overlay/rootfs/var/lib/bananarchy/ims/profiles" ]; then fail "missing IMS profile repository directory in overlay" fi if ! grep -q '^volte_mode=auto$' "$BASE_DIR/overlay/rootfs/etc/bananarchy/ims.conf" || \ ! grep -q '^vowifi_mode=auto$' "$BASE_DIR/overlay/rootfs/etc/bananarchy/ims.conf"; then fail "ims.conf must ship volte_mode=auto and vowifi_mode=auto by default" fi for shf in \ overlay/rootfs/usr/bin/bananarchy-ims-bearer.sh \ overlay/rootfs/etc/NetworkManager/dispatcher.d/40-bananarchy-ims.sh \ overlay/rootfs/etc/NetworkManager/dispatcher.d/10-bananarchy-dpm.sh \ overlay/rootfs/etc/NetworkManager/dispatcher.d/pre-up.d/10-bananarchy-dpm.sh \ overlay/rootfs/etc/init.d/modemmanager \ overlay/rootfs/usr/libexec/msm-modem-uim-selection \ overlay/rootfs/usr/bin/bananarchy-power-policy.sh \ overlay/rootfs/usr/bin/bananarchy-cover-status.sh \ overlay/rootfs/usr/bin/sxmo_modemdial.sh \ overlay/rootfs/usr/bin/sxmo_modemcall.sh \ overlay/rootfs/usr/bin/sxmo_modemsendsms.sh \ overlay/rootfs/usr/share/sxmo/default_hooks/sxmo_hook_modem.sh \ overlay/rootfs/usr/share/sxmo/default_hooks/sxmo_hook_statusbar.sh; do if [ ! -x "$BASE_DIR/$shf" ] || ! sh -n "$BASE_DIR/$shf" 2>/dev/null; then fail "IMS/call script invalid or not executable: $shf" fi done if [ ! -x "$BASE_DIR/scripts/test-lte-mobile-data.py" ]; then fail "scripts/test-lte-mobile-data.py missing or not executable" fi if ! grep -qF 'libmm-wds-bind.so' "$BASE_DIR/overlay/rootfs/etc/init.d/modemmanager" || \ ! grep -qF 'restore-dsds' "$BASE_DIR/overlay/rootfs/etc/NetworkManager/dispatcher.d/10-bananarchy-dpm.sh" || \ ! grep -qF 'mobile-data-prep' "$BASE_DIR/overlay/rootfs/usr/libexec/msm-modem-uim-selection" || \ ! grep -qF 'close_imsdcm' "$BASE_DIR/src/bananarchy-daemons/bananarchy-imsd.c"; then fail "LTE mobile data WDS bind, restore-dsds, mobile-data-prep, or close_imsdcm guard missing" fi if ! grep -qF 'cs_attach' "$BASE_DIR/src/bananarchy-daemons/ims_qrtr.h" || \ ! grep -qF 'close_qrtr' "$BASE_DIR/src/bananarchy-daemons/bananarchy-imsd.c" || \ ! grep -qF '0x0050' "$BASE_DIR/src/bananarchy-daemons/bananarchy-dsds.c" || \ ! grep -qF 'is_screen_dark' "$BASE_DIR/overlay/rootfs/etc/NetworkManager/dispatcher.d/30-bananarchy-network-status.sh"; then fail "standby battery regression guards (cs_attach, close_qrtr, QMI 0x0050, or dark dispatcher gate) missing" fi if ! grep -qF 'bananarchy-imsctl' "$BASE_DIR/overlay/rootfs/etc/doas.d/50-sxmo.conf" || \ ! grep -qF 'bananarchy-ims-bearer.sh' "$BASE_DIR/overlay/rootfs/etc/doas.d/50-sxmo.conf" || \ ! grep -qF 'isMbnExt' "$BASE_DIR/src/dwm-plugins/files_plugin.cpp" || \ ! grep -qF 'ImsProfiles' "$BASE_DIR/src/dwm-plugins/modem_plugin.cpp" || \ ! grep -qF 'isImsUserspaceCall' "$BASE_DIR/src/dwm-plugins/callscreen_plugin.cpp" || \ ! grep -qF 'AmrWb' "$BASE_DIR/src/dwm-plugins/sip_plugin.cpp"; then fail "IMS/VoLTE/VoWiFi wiring in doas, files, modem, callscreen, or sip is incomplete" fi if command -v python3 >/dev/null 2>&1; then for tst in \ scripts/test-lte-mobile-data.py \ scripts/test-ims-mbn.py \ scripts/test-imsd-volte.py \ scripts/test-vowifi-swu-ims.py; do if ! python3 "$BASE_DIR/$tst" >/dev/null 2>&1; then fail "$tst failed" fi done fi if [ "$FAILURES" -ne 0 ]; then echo "[check] $FAILURES check(s) failed." exit 1 fi echo "[check] All rebuild preflight checks passed."