From 870bccc958c370dcdba30034d18ab5ff08d79633 Mon Sep 17 00:00:00 2001 From: aitbc Date: Tue, 26 May 2026 09:37:13 +0200 Subject: [PATCH] fix: improve setup script and documentation for better UX - Fixed GitHub raw URL in SETUP.md to use raw.githubusercontent.com format - Updated setup.sh to automatically install missing prerequisites - Added support for apt-get and yum package managers - Auto-installs python3, pip3, git, systemd, nodejs, npm when missing - Uses NodeSource repository for Node.js 24.x installation - Improves hermes agent setup experience by reducing manual steps --- docs/deployment/SETUP.md | 2 +- scripts/setup.sh | 53 +++++++++++++++++++++++++++++++++++++++- 2 files changed, 53 insertions(+), 2 deletions(-) diff --git a/docs/deployment/SETUP.md b/docs/deployment/SETUP.md index 9619db84..d826a858 100644 --- a/docs/deployment/SETUP.md +++ b/docs/deployment/SETUP.md @@ -7,7 +7,7 @@ The main setup script lives at `scripts/setup.sh`. Run this single command on any new host to install AITBC: ```bash -sudo bash <(curl -sSL https://github.com/oib/AITBC/raw/branch/main/scripts/setup.sh) +sudo bash <(curl -sSL https://raw.githubusercontent.com/oib/AITBC/main/scripts/setup.sh) ``` Or clone and run manually: diff --git a/scripts/setup.sh b/scripts/setup.sh index 52e410e3..fc9c47fb 100755 --- a/scripts/setup.sh +++ b/scripts/setup.sh @@ -30,8 +30,59 @@ LEGACY_HEALTH_CHECK_PATH="/opt/aitbc/health-check.sh" check_prerequisites() { log "Checking prerequisites..." - require_commands python3 pip3 git systemctl node npm + # Install missing prerequisites + local missing=() + for cmd in python3 pip3 git systemctl node npm; do + if ! command -v "$cmd" >/dev/null 2>&1; then + missing+=("$cmd") + fi + done + if [ "${#missing[@]}" -gt 0 ]; then + log "Installing missing prerequisites: ${missing[*]}" + + # Detect package manager + if command -v apt-get >/dev/null 2>&1; then + apt-get update -qq + for cmd in "${missing[@]}"; do + case "$cmd" in + python3) + apt-get install -y python3 python3-pip + ;; + pip3) + apt-get install -y python3-pip + ;; + git) + apt-get install -y git + ;; + systemctl) + apt-get install -y systemd + ;; + node) + # Install Node.js 24.x from NodeSource + curl -fsSL https://deb.nodesource.com/setup_24.x | bash - + apt-get install -y nodejs + ;; + npm) + # npm comes with nodejs + curl -fsSL https://deb.nodesource.com/setup_24.x | bash - + apt-get install -y nodejs + ;; + esac + done + elif command -v yum >/dev/null 2>&1; then + yum install -y python3 python3-pip git systemd + # Install Node.js 24.x + curl -fsSL https://rpm.nodesource.com/setup_24.x | bash - + yum install -y nodejs + else + error "Unsupported package manager. Please install manually: ${missing[*]}" + fi + + log "Prerequisites installed" + fi + + # Verify versions after installation python_version=$(python3 -c "import sys; print(f'{sys.version_info.major}.{sys.version_info.minor}.{sys.version_info.micro}')") require_min_version "$python_version" "3.13.5" "Python"