- Ship ~/.config/sxmo/irc_servers.tsv (home and /etc/skel) with Abjects (irc.abjects.net, TLS port 6697) auto-joining #bananarchy, and change the compiled irc.so defaults to the same network; rebuild and mirror irc.so. - Republish the charge icon together with a fresh clock on battery events, force the icon on state_change and forced battery refreshes, and add a lightweight refresh action called after an NTP clock step. - Update the connected phone: sync network time, apk update plus apk upgrade -a, deploy the overlay and restart xirc; verify the status bar clock and charge icon; rebuild the a1108 / dejavu image. - Guard the new IRC and status bar paths in check-rebuild.sh and sync README, MANUAL, AGENTS and the a1108 changelog.
377 lines
15 KiB
Bash
Executable File
377 lines
15 KiB
Bash
Executable File
#!/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] 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; 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] 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] 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<int>(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] 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"; 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")"
|
|
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 ! 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 "$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..."
|
|
VERSION="$("$BASE_DIR/scripts/version.sh" --print 2>/dev/null || true)"
|
|
CODENAME="$("$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
|
|
|
|
if [ "$FAILURES" -ne 0 ]; then
|
|
echo "[check] $FAILURES check(s) failed."
|
|
exit 1
|
|
fi
|
|
echo "[check] All rebuild preflight checks passed."
|