Skip to content

Commit bf390bf

Browse files
authored
Use tempio to generate config (#48)
1 parent 14393e1 commit bf390bf

2 files changed

Lines changed: 14 additions & 4 deletions

File tree

rootfs/etc/cont-init.d/pulse-config.sh

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,26 @@
22
# ==============================================================================
33
# Check device information and adjust Pulse
44
# ==============================================================================
5-
ALSA_CARDS="$(aplay -l)"
5+
declare tsched
6+
readonly ALSA_CARDS="$(aplay -l)"
67

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

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

16-
sed -i "s/module-udev-detect/module-udev-detect tsched=0/" /etc/pulse/system.pa
18+
else
19+
tsched=true
1720
fi
21+
22+
# Generate config
23+
bashio::var.json \
24+
tsched "^${tsched}" \
25+
| tempio \
26+
-template /usr/share/tempio/system.pa \
27+
-out /etc/pulse/system.pa
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ load-module module-switch-on-port-available
2828
load-module module-switch-on-connect
2929

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

3434
### Load several protocols

0 commit comments

Comments
 (0)