install-generator.sh
16.4 KB
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
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
#!/bin/bash
#
# Copyright (C) 2008-2014 National Institute For Space Research (INPE) - Brazil.
#
# This file is part of the TerraLib - a Framework for building GIS enabled applications.
#
# TerraLib is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License,
# or (at your option) any later version.
#
# TerraLib is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with TerraLib. See COPYING. If not, write to
# TerraLib Team at <terralib-team@terralib.org>.
#
# Description: TerraLib installation package scripts generator for Linux environment.
#
# Before start, please read the "PACKAGE-INSTRUCTIONS".
#
# Defining default value to UBUNTU_VERSION if no set
if [ -z "$UBUNTU_VERSION" ]; then
UBUNTU_VERSION=`lsb_release -rs`
fi
# Defining default value to OUTPUT_PATH if no set
if [ -z "$OUTPUT_PATH" ]; then
OUTPUT_PATH=`pwd`/../../../3rdparty
fi
# Defining default value to PACKAGES_DIR if no set
if [ -z "$PACKAGES_DIR" ]; then
PACKAGES_DIR="packages"
fi
# Defining default value to BOOST_VERSION if no set
if [ -z "$BOOST_VERSION" ]; then
BOOST_VERSION=1.65.0
fi
# Defining default value to GDAL_VERSION if no set
if [ -z "$GDAL_VERSION" ]; then
GDAL_VERSION=2.1.3
fi
# Defining default value to QTPB_VERSION if no set
if [ -z "$QTPB_VERSION" ]; then
QTPB_VERSION=2.6.1
fi
# Defining default value to QWT_VERSION if no set
if [ -z "$QWT_VERSION" ]; then
QWT_VERSION=6.1.2
fi
# Defining default value to WTSS_VERSION if no set
if [ -z "$WTSS_VERSION" ]; then
WTSS_VERSION=0.4.0
fi
# Defining default value to LAYOUT_VERSION if no set
if [ -z "$LAYOUT_VERSION" ]; then
LAYOUT_VERSION=1.2.0
fi
# Defining default value to QSCI_VERSION if no set
if [ -z "$QSCI_VERSION" ]; then
QSCI_VERSION=2.10.0
fi
# Defining default value to QTLUA_VERSION if no set
if [ -z "$QTLUA_VERSION" ]; then
QTLUA_VERSION=2.10.0
fi
cat > ${OUTPUT_PATH}/install.sh <<EOF
#!/bin/bash
#
# Copyright (C) 2008 National Institute For Space Research (INPE) - Brazil.
#
# This file is part of the TerraLib - a Framework for building GIS enabled applications.
#
# TerraLib is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License,
# or (at your option) any later version.
#
# TerraLib is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with TerraLib. See COPYING. If not, write to
# TerraLib Team at <terralib-team@terralib.org>.
#
#
# Description: Performs TerraLib installation on Linux Ubuntu.
# Author: TerraLib Team <terralib-team@terralib.org>
#
# Example:
# $ ./install.sh
#
echo "*********************************************"
echo "* TerraLib Installer for Linux Ubuntu ${UBUNTU_VERSION} *"
echo "*********************************************"
echo ""
sleep 1s
#
# Valid parameter val or abort script
#
function valid_operation()
{
if [ \$1 -ne 0 ]; then
echo ""
echo \$2
echo ""
exit \$1
fi
}
#
# Update Ubuntu install list
#
sudo apt-get update
valid_operation \$? "Error: could not update apt-get database list"
#
# Go to packages dir
#
cd ${PACKAGES_DIR}
#
# Boost version ${BOOST_VERSION}
#
sudo dpkg -i terralib-boost_${BOOST_VERSION}_amd64.deb > /dev/null
boost_test=\```dpkg -s terralib-boost | grep Status\```
if [ "\$boost_test" != "Status: install ok installed" ]; then
sudo apt-get install -y -f
sudo dpkg -i terralib-boost_${BOOST_VERSION}_amd64.deb
valid_operation \$? "Error: could not install boost! Please, install readline: sudo dpkg -i terralib-boost_${BOOST_VERSION}_amd64.deb"
echo "boost installed!"
else
echo "boost installed!"
fi
#
# GDAL/OGR version ${GDAL_VERSION}
#
sudo dpkg -i terralib-gdal_${GDAL_VERSION}_amd64.deb > /dev/null
gdal_test=\```dpkg -s terralib-gdal | grep Status\```
if [ "\$gdal_test" != "Status: install ok installed" ]; then
sudo apt-get install -y -f
sudo dpkg -i terralib-gdal_${GDAL_VERSION}_amd64.deb
valid_operation \$? "Error: could not install gdal! Please, install readline: sudo dpkg -i terralib-gdal_${GDAL_VERSION}_amd64.deb"
echo "gdal installed!"
else
echo "gdal installed!"
fi
#
# Qt Property Browser version ${QTPB_VERSION}
#
sudo dpkg -i terralib-qtpb_${QTPB_VERSION}_amd64.deb > /dev/null
qtpb_test=\```dpkg -s terralib-qtpb | grep Status\```
if [ "\$qtpb_test" != "Status: install ok installed" ]; then
sudo apt-get install -y -f
sudo dpkg -i terralib-qtpb_${QTPB_VERSION}_amd64.deb
valid_operation \$? "Error: could not install qtpropertybrowser! Please, install readline: sudo dpkg -i terralib-qtpb_${QTPB_VERSION}_amd64.deb"
echo "qtpropertybrowser installed!"
else
echo "qtpropertybrowser installed!"
fi
#
# Qwt version ${QWT_VERSION}
#
sudo dpkg -i terralib-qwt_${QWT_VERSION}_amd64.deb > /dev/null
qwt_test=\```dpkg -s terralib-qwt| grep Status\```
if [ "\$qwt_test" != "Status: install ok installed" ]; then
sudo apt-get install -y -f
sudo dpkg -i terralib-qwt_${QWT_VERSION}_amd64.deb
valid_operation \$? "Error: could not install qwt! Please, install readline: sudo dpkg -i terralib-qwt_${QWT_VERSION}_amd64.deb"
echo "qwt installed!"
else
echo "qwt installed!"
fi
#
# Wtss Cxx version ${WTSS_VERSION}
#
sudo dpkg -i terralib-wtss-cxx_${WTSS_VERSION}_amd64.deb > /dev/null
wtss_test=\```dpkg -s terralib-wtss-cxx| grep Status\```
if [ "\$wtss_test" != "Status: install ok installed" ]; then
sudo apt-get install -y -f
sudo dpkg -i terralib-wtss-cxx_${WTSS_VERSION}_amd64.deb
valid_operation \$? "Error: could not install wtss-cxx! Please, install readline: sudo dpkg -i terralib-wtss-cxx_${WTSS_VERSION}_amd64.deb"
echo "wtss-cxx installed!"
else
echo "wtss-cxx installed!"
fi
#
# Qscintilla version ${QSCI_VERSION}
#
if [ -f "terralib-qscintilla_${QSCI_VERSION}_amd64.deb" ]; then
sudo dpkg -i terralib-qscintilla_${QSCI_VERSION}_amd64.deb > /dev/null
terralib_qsci_test=\```dpkg -s terralib-qscintilla | grep Status\```
if [ "\$terralib_qsci_test" != "Status: install ok installed" ]; then
sudo apt-get install -y -f
sudo dpkg -i terralib-qscintilla_${QSCI_VERSION}_amd64.deb
valid_operation \$? "Error: could not install qscintilla! Please, install readline: sudo dpkg -i terralib-qscintilla_${QSCI_VERSION}_amd64.deb"
echo "qscintilla installed!"
else
echo "qscintilla installed!"
fi
fi
#
# QtLua version ${QTLUA_VERSION}
#
if [ -f "terralib-qtlua_${QTLUA_VERSION}_amd64.deb" ]; then
sudo dpkg -i terralib-qtlua_${QTLUA_VERSION}_amd64.deb > /dev/null
terralib_qtlua_test=\```dpkg -s terralib-qtlua | grep Status\```
if [ "\$terralib_qtlua_test" != "Status: install ok installed" ]; then
sudo apt-get install -y -f
sudo dpkg -i terralib-qtlua_${QTLUA_VERSION}_amd64.deb
valid_operation \$? "Error: could not install qtlua! Please, install readline: sudo dpkg -i terralib-qtlua_${QTLUA_VERSION}_amd64.deb"
echo "qtlua installed!"
else
echo "qtlua installed!"
fi
fi
#
# TerraLib version ${TE_VERSION}
#
sudo dpkg -i terralib-${TE_VERSION}.deb > /dev/null
terralib_test=\```dpkg -s terralib-${TE_VERSION} | grep Status\```
if [ "\$terralib_test" != "Status: install ok installed" ]; then
sudo apt-get install -y -f
sudo dpkg -i terralib-${TE_VERSION}.deb
valid_operation \$? "Error: could not install terralib! Please, install readline: sudo dpkg -i terralib-${TE_VERSION}.deb"
echo "terralib installed!"
else
echo "terralib installed!"
fi
#
# TerraLib Layout version ${LAYOUT_VERSION}
#
if [ -f "terralib-layout_${LAYOUT_VERSION}_amd64.deb" ]; then
sudo dpkg -i terralib-layout_${LAYOUT_VERSION}_amd64.deb > /dev/null
terralib_layout_test=\```dpkg -s terralib-layout | grep Status\```
if [ "\$terralib_layout_test" != "Status: install ok installed" ]; then
sudo apt-get install -y -f
sudo dpkg -i terralib-layout_${LAYOUT_VERSION}_amd64.deb
valid_operation \$? "Error: could not install terralib layout! Please, install readline: sudo dpkg -i terralib-layout_${LAYOUT_VERSION}_amd64.deb"
echo "terralib layout installed!"
else
echo "terralib layout installed!"
fi
fi
echo ""
echo "**************************"
echo "* Finished Successfully! *"
echo "**************************"
echo ""
EOF
if [ -f ${OUTPUT_PATH}/install.sh ]; then
echo "Install file created!"
else
echo "Error: cannot create install file!"
exit 0
fi
cat > ${OUTPUT_PATH}/uninstall.sh <<EOF
#!/bin/bash
#
# Copyright (C) 2008 National Institute For Space Research (INPE) - Brazil.
#
# This file is part of the TerraLib - a Framework for building GIS enabled applications.
#
# TerraLib is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License,
# or (at your option) any later version.
#
# TerraLib is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with TerraLib. See COPYING. If not, write to
# TerraLib Team at <terralib-team@terralib.org>.
#
#
# Description: Performs TerraLib uninstallation on Linux Ubuntu.
# Author: TerraLib Team <terralib-team@terralib.org>
#
# Example:
# $ ./uninstall.sh
#
echo "***********************************************"
echo "* TerraLib Uninstaller for Linux Ubuntu ${UBUNTU_VERSION} *"
echo "***********************************************"
echo ""
sleep 1s
#
# Valid parameter val or abort script
#
function valid_operation()
{
if [ \$1 -ne 0 ]; then
echo ""
echo \$2
echo ""
exit \$1
fi
}
#
# Uninstall dpkg debian packages
#
#
# TerraLib Layout version ${LAYOUT_VERSION}
#
terralib_layout_test=\```dpkg -s terralib-layout | grep Status\```
if [ "\$terralib_layout_test" == "Status: install ok installed" ]; then
sudo dpkg -r terralib-layout
valid_operation \$? "Error: could not uninstall terralib layout!"
echo "terralib layout uninstalled!"
else
echo "terralib layout already uninstalled!"
fi
#
# TerraLib version ${TE_VERSION}
#
terralib_test=\```dpkg -s terralib-${TE_VERSION} | grep Status\```
if [ "\$terralib_test" == "Status: install ok installed" ]; then
sudo dpkg -r terralib-${TE_VERSION}
valid_operation \$? "Error: could not uninstall terralib!"
echo "terralib uninstalled!"
else
echo "terralib already uninstalled!"
fi
#
# Boost version ${BOOST_VERSION}
#
boost_test=\```dpkg -s terralib-boost | grep Status\```
if [ "\$boost_test" == "Status: install ok installed" ]; then
sudo dpkg -r terralib-boost
valid_operation \$? "Error: could not uninstall boost!"
echo "boost uninstalled!"
else
echo "boost already uninstalled!"
fi
#
# GDAL/OGR version ${GDAL_VERSION}
#
gdal_test=\```dpkg -s terralib-gdal | grep Status\```
if [ "\$gdal_test" == "Status: install ok installed" ]; then
sudo dpkg -r terralib-gdal
valid_operation \$? "Error: could not uninstall gdal!"
echo "gdal uninstalled!"
else
echo "gdal already uninstalled!"
fi
#
# Qt Property Browser version ${QTPB_VERSION}
#
qtpb_test=\```dpkg -s terralib-qtpb | grep Status\```
if [ "\$qtpb_test" == "Status: install ok installed" ]; then
sudo dpkg -r terralib-qtpb
valid_operation \$? "Error: could not uninstall qtpropertybrowser!"
echo "qtpropertybrowser uninstalled!"
else
echo "qtpropertybrowser already uninstalled!"
fi
#
# Qwt version ${QWT_VERSION}
#
qwt_test=\```dpkg -s terralib-qwt| grep Status\```
if [ "\$qwt_test" == "Status: install ok installed" ]; then
sudo dpkg -r terralib-qwt
valid_operation \$? "Error: could not uninstall qwt!"
echo "qwt uninstalled!"
else
echo "qwt already uninstalled!"
fi
#
# Wtss Cxx version ${WTSS_VERSION}
#
wtss_test=\```dpkg -s terralib-wtss-cxx| grep Status\```
if [ "\$wtss_test" == "Status: install ok installed" ]; then
sudo dpkg -r terralib-wtss-cxx
valid_operation \$? "Error: could not uninstall wtss-cxx!"
echo "wtss-cxx uninstalled!"
else
echo "wtss-cxx already uninstalled!"
fi
#
# Qscintilla version ${QSCI_VERSION}
#
terralib_qsci_test=\```dpkg -s terralib-qscintilla | grep Status\```
if [ "\$terralib_qsci_test" == "Status: install ok installed" ]; then
sudo dpkg -r terralib-qscintilla
valid_operation \$? "Error: could not uninstall terralib qscintilla!"
echo "terralib qscintilla uninstalled!"
else
echo "terralib qscintilla already uninstalled!"
fi
#
# QtLua version ${QTLUA_VERSION}
#
terralib_qtlua_test=\```dpkg -s terralib-qtlua | grep Status\```
if [ "\$terralib_qtlua_test" == "Status: install ok installed" ]; then
sudo dpkg -r terralib-qtlua
valid_operation \$? "Error: could not uninstall terralib qtlua!"
echo "terralib qtlua uninstalled!"
else
echo "terralib qtlua already uninstalled!"
fi
#
# Automatically removes unused libraries
#
sudo apt-get autoremove -y
#
# Remove TerraLib files
#
sudo rm -rf \$HOME/.config/INPE/TerraView-${TE_VERSION}.ini \$HOME/.local/share/INPE/TerraView-${TE_VERSION}
echo ""
echo "**************************"
echo "* Finished Successfully! *"
echo "**************************"
echo ""
EOF
if [ -f ${OUTPUT_PATH}/uninstall.sh ]; then
echo "Uninstall file created!"
else
echo "Error: cannot create uninstall file!"
exit 0
fi
cat > ${OUTPUT_PATH}/README <<EOF
============================================
= About TerraLib package for Ubuntu ${UBUNTU_VERSION}: =
============================================
This package contains the TerraLib library ${TE_VERSION} with the
TerraView application.
Third-party library packages installed together:
* Boost (${BOOST_VERSION})
* Gdal (${GDAL_VERSION})
* Qwt (${QWT_VERSION})
* Qt Property Browser (${QTPB_VERSION})
* Wtss-Cxx (${WTSS_VERSION})
* Qscintilla (${QSCI_VERSION})
* QtLua (${QTLUA_VERSION})
* TerraLib Layout (${LAYOUT_VERSION})
For more information about other used third-party libraries, please visit our
wiki to check: http://www.dpi.inpe.br/terralib5.
==============================
= Installation instructions: =
==============================
---------------------------
- Automatic Installation: -
---------------------------
To install the package simply unpack the file corresponding to the version of
your system, example:
$ tar -vzxf terralib-<version>-ubuntu-<version>.tar.gz
After unpacking execute the "install.sh" script:
$ ./install.sh
If necessary you can uninstall the packages and dependencies, simply executing
the "uninstall.sh" script:
$ ./uninstall.sh
------------------------
- Manual Installation: -
------------------------
The packages can be installed manually through the "Ubuntu Software Center" in
the following order:
* terralib-boost
* terralib-gdal
* terralib-qtpb
* terralib-qwt
* terralib-wtss-cxx
* terralib-qscintilla
* terralib-qtlua
* terralib-${TE_VERSION}
* terralib-layout
Note: Check before installing if your machine has all the necessary
dependencies, in the absence of any dependency the "Ubuntu Software
Center" will prevent the installation of the package.
The packages can also be installed through the terminal
(following the same order described above), example:
$ sudo dpkg -i <package_file>
If some errors are displayed when installing, indicating the lack of any
library used by the package, run the following command and try to perform the
installation again:
$ sudo apt-get install -y -f
$ sudo dpkg -i <package_file>
-------------------------
- Frequently Questions: -
-------------------------
* Uninstalling the TerraLib package:
The TerraLib package can only be uninstalled if the dependents are uninstalled
before (this is a system-preventive measure to avoid uninstalling a package
that may interfere the functioning of their dependents).
EOF
if [ -f ${OUTPUT_PATH}/README ]; then
echo "README file created!"
else
echo "Error: cannot create README file!"
exit 0
fi
# Setting execution permission to file:
chmod +x ${OUTPUT_PATH}/install.sh ${OUTPUT_PATH}/uninstall.sh