mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-08 03:01:47 +00:00
fix: strengthen termux install network prerequisites
This commit is contained in:
parent
54c0b10d14
commit
da18fd084a
2 changed files with 59 additions and 1 deletions
|
|
@ -615,6 +615,41 @@ install_node() {
|
|||
HAS_NODE=true
|
||||
}
|
||||
|
||||
check_network_prerequisites() {
|
||||
log_info "Checking internet connectivity for package install and web tools..."
|
||||
|
||||
local url
|
||||
local failed=false
|
||||
local checks=("https://pypi.org/simple/" "https://duckduckgo.com/")
|
||||
|
||||
if ! command -v curl >/dev/null 2>&1; then
|
||||
log_warn "curl not found; skipping connectivity probes"
|
||||
return 0
|
||||
fi
|
||||
|
||||
for url in "${checks[@]}"; do
|
||||
if ! curl -fsSI --max-time 8 "$url" >/dev/null 2>&1; then
|
||||
failed=true
|
||||
log_warn "Could not reach $url"
|
||||
fi
|
||||
done
|
||||
|
||||
if [ "$failed" = false ]; then
|
||||
log_success "Internet connectivity looks good"
|
||||
return 0
|
||||
fi
|
||||
|
||||
if [ "$DISTRO" = "termux" ]; then
|
||||
log_warn "Termux network prerequisites may be incomplete."
|
||||
log_info "Try: pkg install -y ca-certificates curl && pkg update"
|
||||
log_info "If mirrors are stale: termux-change-repo"
|
||||
log_info "Then test: curl -I https://pypi.org/simple/ && curl -I https://duckduckgo.com/"
|
||||
else
|
||||
log_warn "Network checks failed. Hermes install may complete, but web search and dependency downloads can fail."
|
||||
log_info "Verify internet/DNS and retry if pip install fails."
|
||||
fi
|
||||
}
|
||||
|
||||
install_system_packages() {
|
||||
# Detect what's missing
|
||||
HAS_RIPGREP=false
|
||||
|
|
@ -642,7 +677,7 @@ install_system_packages() {
|
|||
# Termux always needs the Android build toolchain for the tested pip path,
|
||||
# even when ripgrep/ffmpeg are already present.
|
||||
if [ "$DISTRO" = "termux" ]; then
|
||||
local termux_pkgs=(clang rust make pkg-config libffi openssl)
|
||||
local termux_pkgs=(clang rust make pkg-config libffi openssl ca-certificates curl)
|
||||
if [ "$need_ripgrep" = true ]; then
|
||||
termux_pkgs+=("ripgrep")
|
||||
fi
|
||||
|
|
@ -1570,6 +1605,7 @@ main() {
|
|||
check_python
|
||||
check_git
|
||||
check_node
|
||||
check_network_prerequisites
|
||||
install_system_packages
|
||||
|
||||
clone_repo
|
||||
|
|
|
|||
22
tests/test_install_sh_termux_network_prereqs.py
Normal file
22
tests/test_install_sh_termux_network_prereqs.py
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
"""Regression tests for Termux network prerequisite handling in install.sh."""
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
REPO_ROOT = Path(__file__).resolve().parent.parent
|
||||
INSTALL_SH = REPO_ROOT / "scripts" / "install.sh"
|
||||
|
||||
|
||||
def test_termux_pkg_list_includes_network_basics() -> None:
|
||||
text = INSTALL_SH.read_text()
|
||||
assert "local termux_pkgs=(clang rust make pkg-config libffi openssl ca-certificates curl)" in text
|
||||
|
||||
|
||||
def test_install_script_has_connectivity_probe_and_termux_guidance() -> None:
|
||||
text = INSTALL_SH.read_text()
|
||||
assert "check_network_prerequisites()" in text
|
||||
assert "https://pypi.org/simple/" in text
|
||||
assert "https://duckduckgo.com/" in text
|
||||
assert "termux-change-repo" in text
|
||||
assert "pkg install -y ca-certificates curl && pkg update" in text
|
||||
assert "check_network_prerequisites" in text
|
||||
Loading…
Add table
Add a link
Reference in a new issue