wsl环境不翻墙安装测试通过

This commit is contained in:
heming 2026-04-18 21:54:02 +08:00
parent 2edebedc9e
commit 9508463bef
4 changed files with 2050 additions and 594 deletions

View file

@ -37,6 +37,7 @@ NODE_VERSION="22"
USE_VENV=true
RUN_SETUP=true
BRANCH="main"
USE_LOCAL_DIR=false
# Detect non-interactive mode (e.g. curl | bash)
# When stdin is not a terminal, read -p will fail with EOF,
@ -66,6 +67,10 @@ while [[ $# -gt 0 ]]; do
INSTALL_DIR="$2"
shift 2
;;
--local)
USE_LOCAL_DIR=true
shift
;;
--hermes-home)
HERMES_HOME="$2"
shift 2
@ -80,6 +85,7 @@ while [[ $# -gt 0 ]]; do
echo " --skip-setup Skip interactive setup wizard"
echo " --branch NAME Git branch to install (default: main)"
echo " --dir PATH Installation directory (default: ~/.hermes/hermes-agent)"
echo " --local Use existing local directory (--dir), skip git clone (for offline/China users)"
echo " --hermes-home PATH Data directory (default: ~/.hermes, or \$HERMES_HOME)"
echo " -h, --help Show this help"
exit 0
@ -718,6 +724,28 @@ show_manual_install_hint() {
clone_repo() {
log_info "Installing to $INSTALL_DIR..."
if [ "$USE_LOCAL_DIR" = true ]; then
log_info "Using --local mode: skipping git clone, using existing directory..."
if [ ! -d "$INSTALL_DIR" ]; then
log_error "Directory not found: $INSTALL_DIR"
log_info "Please specify an existing directory with --dir PATH"
log_info "Or download the repository first and point --dir to it"
exit 1
fi
if [ ! -f "$INSTALL_DIR/pyproject.toml" ]; then
log_error "Directory does not appear to be a hermes-agent repository"
log_info "Expected to find pyproject.toml in: $INSTALL_DIR"
log_info "Please verify the directory contains the hermes-agent source code"
exit 1
fi
cd "$INSTALL_DIR"
log_success "Using local directory: $INSTALL_DIR"
return 0
fi
if [ -d "$INSTALL_DIR" ]; then
if [ -d "$INSTALL_DIR/.git" ]; then
log_info "Existing installation found, updating..."
@ -769,7 +797,8 @@ clone_repo() {
fi
else
log_error "Directory exists but is not a git repository: $INSTALL_DIR"
log_info "Remove it or choose a different directory with --dir"
log_info "To use an existing non-git directory, add --local flag"
log_info "Example: bash install.sh --local --dir $INSTALL_DIR"
exit 1
fi
else
@ -787,6 +816,9 @@ clone_repo() {
log_success "Cloned via HTTPS"
else
log_error "Failed to clone repository"
log_info "For users in China or with network issues:"
log_info " 1. Download the repository manually (e.g., from Gitee or GitHub mirror)"
log_info " 2. Run: bash install.sh --local --dir /path/to/downloaded/hermes-agent"
exit 1
fi
fi
@ -1426,7 +1458,11 @@ main() {
detect_os
install_uv
check_python
check_git
if [ "$USE_LOCAL_DIR" = false ]; then
check_git
else
log_info "Using --local mode: skipping Git check"
fi
check_node
install_system_packages