#!/bin/sh # Fast offline preflight: verify that a clean clone can rebuild Bananarchy. set -eu BASE_DIR="$(cd "$(dirname "$0")/.." && pwd)" FAILURES=0 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-tough 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 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 if [ ! -f "$BASE_DIR/vendor/edl/LICENSE" ]; then fail "missing vendor/edl/LICENSE" 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 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-tough 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-tough": "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 == "nokia-beatles":' "$BASE_DIR/flash-edl.py"; then fail "flash-edl.py no longer writes lk2nd to both slots on the 2720" fi 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 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/README.md \ bootloader/lk2nd/spi-panel-init.h \ bootloader/lk2nd/Dockerfile \ scripts/build-lk2nd-beatles.sh \ scripts/test-lk2nd-beatles-port.py; do if [ ! -f "$BASE_DIR/$f" ]; then fail "missing nokia-beatles lk2nd port file: $f" fi done if [ -f "$BASE_DIR/scripts/make-beatles-lk2nd-bootimg.py" ]; then fail "obsolete binary-patch lk2nd script is still present" fi 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 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 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 # 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 [ -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 \ "69a44f60eb123ebddf600be927155dc4a599ec35b7a0cf80060f4ba01f599f08 images/bananarchy-nokia-argon.img" \ "185ae4fcd8aa4bb65ff03711e50c68a1af073ff13402ddd053e65b65f11b6460 images/bananarchy-nokia-beatles.img" \ "9862c9f7c22988537737e5a1d0d07952200bc5aecc9577107fca775ef8c9514b images/boot-bananarchy-nokia-beatles.img" \ "b5549698c20f4de7603fc746d32bb5baa96ec377e41e74407823c98506fc185d images/boot-lk2nd-nokia-beatles-display.img"; do set -- $pair want=$1 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" 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/bananarchy-lid.c \ src/bananarchy-daemons/bananarchy-cover-idle.c \ src/bananarchy-daemons/bananarchy-volume-keys.c; do if [ ! -f "$BASE_DIR/$src" ]; then fail "missing C daemon source: $src" fi done if ! grep -q 'CLOSED_MASK' "$BASE_DIR/src/bananarchy-daemons/bananarchy-lid.c" || \ ! grep -q 'sxmo_state.sh' "$BASE_DIR/src/bananarchy-daemons/bananarchy-lid.c" || \ ! 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 180 30' \ "$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 'cam->rotate_180 = of_machine_is_compatible("nokia,beatles");' \ "$CAM_DRIVER" || \ ! grep -qF 'msm8905_cam_demosaic(cam->raw_dma_buf, dst_rgb, cam->rotate_180);' \ "$CAM_DRIVER"; then fail "the beatles-only 180-degree camera orientation correction is missing" 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 ! grep -q 'spidev@1' "$BASE_DIR/devices/nokia-beatles/qcom-msm8905-nokia-beatles.dts" || \ ! dtc -I dtb -O dts "$BASE_DIR/devices/nokia-beatles/qcom-msm8905-nokia-beatles.dtb" 2>/dev/null | \ grep -q 'spidev@1'; then fail "the cover panel spidev@1 node is missing from the shipping DTS/DTB" fi if ! dtc -I dtb -O dts "$BASE_DIR/devices/nokia-beatles/qcom-msm8905-nokia-beatles.dtb" 2>/dev/null | \ 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 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 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 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] 2720 Flip keypad and cover display support..." 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 \ overlay/rootfs/usr/bin/bananarchy-coverd \ overlay/rootfs/usr/bin/bananarchy-cover-msg \ 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 ! 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 [ "$(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"; then fail "the flip-device cover service lost its lid-profile gate" fi COVER_SCRATCH="/tmp/bantam/9064bb701d9e9f7c6412f0ea6846d88a" 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" mkdir -p "$COVER_SCRATCH" 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" fi if ! 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" fi 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 'nokia,beatles-gc9305-ext-panel' "$COVER_DTS" || \ ! grep -qF 'display@1 {' "$COVER_DTS"; then fail "the shipping beatles DTB lost the external panel (/dev/fb1) wiring" fi if ! grep -A6 'spidev@1 {' "$COVER_DTS" | grep -qF 'status = "disabled"'; then fail "spidev@1 must stay disabled while spi-mux owns chip select 1" 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 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 rm -f "$COVER_DTBO" "$COVER_DTS" "$COVER_DTS_BUILD" 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 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 [ -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 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 bootloader' "$BASE_DIR/$f"; then fail "$f lost the Reboot to bootloader menu item" 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 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 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 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-tough 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 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 echo "[check] Flip lid responsiveness..." LID_SRC="$BASE_DIR/src/bananarchy-daemons/bananarchy-lid.c" for token in '#define LID_STABLE_MS 80' '#define HALL_POLL_MS 200' 'BA_EVIOCGSW' 'LID_STATE_FILE' \ 'LOCKER_FIFO' 'unlink(LOCK_FLAG)' 'now - last_hall_poll >= HALL_POLL_MS'; do if ! grep -qF "$token" "$LID_SRC"; then fail "the compiled lid daemon lost the low-latency EV_SW/unlock path ($token)" fi done if grep -qF 'closed != was_closed' "$LID_SRC" || \ grep -qF '#define LID_STABLE_MS 600' "$LID_SRC"; then fail "the compiled lid daemon still accepts slow immediate hall transitions" 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 it next. [ -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 lid-open 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 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). VERSION="$(BANANARCHY_VERSION=a1108 BANANARCHY_CODENAME=dejavu \ "$BASE_DIR/scripts/version.sh" --print 2>/dev/null || true)" CODENAME="$(BANANARCHY_VERSION=a1108 BANANARCHY_CODENAME=dejavu \ "$BASE_DIR/scripts/version.sh" --print-codename 2>/dev/null || true)" if [ "$VERSION" != "a1108" ]; then fail "scripts/version.sh --print must return a1108" fi if [ "$CODENAME" != "dejavu" ]; then fail "scripts/version.sh --print-codename must return dejavu" fi 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] 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] 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 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 '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 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] 2720 Flip external panel (/dev/fb1)..." if [ ! -x "$BASE_DIR/scripts/test-cover-dt.py" ]; then fail "missing host DT validation scripts/test-cover-dt.py" elif command -v dtc >/dev/null 2>&1 && \ ! "$BASE_DIR/scripts/test-cover-dt.py" >/dev/null 2>&1; then fail "host 2720 Flip /dev/fb1 DT validation failed" 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 'bananarchy-coverctl' "$COVER_DIAG"; then fail "cover diagnostics no longer inspect fb1 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 if [ "$FAILURES" -ne 0 ]; then echo "[check] $FAILURES check(s) failed." exit 1 fi echo "[check] All rebuild preflight checks passed."