-
Notifications
You must be signed in to change notification settings - Fork 3
/
install.sh
executable file
·33 lines (32 loc) · 1.18 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
#!/bin/bash
if [ "$(id -u)" != "0" ]; then
echo "Please re-run as sudo."
exit 1
fi
echo Reading wiring of Pi board. If there are not wires detected, please check your wiring.
echo After checking wiring again, run i2cdetect -y 1
i2cdetect -y 1
echo Installing speedtest-cli
curl -Lo speedtest.py https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py
echo Updating APT
apt-get update
echo Installing Python-SMBUS
apt-get install python-smbus -y
echo "Should now be installed, now checking revision"
revision=`python -c "import RPi.GPIO as GPIO; print GPIO.RPI_REVISION"`
if [ $revision = "1" ]
then
echo "I2C Pins detected as 0"
cp installConfigs/i2c_lib_0.py ./i2c_lib.py
else
echo "I2C Pins detected as 1"
cp installConfigs/i2c_lib_1.py ./i2c_lib.py
fi
echo "I2C Library setup for this revision of Raspberry Pi, if you change revision a modification will be required to i2c_lib.py"
echo "Now overwriting modules & blacklist. This will enable i2c Pins"
cp installConfigs/modules /etc/
cp installConfigs/raspi-blacklist.conf /etc/modprobe.d/
printf "dtparam=i2c_arm=1\n" >> /boot/config.txt
echo "Should be now all finished. Please press any key to now reboot."
read -n1 -s
sudo reboot