forked from craftbeerpi/craftbeerpi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·189 lines (143 loc) · 5.1 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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
#!/bin/bash
#
# CraftBeer PI
#
# type the following commands:
# chmod +x install.sh
# sudo ./install.sh
# sudo reboot
clear
cat << "EOF"
----------------------------------------------------------------------------
Weclome to Installation
_____ __ _ ____ _____ _____ _.._..,_,_
/ ____| / _| | | _ \ | __ \_ _| ( )
| | _ __ __ _| |_| |_| |_) | ___ ___ _ __| |__) /| | ]~,"-.-~~[
| | | '__/ _` | _| __| _ < / _ \/ _ \ \'__|____/ | | .=])' (; ([
| |____| | | (_| | | | |_| |_) | __/ __/ | | | _| |_ | ]:: ' [
\_____|_| \__,_|_| \__|____/ \___|\___|_| |_| |_____| '=]): .) ([
(C) 2015 www.CraftBeerPI.com |:: ' |
~~----~~
----------------------------------------------------------------------------
EOF
while true; do
read -p "Would you like run apt-get update & apt-get upgrade? (y/n): " yn
case $yn in
[Yy]* ) apt-get -y update; apt-get -y upgrade; break;;
[Nn]* ) break;;
* ) echo "(Y/N)";;
esac
done
while true; do
read -p "Would you like to install wiringPI? This is required to control the GPIO (y/n): " yn
case $yn in
[Yy]* ) git clone git://git.drogon.net/wiringPi;
cd wiringPi;
./build; cd ..;
rm -rf wiringPi;
break;;
[Nn]* ) break;;
* ) echo "(Y/N)";;
esac
done
#Install pip (package installer):
apt-get -y install python-setuptools
easy_install pip
#Install PySerial
#pip install pyserial
#Install Python i2c and smbus
#apt-get -y install python-smbus
#Install Flask
apt-get -y install python-dev
apt-get -y install libpcre3-dev
pip install -r requirements.txt
if ! grep -q "dtoverlay=w1-gpio" "/boot/config.txt"; then
cat << "EOF"
----------------------------------------------------------------------------
----------------------------------------------------------------------------
Device Tree Overlay for 1-wire is NOT confiured in /boot/config.txt.
This is required for 1-wire thermometer.
This script will add the following line to the /boot/config.txt
dtoverlay=w1-gpio,gpiopin=4,pullup=on
The 1-wire thermometer must be conneted to GPIO 4!
EOF
while true; do
read -p "Would you like to add active 1-wire support at your Raspberry PI now? (y/n): " yn
case $yn in
[Yy]* )
echo '# CraftBeerPi 1-wire support' >> "/boot/config.txt"
echo 'dtoverlay=w1-gpio,gpiopin=4,pullup=on' >> "/boot/config.txt"
break;;
[Nn]* ) break;;
* ) echo "(Y/N)";;
esac
done
fi
cat << "EOF"
EOF
if ! grep -q "dtoverlay=w1-gpio" "/boot/config.txt"; then
cat << "EOF"
----------------------------------------------------------------------------
----------------------------------------------------------------------------
Device Tree Overlay for 1-wire is NOT confiured in /boot/config.txt.
This is required for 1-wire thermometer.
This script will add the following line to the /boot/config.txt
dtoverlay=w1-gpio,gpiopin=4,pullup=on
The 1-wire thermometer must be conneted to GPIO 4!
EOF
while true; do
read -p "Would you like to add active 1-wire support at your Raspberry PI now? (y/n): " yn
case $yn in
[Yy]* )
echo '# CraftBeerPi 1-wire support' >> "/boot/config.txt"
echo 'dtoverlay=w1-gpio,gpiopin=4,pullup=on' >> "/boot/config.txt"
break;;
[Nn]* ) break;;
* ) echo "(Y/N)";;
esac
done
fi
while true; do
read -p "Would you like Gembird USB Support (y/n): " yn
case $yn in
[Yy]* ) apt-get install sispmctl
break;;
[Nn]* ) break;;
* ) echo "Please select (y/n): ";;
esac
done
while true; do
read -p "Would you like to start CarftBeerPI automatically after boot? (y/n): " yn
case $yn in
[Yy]* ) sed "s@#DIR#@${PWD}@g" config/craftbeerpiboot > /etc/init.d/craftbeerpiboot
chmod 755 /etc/init.d/craftbeerpiboot;
update-rc.d craftbeerpiboot defaults;
break;;
[Nn]* ) break;;
* ) echo "Please select (y/n): ";;
esac
done
cat << "EOF"
----------------------------------------------------------------------------
___ _ _ _ _ _ ___ _ _ _ _
|_ _|_ _ __| |_ __ _| | |__ _| |_(_)___ _ _ | __(_)_ _ (_)__| |_ ___ __| |
| || ' \(_-< _/ _` | | / _` | _| / _ \ ' \ | _|| | ' \| (_-< ' \/ -_) _` |
|___|_||_/__/\__\__,_|_|_\__,_|\__|_\___/_||_| |_| |_|_||_|_/__/_||_\___\__,_|
Default URL: http://<IP-Address>:5000
Shell Commands to controll the Server:
- Start: sudo /etc/init.d/craftbeerpiboot start
- Status: sudo /etc/init.d/craftbeerpiboot status
- Stop: sudo /etc/init.d/craftbeerpiboot stop
!!! The App is currently not running !!!
Happy Brewing!
www.CraftBeerPI.com
----------------------------------------------------------------------------
EOF
while true; do
read -p "Reboot the Raspberry PI now? (y/n): " yn
case $yn in
[Yy]* ) reboot; break;;
[Nn]* ) break;;
* ) echo "Please select (y/n): ";;
esac
done