forked from haydnw/AirPi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
105 lines (91 loc) · 4.31 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
#! /bin/bash
# =============================================================================
# File: install.sh
# Requires: Raspbian on Raspberry Pi.
# Purpose: An easy way to install the AirPi software.
# Comments: - Just automates the steps outlined in README.md.
# - Installs python3 packages, because hopefully the code will be
# updated soon!
# - Installs to home directory of the default 'pi' user.
# - Assumes that the Raspberry Pi is a Revision 2.0 board, i.e. the
# I2C bus is on Port 1 (*not* Port 0 as it was on Rev. 1 boards).
# - Includes an apt-get 'upgrade' to latest firmware.
# Author: Haydn Williams <[email protected]>
# Date: January 2015
# =============================================================================
# Begin
echo "====================================="
echo "[AirPi] BEGINNING AIRPI INSTALLATION."
echo "====================================="
echo ""
if whiptail --title "AirPi installation" --yes-button "Heck yes!" --no-button "Erm, no thanks" --yesno "This script installs the AirPi software from github.com/haydnw/AirPi onto your Raspberry Pi.
Please read the notes below before deciding whether you want to continue with the installation.
- Installs to home directory of the default 'pi' user.
- Assumes that the Raspberry Pi is a Revision 2.0 board.
(If not, you'll have to change the I2C port number from 1 to 0 in /boot/config.txt)
- Includes an apt-get 'upgrade' to latest software/firmware.
Start installing the AirPi software?" 18 100 ;then
# Ensure everything is up-to-date
echo "====================================="
echo "[AirPi] UPDATING EXISTING PACKAGES..."
echo "====================================="
sudo apt-get -y update
sudo apt-get -y upgrade
echo "============================================"
echo "[AirPi] FINISHED UPDATING EXISTING PACKAGES."
echo "============================================"
echo ""
# Install required packages using apt-get
echo "==========================================="
echo "[AirPi] INSTALLING NEW REQUIRED PACKAGES..."
echo "==========================================="
sudo apt-get -y install python-dev python-smbus python-setuptools python-requests python3-dev python3-requests libxml2-dev libxslt1-dev python-lxml i2c-tools
echo ""
# Install Twitter support (not available via apt-get)
easy_install Twitter
echo "=================================================="
echo "[AirPi] FINISHED INSTALLING NEW REQUIRED PACKAGES."
echo "=================================================="
echo ""
# Enable I2C support
echo "==============================="
echo "[AirPi] ENABLING I2C SUPPORT..."
echo "==============================="
sudo echo "i2c-dev" >> /etc/modules
sudo echo "# Enable I2C (http://www.raspberrypi.org/forums/viewtopic.php?f=28&t=97314)" >> /boot/config.txt
sudo echo "dtparam=i2c1=on" >> /boot/config.txt # Use i2c0 if you have a Rev. 1 RPi board
sudo echo "" >> /boot/config.txt
if [ -e "/etc/modprobe.d/raspi-blacklist.conf" ]
then
# Pre-2015 Raspbian, so raspi-blacklist still exists
sudo sed -i 's/#i2c-bcm2708/i2c-bcm2708/g' /etc/modprobe.d/raspi-blacklist.conf
fi
echo "======================================"
echo "[AirPi] FINISHED ENABLING I2C SUPPORT."
echo "======================================"
echo ""
# Install AirPi software from GitHub
echo "===================================="
echo "[AirPi] INSTALLING AIRPI SOFTWARE..."
echo "===================================="
git clone https://github.com/haydnw/airpi /home/pi/AirPi
sudo chown -R pi:pi /home/pi/AirPi
sudo echo "export PATH=$PATH:~/AirPi" >> /home/pi/.profile
echo "==========================================="
echo "[AirPi] FINISHED INSTALLING AIRPI SOFTWARE."
echo "==========================================="
echo ""
# Let the user know the score
echo "======================="
echo "[AirPi] SETUP COMPLETE."
echo "======================="
if whiptail --title "AirPi installation" --yes-button "Reboot now!" --no-button "Nah, later" --yesno "AirPi installation is complete.
You will need to reboot your Raspberry Pi before using the AirPi.
Have fun! :)" 18 100 ; then
sudo reboot
else
echo "[AirPi] Installation complete. Will not reboot."
fi
else
echo "[AirPi] Installation aborted. You can stop panicking now."
fi