-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstallGoAuto.sh
248 lines (188 loc) · 5.66 KB
/
installGoAuto.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
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
#!/bin/bash
########################
# GrandOrgue installer for Raspberry Pi
#
# Created by Ben Yanke
#
# Last modified 4/23/2016
#
# Updated by David Bottrill
# 6th May 2018
# Now compatible with Raspbian Stretch 2018-04-18
# Should also work on Tinkerboard OS
#
########################
########################
# Functions
########################
# Perhaps build in more functionality into these functions later
step() { sed 's/^/[] /'; }
subStep() { sed 's/^/ /'; }
# in progress
stepStatus() {
if [ $1=="1" ]; then
echo "Success";
else
echo "Fail";
fi
}
########################
# Main
########################
# check if running root
if [ "$EUID" -ne 0 ]
then echo "Please run as root."
exit 1
fi
clear;
fullPath=$(pwd)
echo ;
echo "GRANDORGUE INSTALLER FOR RASPBERRY PI";
echo ;
echo "This has been tested on the Pi3";
echo "running a clean Raspian Stretch install (04-18-2018 build).";
echo "should also run on Tinkerboard OS.";
echo ;
echo "For more information, visit:";
echo "https://github.com/djbottrill/GrandOrguePi";
echo ;
echo "########################"
echo ;
echo "Updating package repository" | step
apt-get update -y > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo "Could not update packages." | subStep
exit 1
fi
mkdir -p $fullPath/goSrc
if [ $? -ne 0 ]; then
echo "Directories could not be created." | subStep
exit 1
fi
mkdir -p $fullPath/goBuild
if [ $? -ne 0 ]; then
echo "Directories could not be created." | subStep
exit 1
fi
echo "Getting most recent version of source code from github." | step
/usr/bin/git clone https://github.com/e9925248/grandorgue.git $fullPath/goSrc/ > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo "Github sources already present. Updating them to most recent version." | subStep
/usr/bin/git -C $fullPath/goSrc pull > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo "Github retrevial failed." | subStep
exit 1
else
echo "Update completed." | subStep
fi
fi
echo "Installing needed packages." | step
instPackages() {
apt-get install -y jackd2 > /dev/null 2>&1
# apt-get install -y jackd1 > /dev/null 2>&1
apt-get install -y git gcc make cmake jack docbook-xsl xsltproc zip gettext po4a python-wxgtk3.0 wxglade libwxgtk3.0-dev wxWid* libjack-jackd2-dev libasound2-dev libwxgtk3.0-dev > /dev/null 2>&1
apt-get install -y libusb-1.0-0-dev > /dev/null 2>&1
apt-get install -y libudev-dev > /dev/null 2>&1
apt-get install -y libfftw3* wavpack libwavpack-dev > /dev/null 2>&1
apt-get install -y zlib* > /dev/null 2>&1
}
instPackages;
if [ $? -ne 0 ]; then
echo "Package installation had issues. Trying to fix..." | subStep
apt-get -f install -y > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo "Package installation failed." | subStep
exit 1;
fi
apt-get autoremove -y > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo "Package installation failed." | subStep
exit 1;
fi
instPackages;
if [ $? -ne 0 ]; then
echo "Package installation failed." | subStep
exit 1;
else
echo "Packages installed successfully." | subStep
fi
fi
echo "Upgrading needed packages." | step
apt-get upgrade -y > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo "Package upgrade failed." | subStep
exit 1
fi
echo "Prepping with cmake for compiling." | step
rm -rf $fullPath/goBuild
/usr/bin/cmake -B$fullPath/goBuild -H$fullPath/goSrc -DUNICODE=0 -DCMAKE_BUILD_TYPE=Release -G "Unix Makefiles" > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo "Cmake failed. Trying with ansi instead of unicode." | subStep
rm -rf $fullPath/goBuild
/usr/bin/cmake -B$fullPath/goBuild -H$fullPath/goSrc -DUNICODE=1 -DCMAKE_BUILD_TYPE=Release -G "Unix Makefiles" > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo "Cmake prep failed. GrandOrgue could not be installed." | subStep
exit 1;
fi
fi
echo "Prep for compile with cmake has been completed." | subStep
echo ; echo ; echo ;
echo "Warning: compiling could take several hours. Would you like to continue? [y/n]";
read option
if [ ! $option=="y" ] && [ ! $option=="Y" ]; then
echo "Not continuing with compile.";
echo "Feel free to run this script when you are ready.";
echo ;
echo "By the way, should you choose to run at a future "
echo " date, it will run much faster on this computer, ";
echo " as much of the initial work is complete.";
echo ;
echo "Exiting script.";
exit 1;
fi
echo "Compilation can take several hours on the low power of a Raspberry Pi.";
echo "Would you like to see the logs of the compilation process ";
echo " so that progress can be seen?"
echo ;
echo "If you select no, the screen will remain static for the ";
echo " entire compilation process. ";
echo "If you select yes, a percentage counter will be incremented on screen.";
echo ;
echo "Select [Y/N]: ";
read optionOut;
if [ "$optionOut" != "y" ] && [ "$optionOut" != "Y" ]; then
echo "You have selected not to show output.";
echo "Please keep this terminal open to continue compilation.";
echo ;
/usr/bin/make -C $fullPath/goBuild > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo "There was an error in compiling." | subStep
exit 1;
fi
else
echo "Showing output.";
echo "Please keep this terminal open to continue compilation.";
echo ;
/usr/bin/make -C $fullPath/goBuild
if [ $? -ne 0 ]; then
echo "There was an error in compiling." | subStep
exit 1;
fi
fi
echo "Installing.";
echo ;
/usr/bin/make install -C $fullPath/goBuild
if [ $? -ne 0 ]; then
echo "There was an error installing." | subStep
exit 1;
fi
echo ; echo ;
echo ####################;
echo ####################;
echo ;
echo "Compiling and installation complete." | step
echo "Start GrandOrgue by finding the executable here:";
echo "/usr/local/bin/GrandOrgue";
echo ;