-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathinstall.sh
executable file
·70 lines (56 loc) · 1.56 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
#!/bin/bash
echo "--------------------------------------------------------"
echo "Installing Chaos:"
#build dependencies:
declare -a depencencies=(build-essential libncurses5-dev libusb-1.0-0-dev libjsoncpp-dev cmake git libzmq3-dev raspberrypi-kernel-headers python3-dev libatlas-base-dev python3-pip)
toInstall=()
echo "Dependencies:" ${depencencies[@]}
for dependency in "${depencencies[@]}"
do
echo "Checking for" $dependency
if [ $(dpkg-query -W -f='${Status}' $dependency 2>/dev/null | grep -c "ok installed") -eq 0 ];
then
echo "not installed:" $dependency
toInstall+=($dependency)
fi
done
echo ${toInstall[@]}
if [ ${#toInstall[@]} -ne 0 ];
then
sudo apt-get update
sudo apt-get install -y ${toInstall[@]}
fi
git submodule init
git submodule update
if [ ! -d "build" ];
then
mkdir build
fi
cd build
cmake ..
make -j4
sudo make install
cd ..
# add dwc2 to /boot/config.txt
sudo -s eval "grep -qxF 'dtoverlay=dwc2' /boot/config.txt || echo 'dtoverlay=dwc2' >> /boot/config.txt "
sudo -s eval "pip3 install flexx pyzmq numpy pygame --system"
if [ ! -f "/home/pi/chaosConfig.json" ];
then
cp blankConfig.json /home/pi/chaosConfig.json
fi
if [ ! -d "/home/pi/chaosLogs" ];
then
mkdir /home/pi/chaosLogs
fi
cd scripts/
sudo bash install.sh
cd ..
#raw-gadget patch:
if ! patch -R -s -f --dry-run raw-gadget-timeout/raw_gadget/raw_gadget.c raw_gadget_timeout.patch; then
patch raw-gadget-timeout/raw_gadget/raw_gadget.c raw_gadget_timeout.patch
fi
cd raw-gadget-timeout/raw_gadget/
make
cd ../..
echo "Done."
echo "--------------------------------------------------------"