32 lines
799 B
Bash
32 lines
799 B
Bash
#!/usr/bin/env bash
|
|
# Run this ONCE before starting the stack.
|
|
# Creates the host directory and FIFOs for audio routing.
|
|
#
|
|
# Usage: sudo bash scripts/init-pipes.sh [directory]
|
|
# Default directory: /opt/audiocontrol/pipes
|
|
|
|
set -euo pipefail
|
|
|
|
DIR="${1:-/opt/audiocontrol/pipes}"
|
|
|
|
echo "Creating audio pipe directory: $DIR"
|
|
mkdir -p "$DIR"
|
|
|
|
for PIPE in mopidy.fifo turntable.fifo cava.fifo; do
|
|
FULL="$DIR/$PIPE"
|
|
if [[ -p "$FULL" ]]; then
|
|
echo " ✓ $PIPE (already exists)"
|
|
else
|
|
mkfifo "$FULL"
|
|
chmod 666 "$FULL"
|
|
echo " + $PIPE created"
|
|
fi
|
|
done
|
|
|
|
# Allow docker containers (which may run as different UIDs) to write
|
|
chmod 777 "$DIR"
|
|
|
|
echo ""
|
|
echo "Done. Update AUDIO_PIPES_DIR in .env if you used a non-default path:"
|
|
echo " AUDIO_PIPES_DIR=$DIR"
|