AvanzaCast/scripts/start-chrome-debug.sh
Cesar Mendivil 8b458a3ddf feat: add initial LiveKit Meet integration with utility scripts, configs, and core components
- Add Next.js app structure with base configs, linting, and formatting
- Implement LiveKit Meet page, types, and utility functions
- Add Docker, Compose, and deployment scripts for backend and token server
- Provide E2E and smoke test scaffolding with Puppeteer and Playwright helpers
- Include CSS modules and global styles for UI
- Add postMessage and studio integration utilities
- Update package.json with dependencies and scripts for development and testing
2025-11-20 12:50:38 -07:00

92 lines
2.6 KiB
Bash
Executable File

#!/usr/bin/env bash
# Inicia Google Chrome / Chromium en modo debugging remoto con un perfil persistente.
# Uso:
# ./scripts/start-chrome-debug.sh [9222]
# Opciones:
# - primer argumento: puerto de remote debugging (por defecto 9222)
# - exporta CHROME_PATH para un binario alternativo
set -eu
PORT="${1:-9222}"
USER_DATA_DIR="${HOME}/.config/avanzacast-remote-profile"
# Valor por defecto; puede ser sobrescrito por export CHROME_PATH
CHROME_BIN="${CHROME_PATH:-}"
# Función auxiliar para probar rutas
_try_bin() {
local p="$1"
if [ -n "$p" ] && [ -x "$p" ]; then
echo "$p"
return 0
fi
if command -v "$p" >/dev/null 2>&1; then
command -v "$p"
return 0
fi
return 1
}
# Si CHROME_PATH ya fue exportado, intentar usarlo
if [ -n "$CHROME_BIN" ]; then
if [ ! -x "$CHROME_BIN" ] && ! command -v "$CHROME_BIN" >/dev/null 2>&1; then
echo "Advertencia: CHROME_PATH está definido pero no ejecutable: $CHROME_BIN"
CHROME_BIN=""
fi
fi
# Intentar detección automática de binarios comunes
if [ -z "$CHROME_BIN" ]; then
# `command -v` nombres comunes
for cmd in google-chrome-stable google-chrome chromium chromium-browser chromium-browser-stable brave-browser chrome; do
if out=$(_try_bin "$cmd") >/dev/null 2>&1; then
CHROME_BIN="$(_try_bin "$cmd")" || true
break
fi
done
fi
# Rutas absolutas comunes (snap, opt, /usr/bin)
if [ -z "$CHROME_BIN" ]; then
for path in \
/snap/bin/chromium \
/usr/bin/google-chrome-stable \
/usr/bin/google-chrome \
/usr/bin/chromium \
/usr/bin/chromium-browser \
/opt/google/chrome/google-chrome \
/usr/lib/chromium/chromium \
/usr/lib/chromium-browser/chrome \
/usr/lib/chromium/chrome-sandbox; do
if [ -x "$path" ]; then
CHROME_BIN="$path"
break
fi
done
fi
if [ -z "$CHROME_BIN" ]; then
echo "ERROR: No se ha encontrado un binario de Chrome/Chromium. Exporta CHROME_PATH o instala Chrome/Chromium."
echo "Sugerencias:"
echo " sudo apt update && sudo apt install -y chromium"
echo " o descargar Google Chrome desde https://www.google.com/chrome/"
exit 2
fi
mkdir -p "$USER_DATA_DIR"
echo "Iniciando: $CHROME_BIN --remote-debugging-port=$PORT --user-data-dir=$USER_DATA_DIR"
# Ejecutar en primer plano para mostrar errores en consola si los hay.
exec "$CHROME_BIN" \
--remote-debugging-port="$PORT" \
--user-data-dir="$USER_DATA_DIR" \
--no-first-run \
--disable-background-timer-throttling \
--disable-backgrounding-occluded-windows \
--disable-renderer-backgrounding \
--disable-default-apps \
--no-default-browser-check \
--disable-popup-blocking \
--enable-logging=stderr \
--v=1 "$@"