Skip to content

The agent that grows with you

install.sh: refuse Termux hosts and point at the APT package

ethernet5e8fbd4919d7
diff --git a/scripts/install.sh b/scripts/install.sh
index 69721233dee..edceb2541cf 100755
--- a/scripts/install.sh
+++ b/scripts/install.sh
@@ -190,6 +190,12 @@ ensure_uv() {
}
check_platform() {
+ # Termux is Linux by uname, but this installer builds a glibc source
+ # install the phone cannot run (no Android wheels in the lock). The
+ # signed APT package is the only supported shape there.
+ if [ -n "${TERMUX_VERSION:-}" ] || case "${PREFIX:-}" in *com.termux/files/usr*) true ;; *) false ;; esac; then
+ fail "Termux is installed from its APT repository, not install.sh: pkg install hermes-agent (setup: https://hermes-agent.nousresearch.com/docs/getting-started/termux)"
+ fi
case "$(uname -s 2>/dev/null)" in
Linux*) : ;;
Darwin*) : ;;
diff --git a/tests/scripts/install/test_install_sh_termux_refusal.py b/tests/scripts/install/test_install_sh_termux_refusal.py
new file mode 100644
index 00000000000..d42c4646b27
--- /dev/null
+++ b/tests/scripts/install/test_install_sh_termux_refusal.py
@@ -0,0 +1,29 @@
+"""install.sh sends Termux hosts to the APT package instead of building a source install."""
+import os
+from pathlib import Path
+import subprocess
+
+import pytest
+
+INSTALL_SH = Path(__file__).resolve().parent.parent.parent.parent / "scripts" / "install.sh"
+
+
[email protected]("marker", [{"TERMUX_VERSION": "0.118.0"}, {"PREFIX": "/data/data/com.termux/files/usr"}])
+def test_termux_host_is_refused_before_any_stage_with_apt_hint(tmp_path, marker):
+ env = {k: v for k, v in os.environ.items() if k not in ("TERMUX_VERSION", "PREFIX")}
+ env.update(marker, HOME=tmp_path.as_posix(), HERMES_HOME=(tmp_path / "home").as_posix(),
+ HERMES_INSTALL_DIR=(tmp_path / "install").as_posix())
+ result = subprocess.run(["bash", INSTALL_SH.as_posix(), "--stage", "prerequisites"],
+ env=env, capture_output=True, text=True, timeout=30)
+ assert result.returncode != 0
+ assert "pkg install hermes-agent" in result.stderr
+ assert not (tmp_path / "install").exists()
+
+
+def test_plain_linux_host_passes_platform_check(tmp_path):
+ env = {k: v for k, v in os.environ.items() if k not in ("TERMUX_VERSION", "PREFIX")}
+ env.update(HOME=tmp_path.as_posix(), HERMES_HOME=(tmp_path / "home").as_posix(),
+ HERMES_INSTALL_DIR=(tmp_path / "install").as_posix())
+ result = subprocess.run(["bash", INSTALL_SH.as_posix(), "--stage", "prerequisites"],
+ env=env, capture_output=True, text=True, timeout=30)
+ assert result.returncode == 0, result.stderr