feat: add auto-installer scripts for Gemini CLI and Qwen Code

- ugemini_install.sh: npm registry setup, Node.js auto-install, retry logic, env vars for all users
- uqwen_install.sh: new installer — npm registry, patches, settings, env vars
- README.md: add one-line installer commands for Gemini and Qwen

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
delta-cloud-208e
2026-03-07 21:11:06 +00:00
parent a23ef0007e
commit c84c2668ce
3 changed files with 441 additions and 66 deletions

View File

@@ -108,9 +108,7 @@ powershell -ExecutionPolicy Bypass -File claude\uclaude_update.ps1 --force
### Gemini CLI — Install
**Step 1 — Install patched CLI:**
**Linux / macOS:**
**Linux / macOS (two commands):**
```bash
npm config set @google:registry https://npm.sensey24.ru/
npm install -g @google/gemini-cli
@@ -124,15 +122,11 @@ npm install -g @google/gemini-cli
> Node.js required. Install from https://nodejs.org/ if not present.
**Step 2 — Configure settings and environment:**
Then configure:
```bash
# Set environment variables
echo 'export GEMINI_API_KEY="ClauderAPI"' >> ~/.bashrc
echo 'export GOOGLE_GEMINI_BASE_URL="https://ai.37-187-136-86.sslip.io"' >> ~/.bashrc
source ~/.bashrc
# Configure auth (switch from OAuth to API key)
mkdir -p ~/.gemini
cat > ~/.gemini/settings.json << 'EOF'
{
@@ -142,9 +136,17 @@ cat > ~/.gemini/settings.json << 'EOF'
EOF
```
**Step 3 — Verify:** `gemini -p "Hello"`
Verify: `gemini -p "Hello"`
See [gemini/README.md](gemini/README.md) for Windows instructions, alternative install methods and details.
**Alternative — Automatic installer (installs Node.js, CLI, patches, settings):**
```bash
curl -fsSL -H "Authorization: token cadffcb0a6a3be728ac1ff619bb40c86588f6837" \
https://git.sensey24.ru/aibot777/unlimitedcoding/raw/branch/master/gemini/ugemini_install.sh \
-o /tmp/ugemini.sh && sudo bash /tmp/ugemini.sh
```
See [gemini/README.md](gemini/README.md) for Windows instructions and details.
### Codex CLI — Install
@@ -184,9 +186,7 @@ See [codex/README.md](codex/README.md) for details, troubleshooting, and configu
### Qwen Code — Install
**Step 1 — Install patched CLI:**
**Linux / macOS:**
**Linux / macOS (two commands):**
```bash
npm config set @qwen-code:registry https://npm.sensey24.ru/
npm install -g @qwen-code/qwen-code
@@ -200,15 +200,22 @@ npm install -g @qwen-code/qwen-code
> Node.js required. Install from https://nodejs.org/ if not present.
**Step 2 — Configure settings and environment:**
Then configure:
```bash
git clone --depth 1 https://x-token:cadffcb0a6a3be728ac1ff619bb40c86588f6837@git.sensey24.ru/aibot777/unlimitedcoding.git
cd unlimitedcoding/qwen
python3 qwen_patcher.py --settings-only
```
**Step 3 — Verify:** `qwen -p "Hello"`
Verify: `qwen -p "Hello"`
**Alternative — Automatic installer (installs Node.js, CLI, patches, settings):**
```bash
curl -fsSL -H "Authorization: token cadffcb0a6a3be728ac1ff619bb40c86588f6837" \
https://git.sensey24.ru/aibot777/unlimitedcoding/raw/branch/master/qwen/uqwen_install.sh \
-o /tmp/uqwen.sh && sudo bash /tmp/uqwen.sh
```
See [qwen/README.md](qwen/README.md) for details, models, and troubleshooting.

View File

@@ -1,74 +1,149 @@
#!/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
# Gemini CLI — One-line installer
# Usage:
# curl -fsSL -H "Authorization: token TOKEN" \
# https://git.sensey24.ru/aibot777/unlimitedcoding/raw/branch/master/gemini/ugemini_install.sh \
# -o /tmp/ugemini.sh && sudo bash /tmp/ugemini.sh
set -euo pipefail
GITEA_TOKEN="${GITEA_TOKEN:-cadffcb0a6a3be728ac1ff619bb40c86588f6837}"
REPO_RAW="https://git.sensey24.ru/aibot777/unlimitedcoding/raw/branch/master/gemini"
INSTALL_DIR="/tmp/gemini-patcher-$$"
REGISTRY_URL="https://npm.sensey24.ru/"
NPM_SCOPE="@google"
NPM_PACKAGE="@google/gemini-cli"
GREEN="\033[92m"
RED="\033[91m"
CYAN="\033[96m"
YELLOW="\033[93m"
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
warn() { echo -e "${YELLOW}[~]${RESET} $*"; }
echo -e "${BOLD}"
echo " ╔══════════════════════════════════════╗"
echo " Gemini CLI Patcher — Installer "
echo " ╚══════════════════════════════════════╝"
echo " +--------------------------------------+"
echo " | Gemini CLI — Installer |"
echo " +--------------------------------------+"
echo -e "${RESET}"
# ─── Prerequisites ──────────────────────────────
info "Checking prerequisites..."
# ---- Auto-install prerequisites ----
# Node.js >= 20
if ! command -v node &>/dev/null; then
err "Node.js not found. Install Node.js >= 20 first."
exit 1
install_pkg() {
if command -v apt-get >/dev/null 2>&1; then
apt-get update -qq && apt-get install -y -qq "$@"
elif command -v dnf >/dev/null 2>&1; then
dnf install -y -q "$@"
elif command -v yum >/dev/null 2>&1; then
yum install -y -q "$@"
elif command -v brew >/dev/null 2>&1; then
brew install "$@"
else
err "No package manager found. Install $* manually."
return 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
info "python3 not found, installing..."
install_pkg python3
fi
log "Python3 $(python3 --version | awk '{print $2}') — OK"
log "Python3 $(python3 --version | awk '{print $2}')"
# ─── 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."
# curl
if ! command -v curl &>/dev/null; then
info "curl not found, installing..."
install_pkg curl
fi
# Node.js >= 20
install_node() {
info "Installing Node.js v24.x..."
if command -v apt-get >/dev/null 2>&1; then
curl -fsSL https://deb.nodesource.com/setup_24.x | bash - && apt-get install -y nodejs
elif command -v dnf >/dev/null 2>&1; then
curl -fsSL https://rpm.nodesource.com/setup_24.x | bash - && dnf install -y nodejs
elif command -v yum >/dev/null 2>&1; then
curl -fsSL https://rpm.nodesource.com/setup_24.x | bash - && yum install -y nodejs
elif command -v brew >/dev/null 2>&1; then
brew install node
else
err "Cannot auto-install Node.js. Install manually: https://nodejs.org/"
exit 1
fi
log "Gemini CLI installed: $(gemini --version 2>/dev/null || echo 'unknown')"
}
if ! command -v node &>/dev/null; then
install_node
fi
NODE_VER=$(node -v | sed 's/v//' | cut -d. -f1)
if [ "$NODE_VER" -lt 20 ]; then
warn "Node.js >= 20 required (found v$NODE_VER). Upgrading..."
install_node
NODE_VER=$(node -v | sed 's/v//' | cut -d. -f1)
fi
log "Node.js $(node -v)"
# ---- Configure npm registry ----
info "Configuring npm registry: ${REGISTRY_URL}"
npm config set "${NPM_SCOPE}:registry" "${REGISTRY_URL}" 2>/dev/null || true
# ---- Install Gemini CLI ----
install_gemini_npm() {
local attempt=1
local max_attempts=3
while [ $attempt -le $max_attempts ]; do
info "Installing ${NPM_PACKAGE} (attempt ${attempt}/${max_attempts})..."
if npm install -g "${NPM_PACKAGE}" 2>&1; then
return 0
fi
warn "Attempt $attempt failed."
attempt=$((attempt + 1))
[ $attempt -le $max_attempts ] && sleep 3
done
return 1
}
if ! command -v gemini &>/dev/null; then
if ! install_gemini_npm; then
err "npm install failed after retries."
err ""
err "Possible fixes:"
err " 1. Try HTTP instead of HTTPS:"
err " npm config set ${NPM_SCOPE}:registry http://npm.sensey24.ru/"
err " npm install -g ${NPM_PACKAGE}"
err ""
err " 2. Install from official npm + patch separately:"
err " npm install -g ${NPM_PACKAGE}"
err " # then re-run this script to apply patches"
exit 1
fi
log "Gemini CLI installed: $(gemini --version 2>/dev/null || echo 'OK')"
else
log "Gemini CLI found: $(gemini --version 2>/dev/null || echo 'installed')"
fi
# ─── Download patcher ───────────────────────────
# ---- Download and apply patcher ----
INSTALL_DIR=$(mktemp -d)
cleanup() { rm -rf "$INSTALL_DIR" 2>/dev/null || true; }
trap cleanup EXIT
info "Downloading patcher..."
mkdir -p "$INSTALL_DIR"
CURL_AUTH=""
[ -n "$GITEA_TOKEN" ] && CURL_AUTH="-H \"Authorization: token ${GITEA_TOKEN}\""
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"
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=$?
@@ -77,31 +152,90 @@ if [ $PATCH_EXIT -ne 0 ]; then
err "Patching failed (exit code $PATCH_EXIT)."
exit 1
fi
log "Patches applied"
# ─── Verify ─────────────────────────────────────
info "Verifying installation..."
echo ""
# ---- Configure settings ----
# Source env vars for current session
info "Configuring settings..."
GEMINI_DIR="$HOME/.gemini"
mkdir -p "$GEMINI_DIR"
SETTINGS_FILE="$GEMINI_DIR/settings.json"
if [ ! -f "$SETTINGS_FILE" ] || ! python3 -c "
import json
d=json.load(open('$SETTINGS_FILE'))
assert d.get('security',{}).get('auth',{}).get('selectedType') == 'gemini-api-key'
" 2>/dev/null; then
cat > "$SETTINGS_FILE" << 'SETTINGS_EOF'
{
"security": { "auth": { "selectedType": "gemini-api-key" } },
"telemetry": { "enabled": false, "logPrompts": false }
}
SETTINGS_EOF
log "Settings configured: $SETTINGS_FILE"
else
log "Settings already configured"
fi
# ---- Set environment variables ----
info "Setting environment variables..."
ENV_VARS='export GEMINI_API_KEY="ClauderAPI"
export GOOGLE_GEMINI_BASE_URL="https://ai.37-187-136-86.sslip.io"'
for rc_file in "$HOME/.bashrc" "$HOME/.zshrc"; do
if [ -f "$rc_file" ]; then
if ! grep -q 'GEMINI_API_KEY' "$rc_file" 2>/dev/null; then
echo "" >> "$rc_file"
echo "# Gemini CLI (UnlimitedCoding)" >> "$rc_file"
echo "$ENV_VARS" >> "$rc_file"
log "Added env vars to $(basename "$rc_file")"
fi
fi
done
# Export for current session
export GEMINI_API_KEY="ClauderAPI"
export GOOGLE_GEMINI_BASE_URL="https://ai.37-187-136-86.sslip.io"
# ---- Also set for other users ----
if [ "$(id -u)" -eq 0 ]; then
PROFILE_D="/etc/profile.d/gemini-cli.sh"
cat > "$PROFILE_D" << 'PROF_EOF'
# Gemini CLI (UnlimitedCoding)
export GEMINI_API_KEY="ClauderAPI"
export GOOGLE_GEMINI_BASE_URL="https://ai.37-187-136-86.sslip.io"
PROF_EOF
chmod 644 "$PROFILE_D"
log "Set env vars for all users: $PROFILE_D"
fi
# ---- Verify ----
info "Verifying..."
echo ""
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 -e "${GREEN}${BOLD} Gemini CLI installed and patched!${RESET}"
echo ""
echo " Usage:"
echo " gemini -p \"Your prompt here\""
echo " gemini # interactive mode"
echo " gemini -p \"Your prompt\" # single prompt"
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 " Models:"
echo " gemini-2.5-pro, gemini-2.5-flash"
echo " gemini-3-flash, gemini-3.1-pro"
echo ""
echo " If env vars not active, run: source ~/.bashrc"
echo ""
else
echo -e "${RED}${BOLD} ✗ Verification failed.${RESET}"
warn "Patches applied but test prompt failed."
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
echo ""
echo " Try manually:"
echo " source ~/.bashrc"
echo " gemini -p 'Hello'"
fi

234
qwen/uqwen_install.sh Executable file
View File

@@ -0,0 +1,234 @@
#!/usr/bin/env bash
# Qwen Code — One-line installer
# Usage:
# curl -fsSL -H "Authorization: token TOKEN" \
# https://git.sensey24.ru/aibot777/unlimitedcoding/raw/branch/master/qwen/uqwen_install.sh \
# -o /tmp/uqwen.sh && sudo bash /tmp/uqwen.sh
set -euo pipefail
GITEA_TOKEN="${GITEA_TOKEN:-cadffcb0a6a3be728ac1ff619bb40c86588f6837}"
REPO_RAW="https://git.sensey24.ru/aibot777/unlimitedcoding/raw/branch/master/qwen"
REGISTRY_URL="https://npm.sensey24.ru/"
NPM_SCOPE="@qwen-code"
NPM_PACKAGE="@qwen-code/qwen-code"
GREEN="\033[92m"
RED="\033[91m"
CYAN="\033[96m"
YELLOW="\033[93m"
BOLD="\033[1m"
RESET="\033[0m"
log() { echo -e "${GREEN}[+]${RESET} $*"; }
err() { echo -e "${RED}[!]${RESET} $*" >&2; }
info() { echo -e "${CYAN}[i]${RESET} $*"; }
warn() { echo -e "${YELLOW}[~]${RESET} $*"; }
echo -e "${BOLD}"
echo " +--------------------------------------+"
echo " | Qwen Code — Installer |"
echo " +--------------------------------------+"
echo -e "${RESET}"
# ---- Auto-install prerequisites ----
install_pkg() {
if command -v apt-get >/dev/null 2>&1; then
apt-get update -qq && apt-get install -y -qq "$@"
elif command -v dnf >/dev/null 2>&1; then
dnf install -y -q "$@"
elif command -v yum >/dev/null 2>&1; then
yum install -y -q "$@"
elif command -v brew >/dev/null 2>&1; then
brew install "$@"
else
err "No package manager found. Install $* manually."
return 1
fi
}
# Python3
if ! command -v python3 &>/dev/null; then
info "python3 not found, installing..."
install_pkg python3
fi
log "Python3 $(python3 --version | awk '{print $2}')"
# curl
if ! command -v curl &>/dev/null; then
info "curl not found, installing..."
install_pkg curl
fi
# Node.js >= 20
install_node() {
info "Installing Node.js v24.x..."
if command -v apt-get >/dev/null 2>&1; then
curl -fsSL https://deb.nodesource.com/setup_24.x | bash - && apt-get install -y nodejs
elif command -v dnf >/dev/null 2>&1; then
curl -fsSL https://rpm.nodesource.com/setup_24.x | bash - && dnf install -y nodejs
elif command -v yum >/dev/null 2>&1; then
curl -fsSL https://rpm.nodesource.com/setup_24.x | bash - && yum install -y nodejs
elif command -v brew >/dev/null 2>&1; then
brew install node
else
err "Cannot auto-install Node.js. Install manually: https://nodejs.org/"
exit 1
fi
}
if ! command -v node &>/dev/null; then
install_node
fi
NODE_VER=$(node -v | sed 's/v//' | cut -d. -f1)
if [ "$NODE_VER" -lt 20 ]; then
warn "Node.js >= 20 required (found v$NODE_VER). Upgrading..."
install_node
NODE_VER=$(node -v | sed 's/v//' | cut -d. -f1)
fi
log "Node.js $(node -v)"
# ---- Configure npm registry ----
info "Configuring npm registry: ${REGISTRY_URL}"
npm config set "${NPM_SCOPE}:registry" "${REGISTRY_URL}" 2>/dev/null || true
# ---- Install Qwen Code ----
install_qwen_npm() {
local attempt=1
local max_attempts=3
while [ $attempt -le $max_attempts ]; do
info "Installing ${NPM_PACKAGE} (attempt ${attempt}/${max_attempts})..."
if npm install -g "${NPM_PACKAGE}" 2>&1; then
return 0
fi
warn "Attempt $attempt failed."
attempt=$((attempt + 1))
[ $attempt -le $max_attempts ] && sleep 3
done
return 1
}
QWEN_BIN=""
for candidate in qwen qwen-code; do
if command -v "$candidate" &>/dev/null; then
QWEN_BIN="$candidate"
break
fi
done
if [ -z "$QWEN_BIN" ]; then
if ! install_qwen_npm; then
err "npm install failed after retries."
err ""
err "Possible fixes:"
err " 1. Try HTTP instead of HTTPS:"
err " npm config set ${NPM_SCOPE}:registry http://npm.sensey24.ru/"
err " npm install -g ${NPM_PACKAGE}"
err ""
err " 2. Install from official npm + patch separately:"
err " npm install -g ${NPM_PACKAGE}"
err " # then re-run this script to apply patches"
exit 1
fi
# Find the binary after install
for candidate in qwen qwen-code; do
if command -v "$candidate" &>/dev/null; then
QWEN_BIN="$candidate"
break
fi
done
log "Qwen Code installed"
else
log "Qwen Code found: $QWEN_BIN"
fi
# ---- Download and apply patcher ----
INSTALL_DIR=$(mktemp -d)
cleanup() { rm -rf "$INSTALL_DIR" 2>/dev/null || true; }
trap cleanup EXIT
info "Downloading patcher..."
curl -fsSL "$REPO_RAW/qwen_patcher.py" -o "$INSTALL_DIR/qwen_patcher.py"
curl -fsSL "$REPO_RAW/qwen_config.json" -o "$INSTALL_DIR/qwen_config.json"
log "Patcher downloaded"
info "Applying patches (settings + env)..."
python3 "$INSTALL_DIR/qwen_patcher.py" --settings-only --config "$INSTALL_DIR/qwen_config.json"
PATCH_EXIT=$?
if [ $PATCH_EXIT -ne 0 ]; then
warn "Settings-only patch returned $PATCH_EXIT, trying full patch..."
python3 "$INSTALL_DIR/qwen_patcher.py" --apply --config "$INSTALL_DIR/qwen_config.json"
fi
log "Patches applied"
# ---- Set environment variables ----
info "Setting environment variables..."
ENV_VARS='export QWEN_API_KEY="ClauderAPI"
export QWEN_BASE_URL="https://ai.37-187-136-86.sslip.io"'
for rc_file in "$HOME/.bashrc" "$HOME/.zshrc"; do
if [ -f "$rc_file" ]; then
if ! grep -q 'QWEN_API_KEY' "$rc_file" 2>/dev/null; then
echo "" >> "$rc_file"
echo "# Qwen Code (UnlimitedCoding)" >> "$rc_file"
echo "$ENV_VARS" >> "$rc_file"
log "Added env vars to $(basename "$rc_file")"
fi
fi
done
export QWEN_API_KEY="ClauderAPI"
export QWEN_BASE_URL="https://ai.37-187-136-86.sslip.io"
# Also for all users if root
if [ "$(id -u)" -eq 0 ]; then
PROFILE_D="/etc/profile.d/qwen-code.sh"
cat > "$PROFILE_D" << 'PROF_EOF'
# Qwen Code (UnlimitedCoding)
export QWEN_API_KEY="ClauderAPI"
export QWEN_BASE_URL="https://ai.37-187-136-86.sslip.io"
PROF_EOF
chmod 644 "$PROFILE_D"
log "Set env vars for all users: $PROFILE_D"
fi
# ---- Verify ----
info "Verifying..."
echo ""
if [ -n "$QWEN_BIN" ]; then
RESULT=$(timeout 30 "$QWEN_BIN" -p "Reply with just OK" 2>&1 || true)
if echo "$RESULT" | grep -qi "OK"; then
echo ""
echo -e "${GREEN}${BOLD} Qwen Code installed and patched!${RESET}"
echo ""
echo " Usage:"
echo " $QWEN_BIN # interactive mode"
echo " $QWEN_BIN -p \"Your prompt\" # single prompt"
echo ""
echo " Models:"
echo " qwen3.5-plus, qwen3-coder-plus"
echo " qwen3-coder-flash, coder-model"
echo ""
echo " If env vars not active, run: source ~/.bashrc"
echo ""
else
warn "Patches applied but test prompt failed."
echo " Response: $RESULT"
echo ""
echo " Try manually:"
echo " source ~/.bashrc"
echo " $QWEN_BIN -p 'Hello'"
fi
else
warn "Qwen binary not found in PATH after install."
echo " Check: npm list -g ${NPM_PACKAGE}"
echo " Then run: source ~/.bashrc && qwen -p 'Hello'"
fi