-
Notifications
You must be signed in to change notification settings - Fork 64
/
ctools-installer.sh
924 lines (789 loc) · 26.5 KB
/
ctools-installer.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
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
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
#!/bin/bash
INSTALLER=`basename "$0"`
VER='1.48'
echo
echo CTOOLS
echo
echo ctools-installer version $VER
echo
echo "Author: Pedro Alves (webdetails)"
echo Thanks to Analytical Labs for jenkins builds
echo Copyright Webdetails 2011-2013
echo
echo
echo Changelog:
echo
echo v1.48 - Saiku plugin 3.1.8, marketplace 5.2-SNAPSHOT, check broken download urls
echo v1.47 - Removed CDB installation
echo v1.46 - Added stable versions for Pentaho 5
echo v1.45 - Added Marketplace, CFR and Sparkl, currently on -b dev only
echo v1.44 - Added option -r to specify offline mode
echo v1.43 - Added option -c to specify ctools list to download - Thanks to Tom
echo v1.42 - Changed stable CGG download process
echo v1.41 - Changed dev CGG download process
echo v1.40 - Changed dev saiku download path
echo v1.39 - Changed saiku download path to 2.4
echo v1.38 - Added option -n for CBF integration
echo v1.37 - plugin-samples/cdv was not deleted. Fixed
echo v1.36 - CDV now installs samples too
echo v1.35 - Support for stable CDV, CDC and CDB installation
echo v1.34 - Support for CDV installation using -b dev switch
echo v1.33 - Added support for Saiku ad hoc stable \(release\) installations.
echo v1.32 - Added windows cr tolerance for this script\'s auto update
echo v1.31 - Support for CDB installation using -b dev switch
echo v1.30 - Support for CDC installation using -b dev switch
echo v1.29 - Changed saiku download path to 2.3
echo v1.28 - Support for CGG in 4.5, where webapp path is no longer required
echo v1.27 - Added support for CGG stable \( release \) installations.
echo v1.26 - -y flag now also works for ctools-installer update. ctools-installer update is now automated - Thanks to Mark Reid.
echo v1.25 - Removed overwrite, explicitly deleting marketplace definition
echo v1.24 - Added force overwrite to unzip to phase out overwrite confirmation
echo v1.23 - CDF trunk installation change due to js publish
echo v1.22 - Changed saiku download path to 2.2
echo v1.21 - Added support for CDE stable \(release\) installations.
echo v1.20 - CDF new samples location updated to stable installation.
echo v1.19 - Corrected installCDF and installCDE to remove samples dir before installing
echo v1.18 - CDA samples installation to plugin-samples also in stable mode.
echo v1.17 - Change to CDA and CDE samples installation. Now installs to folder plugin-samples instead of bi-developers \(for trunk snapshot only\).
echo v1.16 - Added support for CDC and Saiku-adhoc installation - for now only available in dev/trunk mode.
echo v1.15 - Change to CDF samples installation. Now installs to folder plugin-samples instead of bi-developers \(for trunk snapshot only\).
echo v1.14 - Added support for CDF stable \(release\) installations.
echo v1.13 - Fixed issue in CGG download
echo v1.12 - Fixed typo in -Y option
echo v1.11 - Added support for -y option \(assume yes\) - Thanks to Christian G. Warden
echo v1.10 - Added support for Saiku trunk snapshots installations.
echo v1.9 - Added support for CDA stable \(release\) installations.
echo v1.8 - Added CGG\; Script refactor
echo v1.7 - Changed url locations to new path of analytical labs
echo v1.6 - Changed saiku download path to 2.1
echo v1.5 - Changed default indicator values in prompts
echo v1.4 - Added Saiku for the list of installs
echo v1.3 - Added support for automatic updates
echo v1.2 - Silent mode for downloading
echo v1.1 - Minor bugfixes
echo v1.0 - First release
echo
echo
echo "Disclaimer: we can't be responsible for any damage done to your system, which hopefully will not happen"
echo Note: ctools-installer.sh will upgrade the plugins under system directory.
echo " Any changes you have made there (eg: cdf templates) will have to be backed up and manually copied after running the script"
echo " CGG will need to change the server WEB-INF/lib too. Backup your server"
echo
usage (){
echo
echo "Usage: ctools-installer.sh -s solutionPath [-w pentahoWebapPath] [-b branch]"
echo
echo "-s Solution path (eg: /biserver/pentaho-solutions)"
echo "-w Pentaho webapp server path (required for cgg on versions before 4.5. eg: /biserver-ce/tomcat/webapps/pentaho)"
echo "-b Branch from where to get ctools, stable for release, dev for trunk. Default is stable"
echo "-c Comma-separated list of CTools to install (Supported module-names: marketplace,cdf,cda,cde,cgg,cfr,sparkl,cdc,cdv,saiku,saikuadhoc)"
echo "-y Assume yes to all prompts"
echo "--no-update Skip update of the ctools-installer.sh"
echo "-n Add newline to end of prompts (for integration with CBF)"
echo "-r Directory for storing offline files"
echo "-h This help screen"
echo
exit 1
}
cleanup (){
rm -rf .tmp
}
# Parse options
[ $# -gt 1 ] || usage
SOLUTION_DIR='PATH' # Variable name
WEBAPP_PATH='PATH' # Show all matches (y/n)?
HAS_WEBAPP_PATH=0
BRANCH='stable'
ECHO_FLAG='-n'
MODULES=''
ASSUME_YES=false
NO_UPDATE=false
OFFLINE_REPOSITORY=''
BASERVER_VERSION=''
ORIGINAL_CMDS=$@
while [ $# -gt 0 ]
do
case "$1" in
--) shift; break;;
-s) SOLUTION_DIR="$2"; shift;;
-w) WEBAPP_PATH="$2"; shift;;
-b) BRANCH="$2"; shift;;
-c) MODULES="$2"; shift;;
-y) ASSUME_YES=true;;
--no-update) NO_UPDATE=true;;
-n) ECHO_FLAG='';;
-r) OFFLINE_REPOSITORY="$2"; shift;;
--) break;;
-*|-h) usage ;;
esac
shift
done
[ "$SOLUTION_DIR" = 'PATH' ] && usage
if [ "$WEBAPP_PATH" != 'PATH' ]
then
HAS_WEBAPP_PATH=1
fi
if [ $BRANCH != 'stable' ] && [ $BRANCH != 'dev' ]
then
echo ERROR: Branch must either be stable or dev
exit 1
fi
if [[ ! -d "$SOLUTION_DIR" ]]
then
echo ERROR: Supplied solution path is not a directory
exit 1
fi
if [[ ! -d "$SOLUTION_DIR/system" ]]
then
echo "ERROR: Supplied solution path doesn't look like a valid pentaho solutions directory. Missing system sub-directory."
exit 1
fi
if [[ $HAS_WEBAPP_PATH -eq 1 ]]
then
if [[ ! -d $WEBAPP_PATH/WEB-INF/lib ]]
then
echo "ERROR: Supplied webapp path doesn't look like a valid web application - missing WEB-INF/lib"
exit 1
fi
fi
if [[ -d "$SOLUTION_DIR/system/jackrabbit" ]]
then
BASERVER_VERSION='5x'
else
BASERVER_VERSION='4x'
fi
if [ "$OFFLINE_REPOSITORY" != "" ]
then
mkdir -p "$OFFLINE_REPOSITORY/$BASERVER_VERSION/$BRANCH"
if [ $? != 0 ]; then
echo "ERROR: Failed to create offline stage directory: $OFFLINE_REPOSITORY/$BASERVER_VERSION/$BRANCH"
exit 1
fi
fi
for reqcmd in zip unzip wget
do
if [[ -z "$(which $reqcmd)" ]]
then
echo "ERROR: Missing required '$reqcmd' command."
exit 1
fi
done
# enable extended regexp matching
shopt -s extglob
if [ $BRANCH = 'dev' ]
then
URL1=''
FILESUFIX='-TRUNK-SNAPSHOT'
else
URL1='-release'
FILESUFIX='-+([0-9.])' # +([0-9.]) is an extended regexp. meaning match
# at least one of these items: [0-9.]
fi
# Checking for a new version
rm -rf .tmp
mkdir -p .tmp/dist
wget --no-check-certificate 'https://raw.github.com/pmalves/ctools-installer/master/ctools-installer.sh' -P .tmp -o /dev/null
if ! diff --strip-trailing-cr $0 .tmp/ctools-installer.sh >/dev/null ; then
answer=n
if $ASSUME_YES ; then
answer=y
elif $NO_UPDATE ; then
answer=n
else
echo
echo $ECHO_FLAG "There a new ctools-installer version available. Do you want to upgrade? (y/N) "
read -e answer < /dev/tty
fi
case $answer in
[Yy]* ) cp .tmp/ctools-installer.sh $0; echo "Upgrade successful. Rerunning command '$0 $ORIGINAL_CMDS'"; /bin/bash $0 $ORIGINAL_CMDS; exit 0;;
esac
fi
# Define download functions
download_file () {
WGET_CTOOL="$1"
WGET_URL="$2"
WGET_FILE="$3"
WGET_TARGET_DIR="$4"
mkdir -p "$WGET_TARGET_DIR"
OFFLINE_FILE="$OFFLINE_REPOSITORY/$BASERVER_VERSION/$BRANCH/$WGET_CTOOL/$WGET_FILE"
if [ ! -z "$OFFLINE_REPOSITORY" -a -e "$OFFLINE_FILE" -a -s "$OFFLINE_FILE" ]; then
echo $ECHO_FLAG "Found $WGET_CTOOL in offline repository. "
cp "$OFFLINE_REPOSITORY/$BASERVER_VERSION/$BRANCH/$WGET_CTOOL/$WGET_FILE" "$WGET_TARGET_DIR"
else
echo $ECHO_FLAG "Downloading $WGET_CTOOL..."
wget -q --no-check-certificate "$WGET_URL" -O "$WGET_TARGET_DIR/$WGET_FILE"
if [ ! -s "$WGET_TARGET_DIR/$WGET_FILE" ]; then
rm "$WGET_TARGET_DIR/$WGET_FILE"
echo "Downloaded file $WGET_FILE is empty - it could be broken download url"
exit 1
fi
if [ ! -z "$OFFLINE_REPOSITORY" ]; then
echo $ECHO_FLAG " Storing $WGET_CTOOL in offline repository... "
mkdir -p "$OFFLINE_REPOSITORY/$BASERVER_VERSION/$BRANCH/$WGET_CTOOL" ;
cp "$WGET_TARGET_DIR/$WGET_FILE" "$OFFLINE_REPOSITORY/$BASERVER_VERSION/$BRANCH/$WGET_CTOOL/$WGET_FILE"
fi
fi
}
downloadMarketplace () {
# Marktetplace
if [[ "$BASERVER_VERSION" = "4x" ]]; then
URL='http://ci.pentaho.com/job/marketplace-4.8'$URL1'/lastSuccessfulBuild/artifact/dist/marketplace-plugin-TRUNK-SNAPSHOT.zip'
else
URL='http://ci.pentaho.com/view/-5.3/job/marketplace-5.3/lastSuccessfulBuild/artifact/dist/marketplace-5.2-SNAPSHOT.zip'
fi
download_file "Marketplace" "$URL" "plugin.zip" ".tmp/marketplace"
rm -f .tmp/dist/marketplace.xml
unzip -o .tmp/marketplace/plugin.zip -d .tmp > /dev/null
chmod -R u+rwx .tmp
echo "Done"
}
downloadCDF () {
# CDF
if [[ "$BASERVER_VERSION" = "4x" ]]; then
if [ $BRANCH = 'dev' ]
then
URL='http://ci.pentaho.com/job/pentaho-cdf-pentaho/lastSuccessfulBuild/artifact/cdf-pentaho/dist/*zip*/dist.zip'
else
URL='http://ctools.pentaho.com/files/cdf/15.10.26/4.x/dist.zip'
fi
else
if [ $BRANCH = 'dev' ]
then
URL='http://ci.pentaho.com/job/pentaho-cdf/lastSuccessfulBuild/artifact/cdf-pentaho5/dist/*zip*/dist.zip'
else
URL='http://ctools.pentaho.com/files/cdf/16.08.18/5.x/dist.zip'
fi
fi
download_file "CDF" "$URL" "dist.zip" ".tmp/cdf"
rm -f .tmp/dist/marketplace.xml
unzip -o .tmp/cdf/dist.zip -d .tmp > /dev/null
chmod -R u+rwx .tmp
echo "Done"
}
downloadCDA (){
# CDA
if [[ "$BASERVER_VERSION" = "4x" ]]; then
if [ $BRANCH = 'dev' ]
then
URL='http://ci.pentaho.com/job/pentaho-cda-pentaho/lastSuccessfulBuild/artifact/cda-pentaho/dist/*zip*/dist.zip'
else
URL='http://ctools.pentaho.com/files/cda/15.10.26/4.x/dist.zip'
fi
else
if [ $BRANCH = 'dev' ]
then
URL='http://ci.pentaho.com/job/pentaho-cda/lastSuccessfulBuild/artifact/cda-pentaho5/dist/*zip*/dist.zip'
else
URL='http://ctools.pentaho.com/files/cda/16.08.18/5.x/dist.zip'
fi
fi
download_file "CDA" "$URL" "dist.zip" ".tmp/cda"
rm -f .tmp/dist/marketplace.xml
unzip -o .tmp/cda/dist.zip -d .tmp > /dev/null
chmod -R u+rwx .tmp
echo "Done"
}
downloadCDE (){
# CDE
if [[ "$BASERVER_VERSION" = "4x" ]]; then
if [ $BRANCH = 'dev' ]
then
URL='http://ci.pentaho.com/job/pentaho-cde-pentaho/lastSuccessfulBuild/artifact/cde-pentaho/dist/*zip*/dist.zip'
else
URL='http://ctools.pentaho.com/files/cde/15.10.26/4.x/dist.zip'
fi
else
if [ $BRANCH = 'dev' ]
then
URL='http://ci.pentaho.com/job/pentaho-cde/lastSuccessfulBuild/artifact/cde-pentaho5/dist/*zip*/dist.zip'
else
URL='http://ctools.pentaho.com/files/cde/16.08.18/5.x/dist.zip'
fi
fi
download_file "CDE" "$URL" "dist.zip" ".tmp/cde"
rm -f .tmp/dist/marketplace.xml
unzip -o .tmp/cde/dist.zip -d .tmp > /dev/null
chmod -R u+rwx .tmp
echo "Done"
}
downloadCGG (){
# CGG
if [[ "$BASERVER_VERSION" = "4x" ]]; then
if [ $BRANCH = 'dev' ]
then
URL='http://ci.pentaho.com/job/pentaho-cgg-pentaho/lastSuccessfulBuild/artifact/cgg-pentaho/dist/*zip*/dist.zip'
else
URL='http://ctools.pentaho.com/files/cgg/15.10.26/4.x/dist.zip'
fi
else
if [ $BRANCH = 'dev' ]
then
URL='http://ci.pentaho.com/job/pentaho-cgg/lastSuccessfulBuild/artifact/cgg-pentaho5/dist/*zip*/dist.zip'
else
URL='http://ctools.pentaho.com/files/cgg/16.08.18/5.x/dist.zip'
fi
fi
download_file "CGG" "$URL" "dist.zip" ".tmp/cgg"
rm -f .tmp/dist/marketplace.xml
unzip -o .tmp/cgg/dist.zip -d .tmp > /dev/null
chmod -R u+rwx .tmp
echo "Done"
}
downloadCFR (){
# CFR
if [[ "$BASERVER_VERSION" = "4x" ]]; then
URL='http://ci.pentaho.com/job/pentaho-cfr-pentaho/lastSuccessfulBuild/artifact/cfr-pentaho/dist/*zip*/dist.zip'
else
URL='http://ci.pentaho.com/job/pentaho-cfr/lastSuccessfulBuild/artifact/cfr-pentaho5/dist/*zip*/dist.zip'
fi
download_file "CFR" "$URL" "dist.zip" ".tmp/cfr"
rm -f .tmp/dist/marketplace.xml
unzip -o .tmp/cfr/dist.zip -d .tmp > /dev/null
chmod -R u+rwx .tmp
echo "Done"
}
downloadSparkl (){
# Sparkl
if [[ "$BASERVER_VERSION" = "4x" ]]; then
URL='http://ci.pentaho.com/job/Sparkl-4.x/lastSuccessfulBuild/artifact/dist/*zip*/dist.zip'
else
URL='http://ci.pentaho.com/job/Sparkl/lastSuccessfulBuild/artifact/dist/*zip*/dist.zip'
fi
download_file "Sparkl" "$URL" "dist.zip" ".tmp/sparkl"
rm -f .tmp/dist/marketplace.xml
unzip -o .tmp/sparkl/dist.zip -d .tmp > /dev/null
chmod -R u+rwx .tmp
echo "Done"
}
downloadCDC (){
# CDC
if [[ "$BASERVER_VERSION" = "4x" ]]; then
if [ $BRANCH = 'dev' ]
then
URL='http://ci.pentaho.com/job/pentaho-cdc/lastSuccessfulBuild/artifact/cdc-pentaho/dist/*zip*/dist.zip'
else
URL='http://ctools.pentaho.com/files/cdc/15.10.26/4.x/dist.zip'
fi
else
if [ $BRANCH = 'dev' ]
then
URL='http://ci.pentaho.com/job/pentaho-cdc/lastSuccessfulBuild/artifact/cdc-pentaho5/dist/*zip*/dist.zip'
else
URL='http://ctools.pentaho.com/files/cdc/16.08.18/5.x/dist.zip'
fi
fi
download_file "CDC" "$URL" "dist.zip" ".tmp/cdc"
rm -f .tmp/dist/marketplace.xml
unzip -o .tmp/cdc/dist.zip -d .tmp > /dev/null
chmod -R u+rwx .tmp
echo "Done"
}
downloadCDV (){
# CDV
if [[ "$BASERVER_VERSION" = "4x" ]]; then
if [ $BRANCH = 'dev' ]
then
URL='http://ci.pentaho.com/job/pentaho-cdv-pentaho/lastSuccessfulBuild/artifact/cdv-pentaho/dist/*zip*/dist.zip'
else
URL='http://ctools.pentaho.com/files/cdv/15.10.26/4.x/dist.zip'
fi
else
if [ $BRANCH = 'dev' ]
then
URL='http://ci.pentaho.com/job/pentaho-cdv/lastSuccessfulBuild/artifact/cdv-pentaho5/dist/*zip*/dist.zip'
else
URL='http://ctools.pentaho.com/files/cdv/16.08.18/5.x/dist.zip'
fi
fi
download_file "CDV" "$URL" "dist.zip" ".tmp/cdv"
rm -f .tmp/dist/marketplace.xml
unzip -o .tmp/cdv/dist.zip -d .tmp > /dev/null
chmod -R u+rwx .tmp
echo "Done"
}
downloadSaiku (){
# SAIKU
if [[ "$BASERVER_VERSION" = "4x" ]]; then
if [ $BRANCH = 'dev' ]
then
URL='http://ci.analytical-labs.com/job/saiku-bi-platform-plugin/lastSuccessfulBuild/artifact/saiku-bi-platform-plugin/target/*zip*/target.zip'
download_file "SAIKU" "$URL" "target.zip" ".tmp/saiku"
rm -f .tmp/dist/marketplace.xml
unzip -o .tmp/saiku/target.zip -d .tmp > /dev/null
chmod -R u+rwx .tmp
mv .tmp/target/saiku-* .tmp
else
URL='http://meteorite.bi/downloads/saiku-plugin-2.5.zip'
download_file "SAIKU" "$URL" "saiku-plugin.zip" ".tmp"
fi
else
if [ $BRANCH = 'dev' ]
then
echo 'SAIKU [trunk] not available for download. downloading stable'
fi
URL='http://meteorite.bi/downloads/saiku-plugin-p5-3.1.8.zip'
download_file "SAIKU" "$URL" "saiku-plugin.zip" ".tmp"
fi
echo "Done"
}
downloadSaikuAdhoc (){
# SAIKU Adhoc
if [ $BRANCH = 'dev' ]
then
echo 'SAIKU ADHOC [trunk] not available for download. downloading stable'
URL='https://github.com/Mgiepz/saiku-reporting/raw/gh-pages/downloads/saiku-adhoc-plugin-1.0-GA.zip'
download_file "SAIKU_ADHOC" "$URL" "saiku-adhoc-plugin.zip" ".tmp"
else
URL='https://github.com/Mgiepz/saiku-reporting/raw/gh-pages/downloads/saiku-adhoc-plugin-1.0-GA.zip'
download_file "SAIKU_ADHOC" "$URL" "saiku-adhoc-plugin-1.0-GA.zip" ".tmp"
fi
echo "Done"
}
# Define install functions
installSamples() {
SAMPLES_LOCATION="$1"
SAMPLES_ZIP_FULLNAME="$2"
if [[ "$BASERVER_VERSION" = "4x" ]]; then
if [ ! -d "$SOLUTION_DIR/plugin-samples" ]
then
mkdir "$SOLUTION_DIR/plugin-samples"
fi
if [ ! -f "$SOLUTION_DIR/plugin-samples/index.xml" ]
then
echo '<index><visible>true</visible><name>Plugin Samples</name><description>Plugin Samples</description></index>' > "$SOLUTION_DIR/plugin-samples/index.xml"
fi
unzip -o -q "$SAMPLES_ZIP_FULLNAME" -d "$SOLUTION_DIR/$SAMPLES_LOCATION"
else
# Repackage samples with new Repository Path:
SAMPLES_ZIP_BASENAME=`basename "$SAMPLES_ZIP_FULLNAME"`
REBASE_TMP_DIR=`dirname $SAMPLES_ZIP_FULLNAME`"/zip_rebase"
rm -rf "$REBASE_TMP_DIR"
mkdir -p "$REBASE_TMP_DIR/public/$SAMPLES_LOCATION"
unzip -o -q "$SAMPLES_ZIP_FULLNAME" -d "$REBASE_TMP_DIR/public/$SAMPLES_LOCATION"
(cd "$REBASE_TMP_DIR" ; zip -qr "../${SAMPLES_ZIP_BASENAME}.rebased" * )
mv "${SAMPLES_ZIP_FULLNAME}.rebased" "$SOLUTION_DIR/system/default-content/$SAMPLES_ZIP_BASENAME"
rm -rf "$REBASE_TMP_DIR" "${SAMPLES_ZIP_FULLNAME}.rebased"
fi
}
installMarketplace (){
rm -rf $SOLUTION_DIR/system/marketplace
unzip -o .tmp/marketplace/plugin.zip -d "$SOLUTION_DIR/system/" > /dev/null
}
installCDF (){
rm -rf $SOLUTION_DIR/system/pentaho-cdf
# Removing samples dir. First two are deprecated
rm -rf $SOLUTION_DIR/bi-developers/cdf-samples
rm -rf $SOLUTION_DIR/plugin-samples/cdf-samples
rm -rf $SOLUTION_DIR/plugin-samples/pentaho-cdf
unzip -o .tmp/dist/pentaho-cdf$FILESUFIX.zip -d "$SOLUTION_DIR/system/" > /dev/null
installSamples plugin-samples .tmp/dist/pentaho-cdf-samples$FILESUFIX*zip
}
installCDE (){
rm -rf $SOLUTION_DIR/system/pentaho-cdf-dd
# Removing samples dir. First two are deprecated
rm -rf $SOLUTION_DIR/cde_sample
rm -rf $SOLUTION_DIR/plugin-samples/cde_sample
rm -rf $SOLUTION_DIR/plugin-samples/pentaho-cdf-dd
unzip -o .tmp/dist/pentaho-cdf-dd$FILESUFIX.zip -d "$SOLUTION_DIR/system/" > /dev/null
installSamples plugin-samples .tmp/dist/pentaho-cdf-dd-solution$FILESUFIX.zip
}
installCDA (){
rm -rf $SOLUTION_DIR/system/cda
# Removing samples dir. First is deprecated
rm -rf $SOLUTION_DIR/bi-developers/cda
rm -rf $SOLUTION_DIR/plugin-samples/cda
unzip -o .tmp/dist/cda$FILESUFIX.zip -d "$SOLUTION_DIR/system/" > /dev/null
installSamples plugin-samples .tmp/dist/cda-samples$FILESUFIX.zip
}
installCGG (){
rm -rf $SOLUTION_DIR/system/cgg
unzip -o .tmp/dist/cgg$FILESUFIX.zip -d "$SOLUTION_DIR/system/" > /dev/null
# Changes to the server; 1 - delete batik; 2 - copy new one plus xml and fop
if [[ $HAS_WEBAPP_PATH -eq 1 ]]
then
LIB_DIR=$WEBAPP_PATH/WEB-INF/lib
CGG_DIR=$SOLUTION_DIR/system/cgg/lib
rm -rf $LIB_DIR/batik-* $LIB_DIR/xml-apis* $LIB_DIR/xmlgraphics*
cp $CGG_DIR/batik-[^j]* $CGG_DIR/xml* $LIB_DIR
else
echo
echo ' [CGG] No webapp path provided, if you are using pentaho older than 4.5 cgg will not work properly)'
fi
}
installCFR (){
rm -rf $SOLUTION_DIR/system/cfr
if [[ "$BASERVER_VERSION" = "4x" ]]; then
unzip -o .tmp/dist/cfr-pentaho*$FILESUFIX.zip -d "$SOLUTION_DIR/system/" > /dev/null
else
unzip -o .tmp/dist/cfr-pentaho5$FILESUFIX.zip -d "$SOLUTION_DIR/system/" > /dev/null
fi
}
installSparkl (){
rm -rf $SOLUTION_DIR/system/sparkl
unzip -o .tmp/dist/sparkl$FILESUFIX.zip -d "$SOLUTION_DIR/system/" > /dev/null
}
installCDC (){
rm -rf $SOLUTION_DIR/system/cdc
if [[ "$BASERVER_VERSION" = "4x" ]]; then
unzip -o .tmp/dist/cdc-pentaho$FILESUFIX.zip -d "$SOLUTION_DIR/system/" > /dev/null
else
if [ $BRANCH = 'dev' ]
then
unzip -o .tmp/dist/cdc-pentaho5$FILESUFIX.zip -d "$SOLUTION_DIR/system/" > /dev/null
else
unzip -o .tmp/dist/cdc$FILESUFIX.zip -d "$SOLUTION_DIR/system/" > /dev/null
fi
fi
# Changes to the server;
# 1 - copy hazelcast to WEB-INF/lib
LIB_DIR=$WEBAPP_PATH/WEB-INF/lib
CDC_HAZELCAST_DIR=$SOLUTION_DIR/system/cdc/pentaho-lib
rm -rf $LIB_DIR/hazelcast-*.jar
rm -rf $LIB_DIR/cdc-hazelcast-*.jar
cp $CDC_HAZELCAST_DIR/*.jar $LIB_DIR
}
installCDV (){
rm -rf $SOLUTION_DIR/system/cdv
rm -rf $SOLUTION_DIR/plugin-samples/cdv
if [[ "$BASERVER_VERSION" = "4x" ]]; then
unzip -o .tmp/dist/cdv-pentaho$FILESUFIX.zip -d "$SOLUTION_DIR/system/" > /dev/null
else
unzip -o .tmp/dist/cdv$FILESUFIX.zip -d "$SOLUTION_DIR/system/" > /dev/null
fi
# installSamples plugin-samples .tmp/dist/cdv-samples$FILESUFIX*zip
}
installSaiku (){
rm -rf $SOLUTION_DIR/system/saiku
unzip -o .tmp/saiku-plugin*zip -d "$SOLUTION_DIR/system/" > /dev/null
LIB_DIR=$WEBAPP_PATH/WEB-INF/lib
SAIKU_DIR=$SOLUTION_DIR/system/saiku/lib
# http://stackoverflow.com/questions/18721314/cube-in-analysis-view-not-showing-in-saiku-analytics
# it still works for 5.3
mv -v $SAIKU_DIR/saiku-olap-util*.jar $LIB_DIR
rm -v $SAIKU_DIR/mondrian*.jar $SAIKU_DIR/olap4j*.jar $SAIKU_DIR/eigenbase*.jar
}
installSaikuAdhoc (){
rm -rf $SOLUTION_DIR/system/saiku-adhoc
unzip -o .tmp/saiku-adhoc-plugin*zip -d "$SOLUTION_DIR/system/" > /dev/null
}
# read options for stuff to download/install
INSTALL_MARKETPLACE=0
INSTALL_CDF=0
INSTALL_CDA=0
INSTALL_CDE=0
INSTALL_CGG=0
INSTALL_CFR=0
INSTALL_SPARKL=0
INSTALL_CDC=0
INSTALL_CDV=0
INSTALL_SAIKU=0
INSTALL_SAIKU_ADHOC=0
if [ "$BRANCH" = "dev" ]; then
if [ "$MODULES" != "" ] || $ASSUME_YES; then
INSTALL_MARKETPLACE=1
else
echo
echo $ECHO_FLAG "Install Marketplace? This will delete everything in $SOLUTION_DIR/system/marketplace. you sure? (y/N) "
read -e answer < /dev/tty
case $answer in
[Yy]* ) INSTALL_MARKETPLACE=1;;
* ) ;;
esac
fi
fi
if [ "$MODULES" != "" ] || $ASSUME_YES; then
INSTALL_CDF=1
else
echo
echo $ECHO_FLAG "Install CDF? This will delete everything in $SOLUTION_DIR/system/pentaho-cdf. you sure? (y/N) "
read -e answer < /dev/tty
case $answer in
[Yy]* ) INSTALL_CDF=1;;
* ) ;;
esac
fi
if [ "$MODULES" != "" ] || $ASSUME_YES; then
INSTALL_CDA=1
else
echo
echo $ECHO_FLAG "Install CDA? This will delete everything in $SOLUTION_DIR/system/cda. you sure? (y/N) "
read -e answer < /dev/tty
case $answer in
[Yy]* ) INSTALL_CDA=1;;
* ) ;;
esac
fi
if [ "$MODULES" != "" ] || $ASSUME_YES; then
INSTALL_CDE=1
else
echo
echo $ECHO_FLAG "Install CDE? This will delete everything in $SOLUTION_DIR/system/pentaho-cdf-dd. you sure? (y/N) "
read -e answer < /dev/tty
case $answer in
[Yy]* ) INSTALL_CDE=1;;
* ) ;;
esac
fi
if [ "$MODULES" != "" ] || $ASSUME_YES; then
INSTALL_CGG=1
else
echo
echo $ECHO_FLAG "Install CGG? This will delete everything in $SOLUTION_DIR/system/cgg. you sure? (y/N) "
read -e answer < /dev/tty
case $answer in
[Yy]* ) INSTALL_CGG=1;;
* ) ;;
esac
fi
if [ "$BRANCH" = "dev" ]; then
if [ "$MODULES" != "" ] || $ASSUME_YES; then
INSTALL_CFR=1
else
echo
echo $ECHO_FLAG "Install CFR? This will delete everything in $SOLUTION_DIR/system/cfr you sure? (y/N) "
read -e answer < /dev/tty
case $answer in
[Yy]* ) INSTALL_CFR=1;;
* ) ;;
esac
fi
fi
if [ "$BRANCH" = "dev" ]; then
if [ "$MODULES" != "" ] || $ASSUME_YES; then
INSTALL_Sparkl=1
else
echo
echo $ECHO_FLAG "Install Sparkl? This will delete everything in $SOLUTION_DIR/system/sparkl you sure? (y/N) "
read -e answer < /dev/tty
case $answer in
[Yy]* ) INSTALL_SPARKL=1;;
* ) ;;
esac
fi
fi
if [[ $HAS_WEBAPP_PATH -eq 1 ]]
then
if [ "$MODULES" != "" ] || $ASSUME_YES; then
INSTALL_CDC=1
else
echo
echo $ECHO_FLAG "Install CDC? This will delete everything in $SOLUTION_DIR/system/cdc. you sure? (y/N) "
read -e answer < /dev/tty
case $answer in
[Yy]* ) INSTALL_CDC=1;;
* ) ;;
esac
fi
else
echo
echo 'No webapp path provided, will not install CDC'
fi
if ([ $BRANCH = 'dev' ] && [ $BASERVER_VERSION = '5x' ] ) || [ $BASERVER_VERSION = '4x' ]; then
if [ "$MODULES" != "" ] || $ASSUME_YES; then
INSTALL_CDV=1
else
echo
echo $ECHO_FLAG "Install CDV? This will delete everything in $SOLUTION_DIR/system/cdv. you sure? (y/N) "
read -e answer < /dev/tty
case $answer in
[Yy]* ) INSTALL_CDV=1;;
* ) ;;
esac
fi
fi
if [ $BASERVER_VERSION = '5x' ]; then
if [ "$MODULES" != "" ] || $ASSUME_YES; then
INSTALL_SAIKU=1
else
echo
echo $ECHO_FLAG "Install Saiku? This will delete everything in $SOLUTION_DIR/system/saiku. you sure? (y/N) "
read -e answer < /dev/tty
case $answer in
[Yy]* ) INSTALL_SAIKU=1;;
* ) ;;
esac
fi
fi
if [ $BASERVER_VERSION = '5x' ] || [ "$MODULES" != "" ] || $ASSUME_YES; then
INSTALL_SAIKU_ADHOC=1
else
echo
echo $ECHO_FLAG "Install Saiku Adhoc? This will delete everything in $SOLUTION_DIR/system/saiku-adhoc. you sure? (y/N) "
read -e answer < /dev/tty
case $answer in
[Yy]* ) INSTALL_SAIKU_ADHOC=1;;
* ) ;;
esac
fi
nothingToDo (){
echo Nothing to do. Exiting
cleanup
exit 1
}
if [ "$MODULES" != "" ]; then
INSTALL_MARKETPLACE=0
INSTALL_CDF=0
INSTALL_CDA=0
INSTALL_CDE=0
INSTALL_CGG=0
INSTALL_CFR=0
INSTALL_SPARKL=0
INSTALL_CDC=0
INSTALL_CDV=0
INSTALL_SAIKU=0
INSTALL_SAIKU_ADHOC=0
MODULES_ARR=$(echo $MODULES | tr "," "\n")
for MODULE in $MODULES_ARR
do
case $MODULE in
marketplace) INSTALL_MARKETPLACE=1;;
cdf) INSTALL_CDF=1;;
cda) INSTALL_CDA=1;;
cde) INSTALL_CDE=1;;
cgg) INSTALL_CGG=1;;
cfr) INSTALL_CFR=1;;
sparkl) INSTALL_SPARKL=1;;
cdc) INSTALL_CDC=1;;
cdv) INSTALL_CDV=1;;
saiku) INSTALL_SAIKU=1;;
saikuadhoc) INSTALL_SAIKU_ADHOC=1;;
* ) ;;
esac
done
fi
[ $INSTALL_MARKETPLACE -ne 0 ] || [ $INSTALL_CDF -ne 0 ] || [ $INSTALL_CDE -ne 0 ] || [ $INSTALL_CDA -ne 0 ] || [ $INSTALL_CGG -ne 0 ] || [ $INSTALL_CFR -ne 0 ] || [ $INSTALL_SPARKL -ne 0 ] || [ $INSTALL_CDC -ne 0 ] || [ $INSTALL_CDV -ne 0 ] || [ $INSTALL_SAIKU -ne 0 ] || [ $INSTALL_SAIKU_ADHOC -ne 0 ] || nothingToDo
# downloading files
echo
echo Downloading files
echo
[ $INSTALL_MARKETPLACE -eq 0 ] || downloadMarketplace
[ $INSTALL_CDF -eq 0 ] || downloadCDF
[ $INSTALL_CDA -eq 0 ] || downloadCDA
[ $INSTALL_CDE -eq 0 ] || downloadCDE
[ $INSTALL_CGG -eq 0 ] || downloadCGG
[ $BRANCH != 'dev' ] || [ $INSTALL_CFR -eq 0 ] || downloadCFR
[ $INSTALL_SPARKL -eq 0 ] || downloadSparkl
[ $INSTALL_CDC -eq 0 ] || downloadCDC
([ $BRANCH != 'dev' ] && [ $BASERVER_VERSION = '5x' ] ) || [ $INSTALL_CDV -eq 0 ] || downloadCDV
[ $BASERVER_VERSION = '4x' ] || [ $INSTALL_SAIKU -eq 0 ] || downloadSaiku
[ $BASERVER_VERSION = '5x' ] || [ $INSTALL_SAIKU_ADHOC -eq 0 ] || downloadSaikuAdhoc
# installing files
echo
echo Installing files
echo
[ $INSTALL_MARKETPLACE -eq 0 ] || installMarketplace
[ $INSTALL_CDF -eq 0 ] || installCDF
[ $INSTALL_CDA -eq 0 ] || installCDA
[ $INSTALL_CDE -eq 0 ] || installCDE
[ $INSTALL_CGG -eq 0 ] || installCGG
[ $BRANCH != 'dev' ] || [ $INSTALL_CFR -eq 0 ] || installCFR
[ $INSTALL_SPARKL -eq 0 ] || installSparkl
[ $INSTALL_CDC -eq 0 ] || installCDC
([ $BRANCH != 'dev' ] && [ $BASERVER_VERSION = '5x' ] ) || [ $INSTALL_CDV -eq 0 ] || installCDV
[ $BASERVER_VERSION = '4x' ] || [ $INSTALL_SAIKU -eq 0 ] || installSaiku
[ $BASERVER_VERSION = '5x' ] || [ $INSTALL_SAIKU_ADHOC -eq 0 ] || installSaikuAdhoc
cleanup
echo
echo Done!
echo
exit 0