- 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>
58 lines
2.0 KiB
Bash
Executable File
58 lines
2.0 KiB
Bash
Executable File
#!/bin/bash
|
|
# UClaude — one-line installer
|
|
# Usage: bash <(curl -s https://git.sensey24.ru/aibot777/unlimitedcoding/raw/branch/master/uclaude_install.sh)
|
|
# Or: curl -s URL | bash
|
|
set -e
|
|
|
|
REPO_URL="https://git.sensey24.ru/aibot777/unlimitedcoding.git"
|
|
INSTALL_DIR="${UCLAUDE_DIR:-$HOME/unlimitedcoding}"
|
|
|
|
echo "=== UClaude Installer ==="
|
|
echo " Install dir: $INSTALL_DIR"
|
|
|
|
# Check prerequisites
|
|
command -v git >/dev/null 2>&1 || { echo "ERROR: git not found. Install git first."; exit 1; }
|
|
command -v python3 >/dev/null 2>&1 || { echo "ERROR: python3 not found. Install Python 3 first."; exit 1; }
|
|
command -v node >/dev/null 2>&1 || { echo "ERROR: node not found. Install Node.js 18+ first."; exit 1; }
|
|
|
|
if [ -d "$INSTALL_DIR/.git" ]; then
|
|
echo " Already cloned, updating..."
|
|
cd "$INSTALL_DIR"
|
|
git fetch --depth 1 origin master 2>/dev/null
|
|
git reset --hard origin/master 2>/dev/null
|
|
else
|
|
echo " Cloning (shallow, sparse — only latest version)..."
|
|
|
|
# Shallow clone without checkout
|
|
git clone --depth 1 --no-checkout "$REPO_URL" "$INSTALL_DIR"
|
|
cd "$INSTALL_DIR"
|
|
|
|
# Enable sparse checkout: root files + index.json only (first pass)
|
|
git sparse-checkout init --no-cone
|
|
git sparse-checkout set '/*' 'claude/releases/index.json'
|
|
git checkout 2>/dev/null
|
|
|
|
# Now read latest version from index.json and add that release dir
|
|
if [ -f claude/releases/index.json ]; then
|
|
VER=$(python3 -c "import json; print(json.load(open('claude/releases/index.json'))['latest'])")
|
|
echo " Latest version: v${VER}"
|
|
git sparse-checkout add "claude/releases/v${VER}"
|
|
git checkout 2>/dev/null
|
|
fi
|
|
fi
|
|
|
|
echo ""
|
|
echo " Running updater..."
|
|
|
|
# Run updater (needs root for cli.js replacement)
|
|
if [ "$(id -u)" -eq 0 ]; then
|
|
python3 uclaude_updater.py --force
|
|
else
|
|
echo " Root privileges required to install cli.js."
|
|
sudo python3 uclaude_updater.py --force
|
|
fi
|
|
|
|
echo ""
|
|
echo "=== Installation complete ==="
|
|
echo " To update later: cd $INSTALL_DIR && sudo bash uclaude_update.sh"
|