forked from project-alice-assistant/HermesLedControl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
108 lines (93 loc) · 2.98 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
#!/usr/bin/env bash
if [ -z "$1" ]; then
echo "No version supplied"
exit
else
VERSION=$1
fi
echo "What device do you wish to control with SLC?"
select device in "respeaker2" "respeaker4" "respeakerMicArrayV2" "neopixels" "matrixvoice" "don't overwrite existing parameters" "cancel"; do
case $device in
neopixels)
device="neoPixels12leds";
break;;
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" "cancel"; do
case $pattern in
cancel) exit;;
*) break;;
esac
done
fi
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
pip install RPi.GPIO
pip install spidev
pip install gpiozero
pip install paho-mqtt
pip install pytoml
mkdir -p logs
chown pi logs
chmod +x ./installers/respeakers.sh
directory=${PWD##*/}
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
echo "Do you need to install your $device?"
select answer in "yes" "no" "cancel"; do
case $answer in
yes)
case $device in
matrixvoice)
chmod +x ./installers/matrixvoice.sh
./installers/matrixvoice.sh
break
;;
respeaker2)
chmod +x ./installers/respeakers.sh
./installers/respeakers.sh
break
;;
respeaker4)
chmod +x ./installers/respeakers.sh
./installers/respeakers.sh
break
;;
neopixels)
chmod +x ./installers/neopixels.sh
./installers/neopixels.sh
break
;;
respeakerMicArrayV2)
chmod +x ./installers/respeakerMicArrayV2.sh
./installers/respeakerMicArrayV2.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"