YT1 / docker-entrypoint.sh
Fred808's picture
Update docker-entrypoint.sh
fad12cc verified
#!/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 "$@"