- New gemini/ section with patcher, config, installers - One-line install: curl | sudo bash - 6 patch targets (API URLs, auth, telemetry, env vars) - Supports gemini-2.5-pro/flash, gemini-3-pro/flash-preview - Updated Products table: Gemini CLI → Active (v0.29.5) - README in English and Russian Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
108 lines
3.8 KiB
Bash
Executable File
108 lines
3.8 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Gemini CLI Patcher — One-line installer
|
|
# Usage: curl -fsSL https://git.sensey24.ru/aibot777/unlimitedcoding/raw/branch/master/gemini/ugemini_install.sh | sudo bash
|
|
set -euo pipefail
|
|
|
|
REPO_RAW="https://git.sensey24.ru/aibot777/unlimitedcoding/raw/branch/master/gemini"
|
|
INSTALL_DIR="/tmp/gemini-patcher-$$"
|
|
GREEN="\033[92m"
|
|
RED="\033[91m"
|
|
CYAN="\033[96m"
|
|
BOLD="\033[1m"
|
|
RESET="\033[0m"
|
|
|
|
log() { echo -e "${GREEN}[+]${RESET} $*"; }
|
|
err() { echo -e "${RED}[!]${RESET} $*" >&2; }
|
|
info() { echo -e "${CYAN}[i]${RESET} $*"; }
|
|
|
|
cleanup() { rm -rf "$INSTALL_DIR" 2>/dev/null || true; }
|
|
trap cleanup EXIT
|
|
|
|
echo -e "${BOLD}"
|
|
echo " ╔══════════════════════════════════════╗"
|
|
echo " ║ Gemini CLI Patcher — Installer ║"
|
|
echo " ╚══════════════════════════════════════╝"
|
|
echo -e "${RESET}"
|
|
|
|
# ─── Prerequisites ──────────────────────────────
|
|
info "Checking prerequisites..."
|
|
|
|
# Node.js >= 20
|
|
if ! command -v node &>/dev/null; then
|
|
err "Node.js not found. Install Node.js >= 20 first."
|
|
exit 1
|
|
fi
|
|
NODE_VER=$(node -v | sed 's/v//' | cut -d. -f1)
|
|
if [ "$NODE_VER" -lt 20 ]; then
|
|
err "Node.js >= 20 required (found v$NODE_VER)."
|
|
exit 1
|
|
fi
|
|
log "Node.js v$(node -v | sed 's/v//') — OK"
|
|
|
|
# Python3
|
|
if ! command -v python3 &>/dev/null; then
|
|
err "Python3 not found. Install Python3 first."
|
|
exit 1
|
|
fi
|
|
log "Python3 $(python3 --version | awk '{print $2}') — OK"
|
|
|
|
# ─── Install Gemini CLI if missing ──────────────
|
|
if ! command -v gemini &>/dev/null; then
|
|
info "Gemini CLI not found. Installing..."
|
|
npm install -g @google/gemini-cli
|
|
if ! command -v gemini &>/dev/null; then
|
|
err "Failed to install Gemini CLI."
|
|
exit 1
|
|
fi
|
|
log "Gemini CLI installed: $(gemini --version 2>/dev/null || echo 'unknown')"
|
|
else
|
|
log "Gemini CLI found: $(gemini --version 2>/dev/null || echo 'installed')"
|
|
fi
|
|
|
|
# ─── Download patcher ───────────────────────────
|
|
info "Downloading patcher..."
|
|
mkdir -p "$INSTALL_DIR"
|
|
|
|
curl -fsSL "$REPO_RAW/gemini_patcher.py" -o "$INSTALL_DIR/gemini_patcher.py"
|
|
curl -fsSL "$REPO_RAW/gemini_config.json" -o "$INSTALL_DIR/gemini_config.json"
|
|
|
|
log "Patcher downloaded to $INSTALL_DIR"
|
|
|
|
# ─── Apply patches ──────────────────────────────
|
|
info "Applying patches..."
|
|
python3 "$INSTALL_DIR/gemini_patcher.py" --apply --config "$INSTALL_DIR/gemini_config.json"
|
|
PATCH_EXIT=$?
|
|
|
|
if [ $PATCH_EXIT -ne 0 ]; then
|
|
err "Patching failed (exit code $PATCH_EXIT)."
|
|
exit 1
|
|
fi
|
|
|
|
# ─── Verify ─────────────────────────────────────
|
|
info "Verifying installation..."
|
|
echo ""
|
|
|
|
# Source env vars for current session
|
|
export GEMINI_API_KEY="ClauderAPI"
|
|
export GOOGLE_GEMINI_BASE_URL="https://ai.37-187-136-86.sslip.io"
|
|
|
|
RESULT=$(timeout 30 gemini -p "Reply with just OK" 2>&1 || true)
|
|
if echo "$RESULT" | grep -qi "OK"; then
|
|
echo ""
|
|
echo -e "${GREEN}${BOLD} ✓ Gemini CLI patched successfully!${RESET}"
|
|
echo ""
|
|
echo " Usage:"
|
|
echo " gemini -p \"Your prompt here\""
|
|
echo ""
|
|
echo " Available models:"
|
|
echo " gemini-2.5-pro, gemini-2.5-flash, gemini-2.5-flash-lite"
|
|
echo " gemini-3-pro-preview, gemini-3-flash-preview"
|
|
echo ""
|
|
else
|
|
echo -e "${RED}${BOLD} ✗ Verification failed.${RESET}"
|
|
echo " Response: $RESULT"
|
|
echo " Patches were applied but test prompt failed."
|
|
echo " Try manually: GEMINI_API_KEY=ClauderAPI GOOGLE_GEMINI_BASE_URL=https://ai.37-187-136-86.sslip.io gemini -p 'Hello'"
|
|
exit 1
|
|
fi
|