- uclaude_install.sh: clone --depth 1 --no-checkout + sparse-checkout (только latest cli.js) - uclaude_update.sh: обновляет sparse-checkout при смене версии - README: инструкция с curl one-liner и ручным sparse clone Клиент скачивает ~12MB (одна версия cli.js), а не все версии. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
28 lines
1011 B
Bash
Executable File
28 lines
1011 B
Bash
Executable File
#!/bin/bash
|
|
# UClaude Updater — automatic Claude Code patch updater
|
|
# Usage: sudo bash uclaude_update.sh [--check] [--force] [--settings-only]
|
|
set -e
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
cd "$SCRIPT_DIR"
|
|
|
|
# Fetch latest commit (shallow — no history)
|
|
git fetch --depth 1 origin master 2>/dev/null && git reset --hard origin/master 2>/dev/null || git pull --quiet 2>/dev/null || true
|
|
|
|
# Update sparse checkout to include latest version directory
|
|
if [ -f claude/releases/index.json ] && git config core.sparseCheckout 2>/dev/null | grep -q true; then
|
|
VER=$(python3 -c "import json; print(json.load(open('claude/releases/index.json'))['latest'])" 2>/dev/null)
|
|
if [ -n "$VER" ]; then
|
|
git sparse-checkout add "claude/releases/v${VER}" 2>/dev/null
|
|
git checkout 2>/dev/null || true
|
|
fi
|
|
fi
|
|
|
|
# Run updater
|
|
if [ "$(id -u)" -eq 0 ]; then
|
|
python3 uclaude_updater.py "$@"
|
|
else
|
|
echo "Root privileges required. Re-running with sudo..."
|
|
sudo python3 uclaude_updater.py "$@"
|
|
fi
|