Skip to content

Commit

Permalink
Use tempio to generate config (#48)
Browse files Browse the repository at this point in the history
  • Loading branch information
pvizeli authored Feb 13, 2021
1 parent 14393e1 commit bf390bf
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
16 changes: 13 additions & 3 deletions rootfs/etc/cont-init.d/pulse-config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,26 @@
# ==============================================================================
# Check device information and adjust Pulse
# ==============================================================================
ALSA_CARDS="$(aplay -l)"
declare tsched
readonly ALSA_CARDS="$(aplay -l)"

# RaspberryPi
if echo "${ALSA_CARDS}" | grep -q "\[bcm2835 ALSA\]"; then
bashio::log.info "Found RaspberryPi system"
tsched=false

sed -i "s/module-udev-detect/module-udev-detect tsched=0/" /etc/pulse/system.pa
# Odroid N2
elif echo "${ALSA_CARDS}" | grep -q "\[G12B-ODROID-N2\]"; then
bashio::log.info "Found Odroid N2 system"
tsched=false

sed -i "s/module-udev-detect/module-udev-detect tsched=0/" /etc/pulse/system.pa
else
tsched=true
fi

# Generate config
bashio::var.json \
tsched "^${tsched}" \
| tempio \
-template /usr/share/tempio/system.pa \
-out /etc/pulse/system.pa
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ load-module module-switch-on-port-available
load-module module-switch-on-connect

### Automatically load driver modules depending on the hardware available
load-module module-udev-detect
load-module module-udev-detect {{ if not .tsched }}tsched=0{{ end }}
load-module module-bluetooth-discover

### Load several protocols
Expand Down

0 comments on commit bf390bf

Please sign in to comment.