#!/bin/bash # Docker entrypoint script for RAR extraction service echo "🐳 Starting RAR extraction container..." echo "📁 Source Repo: ${SOURCE_REPO}" echo "📂 Extract Folder: ${EXTRACT_FOLDER}" echo "💾 State Folder: ${STATE_FOLDER}" # Check if HF_TOKEN is set if [ -z "$HF_TOKEN" ]; then echo "⚠️ WARNING: HF_TOKEN environment variable is not set" echo "💡 You may need to set this for private repositories" fi # Verify unrar is installed if ! command -v unrar &> /dev/null; then echo "❌ ERROR: unrar is not installed" exit 1 fi echo "✅ unrar is available: $(unrar --version | head -1)" # Check directory permissions for dir in "$DOWNLOAD_FOLDER" "$EXTRACT_FOLDER" "$STATE_FOLDER"; do if [ ! -w "$dir" ]; then echo "⚠️ WARNING: Directory $dir is not writable" fi done # Check disk space available_space=$(df -h "$EXTRACT_FOLDER" | awk 'NR==2 {print $4}') echo "💾 Available disk space: $available_space" echo "🚀 Starting main application..." # Execute the main command exec "$@"