forked from will-tm/Mintybatterymonitor
-
Notifications
You must be signed in to change notification settings - Fork 1
/
MintyInstall.sh
executable file
·31 lines (28 loc) · 971 Bytes
/
MintyInstall.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
#!/bin/bash
cd ~
sudo apt-get update
sudo apt-get install libpng12-dev -y
sudo apt-get install python-gpiozero -y
sudo apt-get install python-pkg-resources python3-pkg-resources -y
sudo apt-get install -y i2c-tools -y
sudo apt-get install build-essential python-dev python-smbus python-pip -y
sudo pip install adafruit-ads1x15
cd ~
sudo chmod 755 /home/pi/Mintybatterymonitor/Pngview/pngview
sudo chmod 755 /home/pi/Mintybatterymonitor/MintyStart.sh
sudo sed -i '/\"exit 0\"/!s/exit 0/\/home\/pi\/Mintybatterymonitor\/MintyStart.sh \&\nexit 0/g' /etc/rc.local
config_txt=/boot/config.txt
echo "Enabling i2c..."
if ! grep '^dtparam=i2c_arm=on' $config_txt; then
echo 'dtparam=i2c_arm=on' >> $config_txt
else
echo "i2c already enabled."
fi
etc_modules=/etc/modules
echo "Adding entries to $etc_modules..."
if ! grep '^i2c-bcm2708' $etc_modules; then
echo 'i2c-bcm2708' >> $etc_modules
echo 'i2c-dev' >> $etc_modules
else
echo "$etc_modules already set up."
fi