forked from orthoptera-aao/aao-sound
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsdc-inst
134 lines (123 loc) · 5.94 KB
/
sdc-inst
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
#!/bin/bash
# WildlifeSystems
#
# This script is part of the WildlifeSystems project. For further information
# please refer to https://docs.wildlife.systems, or for more information on
# the project itself, please refer to https://wildlife.systems.
# Return codes
#
# Further information on WildlifeSystems standard reurn codes can be found
# at https://docs.wildlife.systems/return-codes.html
# 0 - Success
# 30 - Unsupported device
# Function to get location of config.txt
function get_config_txt {
if [ -f /boot/firmware/config.txt ]; then
echo "/boot/firmware/config.txt"
else
echo "/boot/config.txt"
fi
}
case "$1" in
list)
echo "none None"
echo "rpi-core-audio Raspberry Pi Onboard Audio"
echo "ai-zero audioInjector Zero"
echo "ai-ocoto audioInjector Octo"
echo "ai-ultra audioInjector Ultra"
echo "i2c i2c microphone (e.g.Google Voice Hat)"
echo "respeaker-6 Respeaker 6 mic array"
echo "rpa-dac Audio+ DAC"
echo "wolfson Wolfson Audio Card"
;;
i2c)
config_txt=$(get_config_txt)
cnt=$(grep -c googlevoicehat-soundcard "$config_txt")
if [ "$cnt" -eq "0" ]; then
sudo sh -c "echo '# enable i2c sound card
dtoverlay=googlevoicehat-soundcard' >> $config_txt"
fi
;;
wolfson)
config_txt=$(get_config_txt)
# firstly disable PWM audio
sudo sed -i 's/^\s*dtparam=audio/#dtparam=audio/' "$config_txt"
# now check to see the correct device tree overlay is loaded ...
cnt=`grep -c rpi-cirrus-wm5102 $config_txt`
if [ "$cnt" -eq "0" ]; then
sudo sh -c "echo '# enable the Wolfson sound card
dtoverlay=rpi-cirrus-wm5102' >> $config_txt"
fi
#Install helper script
wget https://github.com/Wildlife-Systems/sound-device-control/raw/master/inst/rpi-cirrus-functions.sh
sudo mv rpi-cirrus-functions.sh /usr/bin
sudo chmod +x /usr/bin/rpi-cirrus-functions.sh
sudo chown root:root /usr/bin/rpi-cirrus-functions.sh
;;
ai-ultra)
config_txt=$(get_config_txt)
#sudo rpi-update
# firstly disable PWM audio
sudo sed -i 's/^\s*dtparam=audio/#dtparam=audio/' $config_txt
# now check to see the correct device tree overlay is loaded ...
cnt=`grep -c audioinjector-ultra $config_txt`
if [ "$cnt" -eq "0" ]; then
sudo sh -c "echo '# enable the AudioInjector.net sound card
dtoverlay=audioinjector-ultra' >> $config_txt"
fi
;;
ai-octo)
echo "Adding script to /etc/profile.d to ensure kernel modules are loaded."
echo "See: https://github.com/Audio-Injector/Octo/issues/14"
wget https://github.com/wildlife-systems/sound-device-control/raw/master/inst/ai-octo-profile.d.sh
sudo mv ai-octo-profile.d.sh /etc/profile.d/
sudo chmod +x /etc/profile.d/ai-octo-profile.d.sh
sudo chown root:root /etc/profile.d/ai-octo-profile.d.sh
wget https://github.com/wildlife-systems/sound-device-control/raw/master/inst/audioinjector.octo.setup_0.4_all.deb
yes | sudo dpkg -i audioinjector.octo.setup_0.4_all.deb
rm audioinjector.octo.setup_0.4_all.deb
;;
ai-zero)
wget https://github.com/wildlife-systems/sound-device-control/raw/master/inst/audio.injector.scripts_0.1-1_all.deb
yes | sudo dpkg -i audio.injector.scripts_0.1-1_all.deb
rm audio.injector.scripts_0.1-1_all.deb
yes | audioInjector-setup.sh
;;
rpa-dac)
sudo sh -c "echo 'defaults.pcm.card 0
defaults.ctl.card 0' >> /etc/asound.conf"
sudo wget -O - https://github.com/wildlife-systems/sound-device-control/raw/master/inst/rpa-dac | bash
;;
respeaker-6)
sudo apt-get update
sudo apt-get install git -y
sudo raspi-config nonint do_onewire 1
cd /tmp
git clone https://github.com/Wildlife-Systems/sound-device-seeed-voicecard
cd sound-device-seeed-voicecard
sudo ./install.sh
sudo rm -r ../sound-device-seeed-voicecard
;;
respeaker-6_oldkernel)
sudo apt-get update
sudo apt-get install git -y
sudo raspi-config nonint do_onewire 1
cd /tmp
git clone https://github.com/Wildlife-Systems/sound-device-seeed-voicecard
cd sound-device-seeed-voicecard
sudo ./install.sh
sudo rm -r ../sound-device-seeed-voicecard
cd /tmp
wget -O kernel-headers_armhf.deb http://archive.raspberrypi.org/debian/pool/main/r/raspberrypi-firmware/raspberrypi-kernel-headers_1.20200819-1_armhf.deb
wget -O kernel_armhf.deb http://archive.raspberrypi.org/debian/pool/main/r/raspberrypi-firmware/raspberrypi-kernel_1.20200819-1_armhf.deb
sudo dpkg -i kernel-headers_armhf.deb kernel_armhf.deb
sudo apt-mark hold raspberrypi-kernel-headers raspberrypi-kernel
;;
none)
exit 0
;;
*)
echo "$1 is not supported."
exit 30
;;
esac