-
Notifications
You must be signed in to change notification settings - Fork 1
/
setup.sh
84 lines (67 loc) · 2.59 KB
/
setup.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
#!/bin/bash
# speed-install.sh script written by Claude Pageau 1-Jul-2016
ver="2.0"
INSTALL_DIR='enviro-pi' # Default folder install location
cd ~ # change to users home directory
# Remember where this script was launched from
HOME_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# List of files to copy to destination RPI using wget
enviro_files=("README.md" "LICENSE" "enviro-web.py" "enviro-pi.py" "run.sh" \
"static/Chart.min.js" "static/favicon.ico" "static/menu.js" \
"static/moment.min.js" "static/raspberry_pi_logo.png" "static/style.css" \
"supervisor/enviro-web.conf" "supervisor/enviro-pi.conf" \
"templates/statistics.html" "templates/charts.html" "templates/statistics.html" "templates/status.html")
echo "-----------------------------------------------"
echo "enviro-pi setup.sh ver $ver"
echo "-----------------------------------------------"
echo "Download GitHub Files to $INSTALL_DIR"
mkdir -p $INSTALL_DIR
cd $INSTALL_DIR
mkdir -p static
mkdir -p supervisor
mkdir -p templates
for fname in "${enviro_files[@]}" ; do
wget_output=$(wget -O $fname -q --show-progress https://raw.github.com/pageauc/enviro-pi/master/$fname)
if [ $? -ne 0 ]; then
wget -O $fname https://raw.github.com/pageauc/enviro-pi/master/$fname
if [ $? -ne 0 ]; then
echo "ERROR - $fname wget Download Failed. Check Internet Connection"
fi
fi
done
wget -O templates/about.html -q https://raw.github.com/pageauc/enviro-pi/master/templates/about.html
if [ -f config.py ]; then # check if local file exists.
wget -O config.py.new -q --show-progress https://raw.github.com/pageauc/enviro-pi/master/config.py
else
wget -O config.py -q --show-progress https://raw.github.com/pageauc/enviro-pi/master/config.py
fi
echo "-----------------------------------------------"
echo "Install Dependencies. Wait ..."
echo "-----------------------------------------------"
sudo apt-get install -yq supervisor
sudo apt-get install -yq python3-flask
sudo apt-get install -yq sqlite3
sudo apt-get install -yq sense-hat
sudo apt-get install -yq dos2unix
dos2unix *py
dos2unix *sh
chmod +x *.py
chmod -x config.py
chmod +x *.sh
cd $HOME_DIR
echo "
-----------------------------------------------
Install Complete
-----------------------------------------------
1. Ensure RPI sensehat is installed and working
2. Test enviro-pi
cd ~/enviro-pi
./enviro-pi.py
./run.sh install
./run.sh start
./run.sh status
Access enviro-pi web interface per instructions.
Refresh Status page to display sensehat data and confirm system is working.
$INSTALL_DIR version $ver
Good Luck Claude ...
Bye"