Skip to content

Local code intelligence for developers and AI agents. Connect code, docs and infrastructure in a persistent graph, with CBM Lens, MCP tools, agent integrations and change-aware test selection.

fix(install): reject Android portable binary

lorenzozaneeed78ff056e89
diff --git a/install.sh b/install.sh
index 9f4b4ec99..01ab6c378 100755
--- a/install.sh
+++ b/install.sh
@@ -148,8 +148,19 @@ detect_arch() {
esac
}
+is_android() {
+ [ "$(uname -o 2>/dev/null || true)" = "Android" ] \
+ || [ -n "${TERMUX_VERSION:-}" ] \
+ || [[ "${PREFIX:-}" == /data/data/com.termux/* ]]
+}
+
OS=$(detect_os)
ARCH=$(detect_arch)
+if [ "$OS" = "linux" ] && is_android; then
+ echo "error: Android/Termux is not supported by the Linux portable binary." >&2
+ echo "Build from source with scripts/build.sh in Termux or use a supported Linux host." >&2
+ exit 1
+fi
echo "codebase-memory-mcp installer"
echo " os: $OS"
diff --git a/tests/test-install-android-guard.sh b/tests/test-install-android-guard.sh
new file mode 100755
index 000000000..6b3a383a2
--- /dev/null
+++ b/tests/test-install-android-guard.sh
@@ -0,0 +1,41 @@
+#!/usr/bin/env bash
+set -euo pipefail
+
+ROOT=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)
+WORK=$(mktemp -d)
+trap 'rm -rf "$WORK"' EXIT
+
+mkdir -p "$WORK/bin" "$WORK/home"
+cat >"$WORK/bin/uname" <<'EOF'
+case "$1" in
+ -s) printf '%s\n' Linux ;;
+ -m) printf '%s\n' aarch64 ;;
+ -o) printf '%s\n' Android ;;
+ *) exit 1 ;;
+esac
+EOF
+cat >"$WORK/bin/curl" <<'EOF'
+printf 'curl must not run for Android/Termux\n' >&2
+exit 99
+EOF
+chmod +x "$WORK/bin/uname" "$WORK/bin/curl"
+
+set +e
+output=$(PATH="$WORK/bin:$PATH" HOME="$WORK/home" bash "$ROOT/install.sh" --skip-config 2>&1)
+rc=$?
+set -e
+
+if [ "$rc" -eq 0 ]; then
+ printf 'FAIL: installer accepted Android/Termux\n' >&2
+ exit 1
+fi
+if ! grep -Fq 'Android/Termux' <<<"$output"; then
+ printf 'FAIL: missing Android/Termux guidance\n%s\n' "$output" >&2
+ exit 1
+fi
+if grep -Fq 'curl must not run' <<<"$output"; then
+ printf 'FAIL: installer downloaded before rejecting Android/Termux\n' >&2
+ exit 1
+fi
+
+printf 'PASS: Android/Termux is rejected before download\n'