#!/bin/bash set -e # Clone xdvdfs-tools from GitHub # Tool for working with Xbox 360 ISO images SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" XDVDFS_DIR="$SCRIPT_DIR/src" REPO_URL="https://github.com/antangelo/xdvdfs.git" echo "╔════════════════════════════════════════════════════════════════╗" echo "║ xdvdfs-tools Source Management ║" echo "╚════════════════════════════════════════════════════════════════╝" echo "" if [ -d "$XDVDFS_DIR" ]; then echo "📂 xdvdfs-tools source already exists. Updating..." cd "$XDVDFS_DIR" # Save current branch CURRENT_BRANCH=$(git branch --show-current 2>/dev/null || echo "main") 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 xdvdfs-tools repository from GitHub..." echo " Repository: $REPO_URL" echo " Target: $XDVDFS_DIR" echo "" echo "📚 Cloning repository..." git clone "$REPO_URL" "$XDVDFS_DIR" cd "$XDVDFS_DIR" echo "" echo "✅ Clone completed successfully!" fi echo "" # Show available tags/releases echo "📋 Available xdvdfs-tools releases:" git tag -l | tail -10 || echo " No tags found" echo "" # Generate version info file VERSION_FILE="$SCRIPT_DIR/VERSION.txt" echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" echo "📝 Current xdvdfs-tools Source Version" echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" cat > "$VERSION_FILE" << EOF xdvdfs-tools 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 "✅ xdvdfs-tools source is ready!" echo "" echo "Next steps:" echo " 1. Run ./build.sh to build xdvdfs-tools" echo " 2. Built binaries will be in: $SCRIPT_DIR/build/" echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"