Sistema de automatización de radio en Rust (GTK4 + GStreamer): reproductor principal con crossfade y ducking, scheduler de comerciales, refill de playlist, y herramientas auxiliares (pautaje, parrilla, botonera, visor, buscador, playlist, grabador, reportes). Incluye sistema de skins y modos de Players (paneles de reproducción configurables).
74 lines
2.5 KiB
Bash
Executable File
74 lines
2.5 KiB
Bash
Executable File
#!/bin/bash
|
|
# Compila radio-player para Debian Bookworm arm64 usando Docker.
|
|
#
|
|
# Uso:
|
|
# ./build-rpi3.sh # solo compila
|
|
# ./build-rpi3.sh --push # compila y copia al host indicado en $RPI3_HOST
|
|
# RPI3_HOST=user@host ./build-rpi3.sh --push
|
|
# ./build-rpi3.sh --push user@host # equivalente, pasando el host como argumento
|
|
set -e
|
|
cd "$(dirname "$0")"
|
|
|
|
IMAGE="gradio-builder:bookworm"
|
|
TARGET="target-bookworm"
|
|
|
|
# Host destino para --push. Configurable vía variable de entorno RPI3_HOST
|
|
# o como segundo argumento. Sin valor por defecto: el usuario debe definirlo.
|
|
RPI3="${2:-${RPI3_HOST:-}}"
|
|
|
|
# Usar docker directo si el usuario está en el grupo, sino sudo
|
|
if docker info &>/dev/null 2>&1; then
|
|
DOCKER="docker"
|
|
else
|
|
DOCKER="sudo docker"
|
|
fi
|
|
|
|
# Construir imagen si no existe
|
|
if ! $DOCKER image inspect "$IMAGE" &>/dev/null 2>&1; then
|
|
echo "==> Construyendo imagen Docker $IMAGE ..."
|
|
$DOCKER build -f docker/Dockerfile.bookworm -t "$IMAGE" .
|
|
echo "==> Imagen lista."
|
|
fi
|
|
|
|
echo "==> Compilando para Debian Bookworm arm64 ..."
|
|
$DOCKER run --rm \
|
|
-v "$PWD":/build \
|
|
-v gradio-cargo-registry:/root/.cargo/registry \
|
|
-v gradio-cargo-git:/root/.cargo/git \
|
|
-e CARGO_TARGET_DIR=/build/$TARGET \
|
|
"$IMAGE" \
|
|
cargo build --release
|
|
|
|
# Corregir ownership si los archivos quedaron como root (sudo docker)
|
|
if [ -d "$TARGET" ] && [ "$(stat -c %U "$TARGET")" = "root" ]; then
|
|
sudo chown -R "$(whoami)":"$(whoami)" "$TARGET"
|
|
fi
|
|
|
|
echo "==> Build completo. Binarios en $TARGET/release/"
|
|
|
|
# Copiar al host remoto si se pasa --push
|
|
if [[ "$1" == "--push" ]]; then
|
|
if [[ -z "$RPI3" ]]; then
|
|
echo "ERROR: --push requiere el host destino." >&2
|
|
echo " Pásalo como argumento: ./build-rpi3.sh --push user@host" >&2
|
|
echo " O exporta la variable: export RPI3_HOST=user@host" >&2
|
|
exit 1
|
|
fi
|
|
echo "==> Copiando binarios a $RPI3 ..."
|
|
ssh "$RPI3" "mkdir -p ~/radio-player/target/release"
|
|
rsync -av --progress \
|
|
"$TARGET/release/radio-player" \
|
|
"$TARGET/release/comercial-scheduler" \
|
|
"$TARGET/release/playlist-refill" \
|
|
"$TARGET/release/gr-buscador" \
|
|
"$TARGET/release/gr-playlist" \
|
|
"$TARGET/release/gr-pautaje" \
|
|
"$TARGET/release/gr-parrilla" \
|
|
"$TARGET/release/gr-botonera" \
|
|
"$TARGET/release/gr-visor" \
|
|
"$TARGET/release/gr-reportes" \
|
|
"$TARGET/release/gr-record" \
|
|
"$RPI3":~/radio-player/target/release/ 2>/dev/null || true
|
|
echo "==> Binarios instalados en RPi3."
|
|
fi
|