File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -148,8 +148,19 @@ detect_arch() {
148148 esac
149149}
150150
151+ is_android () {
152+ [ " $( uname -o 2> /dev/null || true) " = " Android" ] \
153+ || [ -n " ${TERMUX_VERSION:- } " ] \
154+ || [[ " ${PREFIX:- } " == /data/data/com.termux/* ]]
155+ }
156+
151157OS=$( detect_os)
152158ARCH=$( detect_arch)
159+ if [ " $OS " = " linux" ] && is_android; then
160+ echo " error: Android/Termux is not supported by the Linux portable binary." >&2
161+ echo " Build from source with scripts/build.sh in Termux or use a supported Linux host." >&2
162+ exit 1
163+ fi
153164
154165echo " codebase-memory-mcp installer"
155166echo " os: $OS "
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+ set -euo pipefail
3+
4+ ROOT=$( cd " $( dirname " ${BASH_SOURCE[0]} " ) /.." && pwd)
5+ WORK=$( mktemp -d)
6+ trap ' rm -rf "$WORK"' EXIT
7+
8+ mkdir -p " $WORK /bin" " $WORK /home"
9+ cat > " $WORK /bin/uname" << 'EOF '
10+ case "$1" in
11+ -s) printf '%s\n' Linux ;;
12+ -m) printf '%s\n' aarch64 ;;
13+ -o) printf '%s\n' Android ;;
14+ *) exit 1 ;;
15+ esac
16+ EOF
17+ cat > " $WORK /bin/curl" << 'EOF '
18+ printf 'curl must not run for Android/Termux\n' >&2
19+ exit 99
20+ EOF
21+ chmod +x " $WORK /bin/uname" " $WORK /bin/curl"
22+
23+ set +e
24+ output=$( PATH=" $WORK /bin:$PATH " HOME=" $WORK /home" bash " $ROOT /install.sh" --skip-config 2>&1 )
25+ rc=$?
26+ set -e
27+
28+ if [ " $rc " -eq 0 ]; then
29+ printf ' FAIL: installer accepted Android/Termux\n' >&2
30+ exit 1
31+ fi
32+ if ! grep -Fq ' Android/Termux' <<< " $output" ; then
33+ printf ' FAIL: missing Android/Termux guidance\n%s\n' " $output " >&2
34+ exit 1
35+ fi
36+ if grep -Fq ' curl must not run' <<< " $output" ; then
37+ printf ' FAIL: installer downloaded before rejecting Android/Termux\n' >&2
38+ exit 1
39+ fi
40+
41+ printf ' PASS: Android/Termux is rejected before download\n'
You can’t perform that action at this time.
0 commit comments