#!/bin/bash set -e # Clone maxcso from GitHub # High-performance PSP ISO compression tool SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" MAXCSO_DIR="$SCRIPT_DIR/src" REPO_URL="https://github.com/unknownbrackets/maxcso.git" echo "╔════════════════════════════════════════════════════════════════╗" echo "║ maxcso Source Management ║" echo "╚════════════════════════════════════════════════════════════════╝" echo "" if [ -d "$MAXCSO_DIR" ]; then echo "📂 maxcso source already exists. Updating..." cd "$MAXCSO_DIR" # Save current branch CURRENT_BRANCH=$(git branch --show-current 2>/dev/null || echo "master") echo "🔄 Fetching latest changes..." git fetch --all --tags echo "📥 Pulling updates for branch: $CURRENT_BRANCH" git pull origin "$CURRENT_BRANCH" || true echo "" echo "✅ Update completed!" else echo "📥 Cloning maxcso repository from GitHub..." echo " Repository: $REPO_URL" echo " Target: $MAXCSO_DIR" echo "" echo "📚 Cloning repository..." git clone "$REPO_URL" "$MAXCSO_DIR" cd "$MAXCSO_DIR" echo "" echo "✅ Clone completed successfully!" fi echo "" # Show available tags/releases echo "📋 Available maxcso releases:" git tag -l | tail -10 || echo " No tags found" echo "" # Generate version info file VERSION_FILE="$SCRIPT_DIR/VERSION.txt" echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" echo "📝 Current maxcso Source Version" echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" cat > "$VERSION_FILE" << EOF maxcso Source Version Information Generated: $(date) Commit: $(git rev-parse HEAD) Short: $(git rev-parse --short HEAD) Branch: $(git branch --show-current) Tag: $(git describe --tags --exact-match 2>/dev/null || echo "none") Date: $(git log -1 --format=%cd --date=short) Repository: $REPO_URL EOF cat "$VERSION_FILE" echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" echo "✅ maxcso source is ready!" echo "" echo "Next steps:" echo " 1. Run ./build.sh to build maxcso" echo " 2. Built binary will be in: $SCRIPT_DIR/build/" echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"