forked from project-alice-assistant/HermesLedControl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
148 lines (131 loc) · 4.78 KB
/
install.sh
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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
#!/usr/bin/env bash
if [ "$EUID" -ne 0 ]
then echo "Please run as root"
exit
fi
if [ -z "$1" ]; then
echo "No version supplied"
exit
else
VERSION=$1
fi
USER=$(logname)
echo "What device do you wish to control with SLC?"
select device in "respeaker2" "respeaker4" "respeakerMicArrayV2" "neoPixelsSK6812RGBW" "neoPixelsWS2812RGB" "matrixvoice" "matrixcreator" "respeakerCoreV2" "respeaker6MicArray" "respeaker7MicArray" "googleAIY" "I'm using simple leds on GPIOs" "don't overwrite existing parameters" "cancel"; do
case $device in
cancel) exit;;
*) break;;
esac
done
if [ "$device" != "don't overwrite existing parameters" ]; then
echo "What pattern do you want to use?"
select pattern in "google" "alexa" "custom" "kiboost" "cancel"; do
case $pattern in
cancel) exit;;
*) break;;
esac
done
fi
systemctl is-active -q snipsledcontrol && systemctl stop snipsledcontrol
apt-get update
apt-get install -y python-pip
apt-get install -y git
apt-get install -y mosquitto
apt-get install -y mosquitto-clients
apt-get install -y portaudio19-dev
apt-get install -y python-numpy
pip --no-cache-dir install RPi.GPIO
pip --no-cache-dir install spidev
pip --no-cache-dir install gpiozero
pip --no-cache-dir install paho-mqtt
pip --no-cache-dir install pytoml
systemctl is-active -q pixel_ring_server && systemctl disable pixel_ring_server
pip uninstall -y pixel_ring
mkdir -p logs
chown $USER logs
if [ ! -f /etc/systemd/system/snipsledcontrol.service ]; then
cp snipsledcontrol.service /etc/systemd/system
fi
sed -i -e "s/snipsLedControl[0-9\.v_]*/snipsLedControl_${VERSION}/" /etc/systemd/system/snipsledcontrol.service
if [ "$device" != "don't overwrite existing parameters" ]; then
sed -i -e "s/python main\.py.*/python main.py --hardware=${device} --pattern=${pattern}/" /etc/systemd/system/snipsledcontrol.service
fi
if [[ -d "/var/lib/snips/skills/snips-skill-respeaker" ]]; then
echo "snips-skill-respeaker detected, do you want to remove it? Leaving it be might result in weird behaviors..."
select answer in "yes" "no" "cancel"; do
case $answer in
yes)
rm -rf "/var/lib/snips/skills/snips-skill-respeaker"
systemctl restart snips-*
echo "Removed snips-skill-respeaker"
break;;
cancel) exit;;
*) break;;
esac
done
fi
echo "Do you need to install / configure your $device? This is strongly suggested as it does turn off services that might conflict as well!"
select answer in "yes" "no" "cancel"; do
case $answer in
yes)
case $device in
matrixvoice)
chmod +x ./installers/matrixVoiceCreator.sh
./installers/matrixVoiceCreator.sh
break
;;
matrixcreator)
chmod +x ./installers/matrixVoiceCreator.sh
./installers/matrixVoiceCreator.sh
break
;;
respeaker2)
chmod +x ./installers/respeakers.sh
./installers/respeakers.sh
break
;;
respeaker4)
chmod +x ./installers/respeakers.sh
./installers/respeakers.sh
break
;;
neoPixelsSK6812RGBW)
chmod +x ./installers/neopixels.sh
./installers/neopixels.sh
break
;;
neoPixelsWS2812RGB)
chmod +x ./installers/neopixels.sh
./installers/neopixels.sh
break
;;
respeakerMicArrayV2)
chmod +x ./installers/respeakerMicArrayV2.sh
./installers/respeakerMicArrayV2.sh
break
;;
respeakerCoreV2)
chmod +x ./installers/respeakerCoreV2.sh
./installers/respeakerCoreV2.sh
break
;;
respeaker7MicArray)
chmod +x ./installers/respeaker7MicArray.sh
./installers/respeaker7MicArray.sh
break
;;
*)
echo "No installation needed / Installation not yet supported"
break
;;
esac
break;;
cancel) exit;;
*) break;;
esac
done
systemctl daemon-reload
systemctl enable snipsledcontrol
systemctl start snipsledcontrol
echo "Finished installing Snips Led Control $VERSION"
echo "You may want to copy over your custom led patterns to the new version"