Serve web mixer at http://radxa-mixer.local on port 80

install.sh now sets the hostname (default radxa-mixer, --hostname or
--keep-hostname to override) after a successful install so Avahi
advertises NAME.local, and the web mixer listens on port 80. The web
server's host check already accepts HOSTNAME.local.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
jsahn
2026-10-12 20:22:48 +09:00
co-authored by Claude Opus 5.5
parent 655fbc1d29
commit 5e8906b43d
6 changed files with 31 additions and 9 deletions
+17 -1
View File
@@ -6,17 +6,21 @@ AIRPLAY_NAME='Radxa Audio'
DAC_PCM='hw:CARD=Audio,DEV=0'
WIFI5=0
JOBS=1
HOST_NAME=radxa-mixer
usage() {
cat <<'HELP'
Usage: sudo bash install.sh [--name NAME] [--dac hw:CARD=Audio,DEV=0] [--wifi5] [--jobs 1|2]
Usage: sudo bash install.sh [--name NAME] [--dac hw:CARD=Audio,DEV=0] [--hostname radxa-mixer|--keep-hostname] [--wifi5] [--jobs 1|2]
Default output is USB DAC. Pair a headphone after installation to select Bluetooth output.
--wifi5 only applies to aic8800_fdrv with ps_on and he_on module parameters.
The web mixer is served at http://HOSTNAME.local (port 80).
HELP
}
while (( $# )); do
case "$1" in
--name) AIRPLAY_NAME=${2:?Missing name}; shift 2 ;;
--dac) DAC_PCM=${2:?Missing DAC PCM}; shift 2 ;;
--hostname) HOST_NAME=${2:?Missing hostname}; shift 2 ;;
--keep-hostname) HOST_NAME=; shift ;;
--wifi5) WIFI5=1; shift ;;
--jobs) JOBS=${2:?Missing jobs}; shift 2 ;;
-h|--help) usage; exit 0 ;;
@@ -25,6 +29,9 @@ while (( $# )); do
done
[[ $EUID == 0 ]] || { echo 'sudo로 실행해 주세요.' >&2; exit 1; }
[[ "$JOBS" == 1 || "$JOBS" == 2 ]] || { echo '--jobs는 1 또는 2입니다.' >&2; exit 1; }
# mDNS names must be valid DNS labels; underscores are not resolvable everywhere.
[[ -z $HOST_NAME || $HOST_NAME =~ ^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$ ]] || {
echo '--hostname은 영문 소문자, 숫자, 하이픈만 사용할 수 있습니다.' >&2; exit 1; }
[[ $(uname -s) == Linux ]] || { echo 'Radxa의 Linux에서 실행해 주세요.' >&2; exit 1; }
# This release is deliberately restricted to the package environment we inspected.
# shellcheck source=/dev/null
@@ -155,5 +162,14 @@ radxa-audio init --name "$AIRPLAY_NAME" --dac "$DAC_PCM"
radxa-audio status
bash "$PACKAGE_DIR/scripts/install-web.sh"
trap - EXIT
if [[ -n $HOST_NAME && $(hostname) != "$HOST_NAME" ]]; then
# After a successful install so a failed run never leaves a renamed host.
OLD_HOST=$(hostname)
hostnamectl set-hostname "$HOST_NAME"
sed -i "s/^127\.0\.1\.1\s.*/127.0.1.1 $HOST_NAME/" /etc/hosts
sed -i "s/\b$OLD_HOST\b/$HOST_NAME/g" /etc/hosts
systemctl restart avahi-daemon radxa-mixer-web
fi
echo "웹 믹서: http://$(hostname).local"
echo "설치 완료. 복구: sudo python3 $PACKAGE_DIR/scripts/backup.py restore $BACKUP_DIR"
if (( WIFI5 )); then echo 'Wi-Fi 5 설정 적용을 위해 편할 때 재부팅하세요. USB 네트워크 주소 설정은 변경하지 않았습니다.'; fi