#!/bin/bash # Install/update web tools on a board that already has Shairport Sync with D-Bus. set -euo pipefail PACKAGE_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." && pwd) [[ $EUID == 0 ]] || { echo 'sudo로 실행해 주세요.' >&2; exit 1; } /usr/local/bin/shairport-sync -V | grep -qi dbus || { echo '먼저 AirPlay D-Bus 지원 빌드를 설치해 주세요.' >&2; exit 1; } install -d -m 755 /usr/local/lib/radxa-mixer/web install -m 755 "$PACKAGE_DIR/scripts/radxa-audio.py" /usr/local/bin/radxa-audio install -m 755 "$PACKAGE_DIR/scripts/web_server.py" /usr/local/lib/radxa-mixer/web_server.py install -m 644 "$PACKAGE_DIR/scripts/input_controls.py" /usr/local/lib/radxa-mixer/input_controls.py install -m 644 "$PACKAGE_DIR/scripts/web/"* /usr/local/lib/radxa-mixer/web/ cat > /etc/systemd/system/radxa-mixer-web.service <<'UNIT' [Unit] Description=Radxa wireless audio mixer web interface After=network.target bluetooth.service shairport-sync.service bluealsa.service [Service] ExecStart=/usr/bin/python3 /usr/local/lib/radxa-mixer/web_server.py --port 80 Restart=on-failure RestartSec=3 UMask=0022 NoNewPrivileges=true [Install] WantedBy=multi-user.target UNIT # Advertise the web mixer over Bonjour/mDNS (_http._tcp) next to HOSTNAME.local. install -d -m 755 /etc/avahi/services cat > /etc/avahi/services/radxa-mixer.service <<'AVAHI' Radxa Mixer (%h) _http._tcp 80 path=/ AVAHI systemctl daemon-reload systemctl enable --now radxa-mixer-web systemctl restart radxa-mixer-web echo "웹 믹서: http://$(hostname).local 또는 http://보드IP"