#!/bin/bash # # test_start_extension.sh - Uruchamia rozszerzenie Rentgen w headless Firefox z weryfikacją # # Ten skrypt jest używany przez Docker runtime stage do: # 1. Uruchomienia Xvfb (wirtualny X server) na display :99 # 2. Uruchomienia web-ext run z verbose loggingiem # 3. Weryfikacji czy extension został poprawnie zainstalowany # 4. Wyświetlenia czytelnego komunikatu o statusie # # Używany w Dockerfile dla łatwego testowania extensiona bez GUI. # Przeniesiony z inline RUN echo do osobnego pliku dla czytelności. # set -e echo "Starting Xvfb on display :99..." Xvfb :99 -screen 0 1024x768x24 & XVFB_PID=$! sleep 2 echo "Xvfb started with PID: $XVFB_PID" echo "Starting web-ext run with verbose logging..." echo "========================================" # Run web-ext with verbose logging and capture output npx web-ext run --verbose 2>&1 | tee /tmp/web-ext.log & WEBEXT_PID=$! # Wait for extension installation confirmation echo "Waiting for extension to install..." for i in {1..30}; do if grep -q "Installed /app as a temporary add-on" /tmp/web-ext.log 2>/dev/null; then echo "========================================" echo "✓ SUCCESS: Extension installed!" echo "✓ Firefox is running in headless mode" echo "✓ Extension: rentgen@internet-czas-dzialac.pl" echo "✓ Process info:" ps aux | grep -E "(firefox|Xvfb)" | grep -v grep | head -3 echo "========================================" echo "Extension is ready. Press Ctrl+C to stop." break fi sleep 1 done # Keep container running and show logs wait $WEBEXT_PID