├── README.txt └── ctools-installer.sh /README.txt: -------------------------------------------------------------------------------- 1 | ctools-installer.sh is a shell script to install / update the different ctools into a pentaho installation 2 | 3 | Currently supports CDF, CDA and CDE and pentaho 3.6 to 3.10 (and newer, don't make me update this readme everytime ;) ) 4 | 5 | Requirements: Linux, macintosh or windows with cygwin, wget, unzip 6 | 7 | Usage: ctools-installer.sh -s solutionPath [-w pentahoWebapPath] [-b branch] [-y] 8 | 9 | Please backup your solution, we're not resposible by any harm this does to your server. 10 | 11 | 12 | 13 | Pedro Alves, webdetails, 2011 -------------------------------------------------------------------------------- /ctools-installer.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | INSTALLER=`basename "$0"` 4 | VER='1.48' 5 | 6 | echo 7 | echo CTOOLS 8 | echo 9 | echo ctools-installer version $VER 10 | echo 11 | echo "Author: Pedro Alves (webdetails)" 12 | echo Thanks to Analytical Labs for jenkins builds 13 | echo Copyright Webdetails 2011-2013 14 | echo 15 | echo 16 | echo Changelog: 17 | echo 18 | echo v1.48 - Saiku plugin 3.1.8, marketplace 5.2-SNAPSHOT, check broken download urls 19 | echo v1.47 - Removed CDB installation 20 | echo v1.46 - Added stable versions for Pentaho 5 21 | echo v1.45 - Added Marketplace, CFR and Sparkl, currently on -b dev only 22 | echo v1.44 - Added option -r to specify offline mode 23 | echo v1.43 - Added option -c to specify ctools list to download - Thanks to Tom 24 | echo v1.42 - Changed stable CGG download process 25 | echo v1.41 - Changed dev CGG download process 26 | echo v1.40 - Changed dev saiku download path 27 | echo v1.39 - Changed saiku download path to 2.4 28 | echo v1.38 - Added option -n for CBF integration 29 | echo v1.37 - plugin-samples/cdv was not deleted. Fixed 30 | echo v1.36 - CDV now installs samples too 31 | echo v1.35 - Support for stable CDV, CDC and CDB installation 32 | echo v1.34 - Support for CDV installation using -b dev switch 33 | echo v1.33 - Added support for Saiku ad hoc stable \(release\) installations. 34 | echo v1.32 - Added windows cr tolerance for this script\'s auto update 35 | echo v1.31 - Support for CDB installation using -b dev switch 36 | echo v1.30 - Support for CDC installation using -b dev switch 37 | echo v1.29 - Changed saiku download path to 2.3 38 | echo v1.28 - Support for CGG in 4.5, where webapp path is no longer required 39 | echo v1.27 - Added support for CGG stable \( release \) installations. 40 | echo v1.26 - -y flag now also works for ctools-installer update. ctools-installer update is now automated - Thanks to Mark Reid. 41 | echo v1.25 - Removed overwrite, explicitly deleting marketplace definition 42 | echo v1.24 - Added force overwrite to unzip to phase out overwrite confirmation 43 | echo v1.23 - CDF trunk installation change due to js publish 44 | echo v1.22 - Changed saiku download path to 2.2 45 | echo v1.21 - Added support for CDE stable \(release\) installations. 46 | echo v1.20 - CDF new samples location updated to stable installation. 47 | echo v1.19 - Corrected installCDF and installCDE to remove samples dir before installing 48 | echo v1.18 - CDA samples installation to plugin-samples also in stable mode. 49 | echo v1.17 - Change to CDA and CDE samples installation. Now installs to folder plugin-samples instead of bi-developers \(for trunk snapshot only\). 50 | echo v1.16 - Added support for CDC and Saiku-adhoc installation - for now only available in dev/trunk mode. 51 | echo v1.15 - Change to CDF samples installation. Now installs to folder plugin-samples instead of bi-developers \(for trunk snapshot only\). 52 | echo v1.14 - Added support for CDF stable \(release\) installations. 53 | echo v1.13 - Fixed issue in CGG download 54 | echo v1.12 - Fixed typo in -Y option 55 | echo v1.11 - Added support for -y option \(assume yes\) - Thanks to Christian G. Warden 56 | echo v1.10 - Added support for Saiku trunk snapshots installations. 57 | echo v1.9 - Added support for CDA stable \(release\) installations. 58 | echo v1.8 - Added CGG\; Script refactor 59 | echo v1.7 - Changed url locations to new path of analytical labs 60 | echo v1.6 - Changed saiku download path to 2.1 61 | echo v1.5 - Changed default indicator values in prompts 62 | echo v1.4 - Added Saiku for the list of installs 63 | echo v1.3 - Added support for automatic updates 64 | echo v1.2 - Silent mode for downloading 65 | echo v1.1 - Minor bugfixes 66 | echo v1.0 - First release 67 | echo 68 | echo 69 | echo "Disclaimer: we can't be responsible for any damage done to your system, which hopefully will not happen" 70 | echo Note: ctools-installer.sh will upgrade the plugins under system directory. 71 | echo " Any changes you have made there (eg: cdf templates) will have to be backed up and manually copied after running the script" 72 | echo " CGG will need to change the server WEB-INF/lib too. Backup your server" 73 | echo 74 | 75 | 76 | usage (){ 77 | 78 | echo 79 | echo "Usage: ctools-installer.sh -s solutionPath [-w pentahoWebapPath] [-b branch]" 80 | echo 81 | echo "-s Solution path (eg: /biserver/pentaho-solutions)" 82 | echo "-w Pentaho webapp server path (required for cgg on versions before 4.5. eg: /biserver-ce/tomcat/webapps/pentaho)" 83 | echo "-b Branch from where to get ctools, stable for release, dev for trunk. Default is stable" 84 | echo "-c Comma-separated list of CTools to install (Supported module-names: marketplace,cdf,cda,cde,cgg,cfr,sparkl,cdc,cdv,saiku,saikuadhoc)" 85 | echo "-y Assume yes to all prompts" 86 | echo "--no-update Skip update of the ctools-installer.sh" 87 | echo "-n Add newline to end of prompts (for integration with CBF)" 88 | echo "-r Directory for storing offline files" 89 | echo "-h This help screen" 90 | echo 91 | exit 1 92 | } 93 | 94 | cleanup (){ 95 | rm -rf .tmp 96 | } 97 | 98 | 99 | # Parse options 100 | 101 | [ $# -gt 1 ] || usage 102 | 103 | 104 | SOLUTION_DIR='PATH' # Variable name 105 | WEBAPP_PATH='PATH' # Show all matches (y/n)? 106 | HAS_WEBAPP_PATH=0 107 | BRANCH='stable' 108 | ECHO_FLAG='-n' 109 | MODULES='' 110 | ASSUME_YES=false 111 | NO_UPDATE=false 112 | OFFLINE_REPOSITORY='' 113 | BASERVER_VERSION='' 114 | 115 | ORIGINAL_CMDS=$@ 116 | 117 | while [ $# -gt 0 ] 118 | do 119 | case "$1" in 120 | --) shift; break;; 121 | -s) SOLUTION_DIR="$2"; shift;; 122 | -w) WEBAPP_PATH="$2"; shift;; 123 | -b) BRANCH="$2"; shift;; 124 | -c) MODULES="$2"; shift;; 125 | -y) ASSUME_YES=true;; 126 | --no-update) NO_UPDATE=true;; 127 | -n) ECHO_FLAG='';; 128 | -r) OFFLINE_REPOSITORY="$2"; shift;; 129 | --) break;; 130 | -*|-h) usage ;; 131 | esac 132 | shift 133 | done 134 | 135 | [ "$SOLUTION_DIR" = 'PATH' ] && usage 136 | 137 | if [ "$WEBAPP_PATH" != 'PATH' ] 138 | then 139 | HAS_WEBAPP_PATH=1 140 | fi 141 | 142 | 143 | if [ $BRANCH != 'stable' ] && [ $BRANCH != 'dev' ] 144 | then 145 | echo ERROR: Branch must either be stable or dev 146 | exit 1 147 | fi 148 | 149 | if [[ ! -d "$SOLUTION_DIR" ]] 150 | then 151 | echo ERROR: Supplied solution path is not a directory 152 | exit 1 153 | fi 154 | 155 | if [[ ! -d "$SOLUTION_DIR/system" ]] 156 | then 157 | echo "ERROR: Supplied solution path doesn't look like a valid pentaho solutions directory. Missing system sub-directory." 158 | exit 1 159 | fi 160 | 161 | if [[ $HAS_WEBAPP_PATH -eq 1 ]] 162 | then 163 | if [[ ! -d $WEBAPP_PATH/WEB-INF/lib ]] 164 | then 165 | 166 | echo "ERROR: Supplied webapp path doesn't look like a valid web application - missing WEB-INF/lib" 167 | exit 1 168 | fi 169 | 170 | fi 171 | 172 | if [[ -d "$SOLUTION_DIR/system/jackrabbit" ]] 173 | then 174 | BASERVER_VERSION='5x' 175 | else 176 | BASERVER_VERSION='4x' 177 | fi 178 | 179 | if [ "$OFFLINE_REPOSITORY" != "" ] 180 | then 181 | mkdir -p "$OFFLINE_REPOSITORY/$BASERVER_VERSION/$BRANCH" 182 | if [ $? != 0 ]; then 183 | echo "ERROR: Failed to create offline stage directory: $OFFLINE_REPOSITORY/$BASERVER_VERSION/$BRANCH" 184 | exit 1 185 | fi 186 | fi 187 | 188 | for reqcmd in zip unzip wget 189 | do 190 | if [[ -z "$(which $reqcmd)" ]] 191 | then 192 | echo "ERROR: Missing required '$reqcmd' command." 193 | exit 1 194 | fi 195 | done 196 | 197 | # enable extended regexp matching 198 | shopt -s extglob 199 | 200 | if [ $BRANCH = 'dev' ] 201 | then 202 | URL1='' 203 | FILESUFIX='-TRUNK-SNAPSHOT' 204 | else 205 | URL1='-release' 206 | FILESUFIX='-+([0-9.])' # +([0-9.]) is an extended regexp. meaning match 207 | # at least one of these items: [0-9.] 208 | fi 209 | 210 | 211 | # Checking for a new version 212 | rm -rf .tmp 213 | mkdir -p .tmp/dist 214 | 215 | wget --no-check-certificate 'https://raw.github.com/pmalves/ctools-installer/master/ctools-installer.sh' -P .tmp -o /dev/null 216 | 217 | if ! diff --strip-trailing-cr $0 .tmp/ctools-installer.sh >/dev/null ; then 218 | answer=n 219 | if $ASSUME_YES ; then 220 | answer=y 221 | elif $NO_UPDATE ; then 222 | answer=n 223 | else 224 | echo 225 | echo $ECHO_FLAG "There a new ctools-installer version available. Do you want to upgrade? (y/N) " 226 | read -e answer < /dev/tty 227 | fi 228 | 229 | case $answer in 230 | [Yy]* ) cp .tmp/ctools-installer.sh $0; echo "Upgrade successful. Rerunning command '$0 $ORIGINAL_CMDS'"; /bin/bash $0 $ORIGINAL_CMDS; exit 0;; 231 | esac 232 | 233 | fi 234 | 235 | # Define download functions 236 | 237 | download_file () { 238 | WGET_CTOOL="$1" 239 | WGET_URL="$2" 240 | WGET_FILE="$3" 241 | WGET_TARGET_DIR="$4" 242 | mkdir -p "$WGET_TARGET_DIR" 243 | OFFLINE_FILE="$OFFLINE_REPOSITORY/$BASERVER_VERSION/$BRANCH/$WGET_CTOOL/$WGET_FILE" 244 | if [ ! -z "$OFFLINE_REPOSITORY" -a -e "$OFFLINE_FILE" -a -s "$OFFLINE_FILE" ]; then 245 | echo $ECHO_FLAG "Found $WGET_CTOOL in offline repository. " 246 | cp "$OFFLINE_REPOSITORY/$BASERVER_VERSION/$BRANCH/$WGET_CTOOL/$WGET_FILE" "$WGET_TARGET_DIR" 247 | else 248 | echo $ECHO_FLAG "Downloading $WGET_CTOOL..." 249 | wget -q --no-check-certificate "$WGET_URL" -O "$WGET_TARGET_DIR/$WGET_FILE" 250 | if [ ! -s "$WGET_TARGET_DIR/$WGET_FILE" ]; then 251 | rm "$WGET_TARGET_DIR/$WGET_FILE" 252 | echo "Downloaded file $WGET_FILE is empty - it could be broken download url" 253 | exit 1 254 | fi 255 | if [ ! -z "$OFFLINE_REPOSITORY" ]; then 256 | echo $ECHO_FLAG " Storing $WGET_CTOOL in offline repository... " 257 | mkdir -p "$OFFLINE_REPOSITORY/$BASERVER_VERSION/$BRANCH/$WGET_CTOOL" ; 258 | cp "$WGET_TARGET_DIR/$WGET_FILE" "$OFFLINE_REPOSITORY/$BASERVER_VERSION/$BRANCH/$WGET_CTOOL/$WGET_FILE" 259 | fi 260 | fi 261 | } 262 | 263 | downloadMarketplace () { 264 | # Marktetplace 265 | if [[ "$BASERVER_VERSION" = "4x" ]]; then 266 | URL='http://ci.pentaho.com/job/marketplace-4.8'$URL1'/lastSuccessfulBuild/artifact/dist/marketplace-plugin-TRUNK-SNAPSHOT.zip' 267 | else 268 | URL='http://ci.pentaho.com/view/-5.3/job/marketplace-5.3/lastSuccessfulBuild/artifact/dist/marketplace-5.2-SNAPSHOT.zip' 269 | fi 270 | download_file "Marketplace" "$URL" "plugin.zip" ".tmp/marketplace" 271 | rm -f .tmp/dist/marketplace.xml 272 | unzip -o .tmp/marketplace/plugin.zip -d .tmp > /dev/null 273 | chmod -R u+rwx .tmp 274 | echo "Done" 275 | } 276 | 277 | downloadCDF () { 278 | # CDF 279 | if [[ "$BASERVER_VERSION" = "4x" ]]; then 280 | if [ $BRANCH = 'dev' ] 281 | then 282 | URL='http://ci.pentaho.com/job/pentaho-cdf-pentaho/lastSuccessfulBuild/artifact/cdf-pentaho/dist/*zip*/dist.zip' 283 | else 284 | URL='http://ctools.pentaho.com/files/cdf/15.10.26/4.x/dist.zip' 285 | fi 286 | else 287 | if [ $BRANCH = 'dev' ] 288 | then 289 | URL='http://ci.pentaho.com/job/pentaho-cdf/lastSuccessfulBuild/artifact/cdf-pentaho5/dist/*zip*/dist.zip' 290 | else 291 | URL='http://ctools.pentaho.com/files/cdf/16.08.18/5.x/dist.zip' 292 | fi 293 | fi 294 | download_file "CDF" "$URL" "dist.zip" ".tmp/cdf" 295 | rm -f .tmp/dist/marketplace.xml 296 | unzip -o .tmp/cdf/dist.zip -d .tmp > /dev/null 297 | chmod -R u+rwx .tmp 298 | echo "Done" 299 | } 300 | 301 | 302 | downloadCDA (){ 303 | # CDA 304 | if [[ "$BASERVER_VERSION" = "4x" ]]; then 305 | if [ $BRANCH = 'dev' ] 306 | then 307 | URL='http://ci.pentaho.com/job/pentaho-cda-pentaho/lastSuccessfulBuild/artifact/cda-pentaho/dist/*zip*/dist.zip' 308 | else 309 | URL='http://ctools.pentaho.com/files/cda/15.10.26/4.x/dist.zip' 310 | fi 311 | else 312 | if [ $BRANCH = 'dev' ] 313 | then 314 | URL='http://ci.pentaho.com/job/pentaho-cda/lastSuccessfulBuild/artifact/cda-pentaho5/dist/*zip*/dist.zip' 315 | else 316 | URL='http://ctools.pentaho.com/files/cda/16.08.18/5.x/dist.zip' 317 | fi 318 | 319 | fi 320 | download_file "CDA" "$URL" "dist.zip" ".tmp/cda" 321 | rm -f .tmp/dist/marketplace.xml 322 | unzip -o .tmp/cda/dist.zip -d .tmp > /dev/null 323 | chmod -R u+rwx .tmp 324 | echo "Done" 325 | } 326 | 327 | downloadCDE (){ 328 | # CDE 329 | if [[ "$BASERVER_VERSION" = "4x" ]]; then 330 | if [ $BRANCH = 'dev' ] 331 | then 332 | URL='http://ci.pentaho.com/job/pentaho-cde-pentaho/lastSuccessfulBuild/artifact/cde-pentaho/dist/*zip*/dist.zip' 333 | else 334 | URL='http://ctools.pentaho.com/files/cde/15.10.26/4.x/dist.zip' 335 | fi 336 | else 337 | if [ $BRANCH = 'dev' ] 338 | then 339 | URL='http://ci.pentaho.com/job/pentaho-cde/lastSuccessfulBuild/artifact/cde-pentaho5/dist/*zip*/dist.zip' 340 | else 341 | URL='http://ctools.pentaho.com/files/cde/16.08.18/5.x/dist.zip' 342 | fi 343 | fi 344 | download_file "CDE" "$URL" "dist.zip" ".tmp/cde" 345 | rm -f .tmp/dist/marketplace.xml 346 | unzip -o .tmp/cde/dist.zip -d .tmp > /dev/null 347 | chmod -R u+rwx .tmp 348 | echo "Done" 349 | } 350 | 351 | downloadCGG (){ 352 | # CGG 353 | if [[ "$BASERVER_VERSION" = "4x" ]]; then 354 | if [ $BRANCH = 'dev' ] 355 | then 356 | URL='http://ci.pentaho.com/job/pentaho-cgg-pentaho/lastSuccessfulBuild/artifact/cgg-pentaho/dist/*zip*/dist.zip' 357 | else 358 | URL='http://ctools.pentaho.com/files/cgg/15.10.26/4.x/dist.zip' 359 | fi 360 | else 361 | if [ $BRANCH = 'dev' ] 362 | then 363 | URL='http://ci.pentaho.com/job/pentaho-cgg/lastSuccessfulBuild/artifact/cgg-pentaho5/dist/*zip*/dist.zip' 364 | else 365 | URL='http://ctools.pentaho.com/files/cgg/16.08.18/5.x/dist.zip' 366 | fi 367 | fi 368 | download_file "CGG" "$URL" "dist.zip" ".tmp/cgg" 369 | rm -f .tmp/dist/marketplace.xml 370 | unzip -o .tmp/cgg/dist.zip -d .tmp > /dev/null 371 | chmod -R u+rwx .tmp 372 | echo "Done" 373 | } 374 | 375 | downloadCFR (){ 376 | # CFR 377 | if [[ "$BASERVER_VERSION" = "4x" ]]; then 378 | URL='http://ci.pentaho.com/job/pentaho-cfr-pentaho/lastSuccessfulBuild/artifact/cfr-pentaho/dist/*zip*/dist.zip' 379 | else 380 | URL='http://ci.pentaho.com/job/pentaho-cfr/lastSuccessfulBuild/artifact/cfr-pentaho5/dist/*zip*/dist.zip' 381 | fi 382 | download_file "CFR" "$URL" "dist.zip" ".tmp/cfr" 383 | rm -f .tmp/dist/marketplace.xml 384 | unzip -o .tmp/cfr/dist.zip -d .tmp > /dev/null 385 | chmod -R u+rwx .tmp 386 | echo "Done" 387 | } 388 | 389 | downloadSparkl (){ 390 | # Sparkl 391 | if [[ "$BASERVER_VERSION" = "4x" ]]; then 392 | URL='http://ci.pentaho.com/job/Sparkl-4.x/lastSuccessfulBuild/artifact/dist/*zip*/dist.zip' 393 | else 394 | URL='http://ci.pentaho.com/job/Sparkl/lastSuccessfulBuild/artifact/dist/*zip*/dist.zip' 395 | fi 396 | download_file "Sparkl" "$URL" "dist.zip" ".tmp/sparkl" 397 | rm -f .tmp/dist/marketplace.xml 398 | unzip -o .tmp/sparkl/dist.zip -d .tmp > /dev/null 399 | chmod -R u+rwx .tmp 400 | echo "Done" 401 | } 402 | 403 | downloadCDC (){ 404 | # CDC 405 | if [[ "$BASERVER_VERSION" = "4x" ]]; then 406 | if [ $BRANCH = 'dev' ] 407 | then 408 | URL='http://ci.pentaho.com/job/pentaho-cdc/lastSuccessfulBuild/artifact/cdc-pentaho/dist/*zip*/dist.zip' 409 | else 410 | URL='http://ctools.pentaho.com/files/cdc/15.10.26/4.x/dist.zip' 411 | fi 412 | else 413 | if [ $BRANCH = 'dev' ] 414 | then 415 | URL='http://ci.pentaho.com/job/pentaho-cdc/lastSuccessfulBuild/artifact/cdc-pentaho5/dist/*zip*/dist.zip' 416 | else 417 | URL='http://ctools.pentaho.com/files/cdc/16.08.18/5.x/dist.zip' 418 | fi 419 | fi 420 | 421 | download_file "CDC" "$URL" "dist.zip" ".tmp/cdc" 422 | rm -f .tmp/dist/marketplace.xml 423 | unzip -o .tmp/cdc/dist.zip -d .tmp > /dev/null 424 | chmod -R u+rwx .tmp 425 | echo "Done" 426 | } 427 | 428 | 429 | downloadCDV (){ 430 | # CDV 431 | if [[ "$BASERVER_VERSION" = "4x" ]]; then 432 | if [ $BRANCH = 'dev' ] 433 | then 434 | URL='http://ci.pentaho.com/job/pentaho-cdv-pentaho/lastSuccessfulBuild/artifact/cdv-pentaho/dist/*zip*/dist.zip' 435 | else 436 | URL='http://ctools.pentaho.com/files/cdv/15.10.26/4.x/dist.zip' 437 | fi 438 | else 439 | if [ $BRANCH = 'dev' ] 440 | then 441 | URL='http://ci.pentaho.com/job/pentaho-cdv/lastSuccessfulBuild/artifact/cdv-pentaho5/dist/*zip*/dist.zip' 442 | else 443 | URL='http://ctools.pentaho.com/files/cdv/16.08.18/5.x/dist.zip' 444 | fi 445 | fi 446 | download_file "CDV" "$URL" "dist.zip" ".tmp/cdv" 447 | rm -f .tmp/dist/marketplace.xml 448 | unzip -o .tmp/cdv/dist.zip -d .tmp > /dev/null 449 | chmod -R u+rwx .tmp 450 | echo "Done" 451 | } 452 | 453 | downloadSaiku (){ 454 | # SAIKU 455 | if [[ "$BASERVER_VERSION" = "4x" ]]; then 456 | if [ $BRANCH = 'dev' ] 457 | then 458 | URL='http://ci.analytical-labs.com/job/saiku-bi-platform-plugin/lastSuccessfulBuild/artifact/saiku-bi-platform-plugin/target/*zip*/target.zip' 459 | download_file "SAIKU" "$URL" "target.zip" ".tmp/saiku" 460 | rm -f .tmp/dist/marketplace.xml 461 | unzip -o .tmp/saiku/target.zip -d .tmp > /dev/null 462 | chmod -R u+rwx .tmp 463 | mv .tmp/target/saiku-* .tmp 464 | else 465 | URL='http://meteorite.bi/downloads/saiku-plugin-2.5.zip' 466 | download_file "SAIKU" "$URL" "saiku-plugin.zip" ".tmp" 467 | fi 468 | else 469 | if [ $BRANCH = 'dev' ] 470 | then 471 | echo 'SAIKU [trunk] not available for download. downloading stable' 472 | fi 473 | URL='http://meteorite.bi/downloads/saiku-plugin-p5-3.1.8.zip' 474 | download_file "SAIKU" "$URL" "saiku-plugin.zip" ".tmp" 475 | fi 476 | echo "Done" 477 | } 478 | 479 | 480 | downloadSaikuAdhoc (){ 481 | # SAIKU Adhoc 482 | if [ $BRANCH = 'dev' ] 483 | then 484 | echo 'SAIKU ADHOC [trunk] not available for download. downloading stable' 485 | URL='https://github.com/Mgiepz/saiku-reporting/raw/gh-pages/downloads/saiku-adhoc-plugin-1.0-GA.zip' 486 | download_file "SAIKU_ADHOC" "$URL" "saiku-adhoc-plugin.zip" ".tmp" 487 | else 488 | URL='https://github.com/Mgiepz/saiku-reporting/raw/gh-pages/downloads/saiku-adhoc-plugin-1.0-GA.zip' 489 | download_file "SAIKU_ADHOC" "$URL" "saiku-adhoc-plugin-1.0-GA.zip" ".tmp" 490 | fi 491 | echo "Done" 492 | } 493 | 494 | 495 | # Define install functions 496 | 497 | installSamples() { 498 | SAMPLES_LOCATION="$1" 499 | SAMPLES_ZIP_FULLNAME="$2" 500 | if [[ "$BASERVER_VERSION" = "4x" ]]; then 501 | if [ ! -d "$SOLUTION_DIR/plugin-samples" ] 502 | then 503 | mkdir "$SOLUTION_DIR/plugin-samples" 504 | fi 505 | if [ ! -f "$SOLUTION_DIR/plugin-samples/index.xml" ] 506 | then 507 | echo 'truePlugin SamplesPlugin Samples' > "$SOLUTION_DIR/plugin-samples/index.xml" 508 | fi 509 | unzip -o -q "$SAMPLES_ZIP_FULLNAME" -d "$SOLUTION_DIR/$SAMPLES_LOCATION" 510 | else 511 | # Repackage samples with new Repository Path: 512 | SAMPLES_ZIP_BASENAME=`basename "$SAMPLES_ZIP_FULLNAME"` 513 | REBASE_TMP_DIR=`dirname $SAMPLES_ZIP_FULLNAME`"/zip_rebase" 514 | rm -rf "$REBASE_TMP_DIR" 515 | mkdir -p "$REBASE_TMP_DIR/public/$SAMPLES_LOCATION" 516 | unzip -o -q "$SAMPLES_ZIP_FULLNAME" -d "$REBASE_TMP_DIR/public/$SAMPLES_LOCATION" 517 | (cd "$REBASE_TMP_DIR" ; zip -qr "../${SAMPLES_ZIP_BASENAME}.rebased" * ) 518 | mv "${SAMPLES_ZIP_FULLNAME}.rebased" "$SOLUTION_DIR/system/default-content/$SAMPLES_ZIP_BASENAME" 519 | rm -rf "$REBASE_TMP_DIR" "${SAMPLES_ZIP_FULLNAME}.rebased" 520 | fi 521 | } 522 | 523 | installMarketplace (){ 524 | rm -rf $SOLUTION_DIR/system/marketplace 525 | unzip -o .tmp/marketplace/plugin.zip -d "$SOLUTION_DIR/system/" > /dev/null 526 | } 527 | 528 | installCDF (){ 529 | rm -rf $SOLUTION_DIR/system/pentaho-cdf 530 | 531 | # Removing samples dir. First two are deprecated 532 | rm -rf $SOLUTION_DIR/bi-developers/cdf-samples 533 | rm -rf $SOLUTION_DIR/plugin-samples/cdf-samples 534 | rm -rf $SOLUTION_DIR/plugin-samples/pentaho-cdf 535 | 536 | unzip -o .tmp/dist/pentaho-cdf$FILESUFIX.zip -d "$SOLUTION_DIR/system/" > /dev/null 537 | installSamples plugin-samples .tmp/dist/pentaho-cdf-samples$FILESUFIX*zip 538 | } 539 | 540 | installCDE (){ 541 | rm -rf $SOLUTION_DIR/system/pentaho-cdf-dd 542 | 543 | # Removing samples dir. First two are deprecated 544 | rm -rf $SOLUTION_DIR/cde_sample 545 | rm -rf $SOLUTION_DIR/plugin-samples/cde_sample 546 | rm -rf $SOLUTION_DIR/plugin-samples/pentaho-cdf-dd 547 | 548 | unzip -o .tmp/dist/pentaho-cdf-dd$FILESUFIX.zip -d "$SOLUTION_DIR/system/" > /dev/null 549 | installSamples plugin-samples .tmp/dist/pentaho-cdf-dd-solution$FILESUFIX.zip 550 | } 551 | 552 | installCDA (){ 553 | rm -rf $SOLUTION_DIR/system/cda 554 | 555 | # Removing samples dir. First is deprecated 556 | rm -rf $SOLUTION_DIR/bi-developers/cda 557 | rm -rf $SOLUTION_DIR/plugin-samples/cda 558 | 559 | unzip -o .tmp/dist/cda$FILESUFIX.zip -d "$SOLUTION_DIR/system/" > /dev/null 560 | installSamples plugin-samples .tmp/dist/cda-samples$FILESUFIX.zip 561 | } 562 | 563 | installCGG (){ 564 | rm -rf $SOLUTION_DIR/system/cgg 565 | 566 | unzip -o .tmp/dist/cgg$FILESUFIX.zip -d "$SOLUTION_DIR/system/" > /dev/null 567 | 568 | # Changes to the server; 1 - delete batik; 2 - copy new one plus xml and fop 569 | 570 | if [[ $HAS_WEBAPP_PATH -eq 1 ]] 571 | then 572 | LIB_DIR=$WEBAPP_PATH/WEB-INF/lib 573 | CGG_DIR=$SOLUTION_DIR/system/cgg/lib 574 | 575 | rm -rf $LIB_DIR/batik-* $LIB_DIR/xml-apis* $LIB_DIR/xmlgraphics* 576 | cp $CGG_DIR/batik-[^j]* $CGG_DIR/xml* $LIB_DIR 577 | 578 | else 579 | echo 580 | echo ' [CGG] No webapp path provided, if you are using pentaho older than 4.5 cgg will not work properly)' 581 | fi 582 | } 583 | 584 | installCFR (){ 585 | rm -rf $SOLUTION_DIR/system/cfr 586 | if [[ "$BASERVER_VERSION" = "4x" ]]; then 587 | unzip -o .tmp/dist/cfr-pentaho*$FILESUFIX.zip -d "$SOLUTION_DIR/system/" > /dev/null 588 | else 589 | unzip -o .tmp/dist/cfr-pentaho5$FILESUFIX.zip -d "$SOLUTION_DIR/system/" > /dev/null 590 | fi 591 | } 592 | 593 | installSparkl (){ 594 | rm -rf $SOLUTION_DIR/system/sparkl 595 | unzip -o .tmp/dist/sparkl$FILESUFIX.zip -d "$SOLUTION_DIR/system/" > /dev/null 596 | } 597 | 598 | installCDC (){ 599 | rm -rf $SOLUTION_DIR/system/cdc 600 | if [[ "$BASERVER_VERSION" = "4x" ]]; then 601 | unzip -o .tmp/dist/cdc-pentaho$FILESUFIX.zip -d "$SOLUTION_DIR/system/" > /dev/null 602 | else 603 | if [ $BRANCH = 'dev' ] 604 | then 605 | unzip -o .tmp/dist/cdc-pentaho5$FILESUFIX.zip -d "$SOLUTION_DIR/system/" > /dev/null 606 | else 607 | unzip -o .tmp/dist/cdc$FILESUFIX.zip -d "$SOLUTION_DIR/system/" > /dev/null 608 | fi 609 | 610 | fi 611 | 612 | 613 | # Changes to the server; 614 | 615 | # 1 - copy hazelcast to WEB-INF/lib 616 | LIB_DIR=$WEBAPP_PATH/WEB-INF/lib 617 | CDC_HAZELCAST_DIR=$SOLUTION_DIR/system/cdc/pentaho-lib 618 | rm -rf $LIB_DIR/hazelcast-*.jar 619 | rm -rf $LIB_DIR/cdc-hazelcast-*.jar 620 | cp $CDC_HAZELCAST_DIR/*.jar $LIB_DIR 621 | } 622 | 623 | 624 | installCDV (){ 625 | rm -rf $SOLUTION_DIR/system/cdv 626 | rm -rf $SOLUTION_DIR/plugin-samples/cdv 627 | if [[ "$BASERVER_VERSION" = "4x" ]]; then 628 | unzip -o .tmp/dist/cdv-pentaho$FILESUFIX.zip -d "$SOLUTION_DIR/system/" > /dev/null 629 | else 630 | unzip -o .tmp/dist/cdv$FILESUFIX.zip -d "$SOLUTION_DIR/system/" > /dev/null 631 | fi 632 | # installSamples plugin-samples .tmp/dist/cdv-samples$FILESUFIX*zip 633 | } 634 | 635 | installSaiku (){ 636 | rm -rf $SOLUTION_DIR/system/saiku 637 | unzip -o .tmp/saiku-plugin*zip -d "$SOLUTION_DIR/system/" > /dev/null 638 | 639 | LIB_DIR=$WEBAPP_PATH/WEB-INF/lib 640 | SAIKU_DIR=$SOLUTION_DIR/system/saiku/lib 641 | 642 | # http://stackoverflow.com/questions/18721314/cube-in-analysis-view-not-showing-in-saiku-analytics 643 | # it still works for 5.3 644 | mv -v $SAIKU_DIR/saiku-olap-util*.jar $LIB_DIR 645 | rm -v $SAIKU_DIR/mondrian*.jar $SAIKU_DIR/olap4j*.jar $SAIKU_DIR/eigenbase*.jar 646 | } 647 | 648 | installSaikuAdhoc (){ 649 | rm -rf $SOLUTION_DIR/system/saiku-adhoc 650 | unzip -o .tmp/saiku-adhoc-plugin*zip -d "$SOLUTION_DIR/system/" > /dev/null 651 | } 652 | 653 | 654 | 655 | # read options for stuff to download/install 656 | 657 | INSTALL_MARKETPLACE=0 658 | INSTALL_CDF=0 659 | INSTALL_CDA=0 660 | INSTALL_CDE=0 661 | INSTALL_CGG=0 662 | INSTALL_CFR=0 663 | INSTALL_SPARKL=0 664 | INSTALL_CDC=0 665 | INSTALL_CDV=0 666 | INSTALL_SAIKU=0 667 | INSTALL_SAIKU_ADHOC=0 668 | 669 | if [ "$BRANCH" = "dev" ]; then 670 | if [ "$MODULES" != "" ] || $ASSUME_YES; then 671 | INSTALL_MARKETPLACE=1 672 | else 673 | echo 674 | echo $ECHO_FLAG "Install Marketplace? This will delete everything in $SOLUTION_DIR/system/marketplace. you sure? (y/N) " 675 | read -e answer < /dev/tty 676 | 677 | case $answer in 678 | [Yy]* ) INSTALL_MARKETPLACE=1;; 679 | * ) ;; 680 | esac 681 | fi 682 | fi 683 | 684 | 685 | if [ "$MODULES" != "" ] || $ASSUME_YES; then 686 | INSTALL_CDF=1 687 | else 688 | echo 689 | echo $ECHO_FLAG "Install CDF? This will delete everything in $SOLUTION_DIR/system/pentaho-cdf. you sure? (y/N) " 690 | read -e answer < /dev/tty 691 | 692 | case $answer in 693 | [Yy]* ) INSTALL_CDF=1;; 694 | * ) ;; 695 | esac 696 | fi 697 | 698 | if [ "$MODULES" != "" ] || $ASSUME_YES; then 699 | INSTALL_CDA=1 700 | else 701 | echo 702 | echo $ECHO_FLAG "Install CDA? This will delete everything in $SOLUTION_DIR/system/cda. you sure? (y/N) " 703 | read -e answer < /dev/tty 704 | 705 | case $answer in 706 | [Yy]* ) INSTALL_CDA=1;; 707 | * ) ;; 708 | esac 709 | fi 710 | 711 | if [ "$MODULES" != "" ] || $ASSUME_YES; then 712 | INSTALL_CDE=1 713 | else 714 | echo 715 | echo $ECHO_FLAG "Install CDE? This will delete everything in $SOLUTION_DIR/system/pentaho-cdf-dd. you sure? (y/N) " 716 | read -e answer < /dev/tty 717 | 718 | case $answer in 719 | [Yy]* ) INSTALL_CDE=1;; 720 | * ) ;; 721 | esac 722 | fi 723 | 724 | 725 | if [ "$MODULES" != "" ] || $ASSUME_YES; then 726 | INSTALL_CGG=1 727 | else 728 | echo 729 | echo $ECHO_FLAG "Install CGG? This will delete everything in $SOLUTION_DIR/system/cgg. you sure? (y/N) " 730 | read -e answer < /dev/tty 731 | case $answer in 732 | [Yy]* ) INSTALL_CGG=1;; 733 | * ) ;; 734 | esac 735 | fi 736 | 737 | 738 | if [ "$BRANCH" = "dev" ]; then 739 | if [ "$MODULES" != "" ] || $ASSUME_YES; then 740 | INSTALL_CFR=1 741 | else 742 | echo 743 | echo $ECHO_FLAG "Install CFR? This will delete everything in $SOLUTION_DIR/system/cfr you sure? (y/N) " 744 | read -e answer < /dev/tty 745 | 746 | case $answer in 747 | [Yy]* ) INSTALL_CFR=1;; 748 | * ) ;; 749 | esac 750 | fi 751 | fi 752 | 753 | 754 | if [ "$BRANCH" = "dev" ]; then 755 | if [ "$MODULES" != "" ] || $ASSUME_YES; then 756 | INSTALL_Sparkl=1 757 | else 758 | echo 759 | echo $ECHO_FLAG "Install Sparkl? This will delete everything in $SOLUTION_DIR/system/sparkl you sure? (y/N) " 760 | read -e answer < /dev/tty 761 | 762 | case $answer in 763 | [Yy]* ) INSTALL_SPARKL=1;; 764 | * ) ;; 765 | esac 766 | fi 767 | fi 768 | 769 | 770 | if [[ $HAS_WEBAPP_PATH -eq 1 ]] 771 | then 772 | if [ "$MODULES" != "" ] || $ASSUME_YES; then 773 | INSTALL_CDC=1 774 | else 775 | echo 776 | echo $ECHO_FLAG "Install CDC? This will delete everything in $SOLUTION_DIR/system/cdc. you sure? (y/N) " 777 | read -e answer < /dev/tty 778 | case $answer in 779 | [Yy]* ) INSTALL_CDC=1;; 780 | * ) ;; 781 | esac 782 | fi 783 | else 784 | echo 785 | echo 'No webapp path provided, will not install CDC' 786 | fi 787 | 788 | 789 | if ([ $BRANCH = 'dev' ] && [ $BASERVER_VERSION = '5x' ] ) || [ $BASERVER_VERSION = '4x' ]; then 790 | if [ "$MODULES" != "" ] || $ASSUME_YES; then 791 | INSTALL_CDV=1 792 | else 793 | echo 794 | echo $ECHO_FLAG "Install CDV? This will delete everything in $SOLUTION_DIR/system/cdv. you sure? (y/N) " 795 | read -e answer < /dev/tty 796 | 797 | case $answer in 798 | [Yy]* ) INSTALL_CDV=1;; 799 | * ) ;; 800 | esac 801 | fi 802 | fi 803 | 804 | 805 | 806 | if [ $BASERVER_VERSION = '5x' ]; then 807 | if [ "$MODULES" != "" ] || $ASSUME_YES; then 808 | INSTALL_SAIKU=1 809 | else 810 | echo 811 | echo $ECHO_FLAG "Install Saiku? This will delete everything in $SOLUTION_DIR/system/saiku. you sure? (y/N) " 812 | read -e answer < /dev/tty 813 | 814 | case $answer in 815 | [Yy]* ) INSTALL_SAIKU=1;; 816 | * ) ;; 817 | esac 818 | fi 819 | fi 820 | 821 | if [ $BASERVER_VERSION = '5x' ] || [ "$MODULES" != "" ] || $ASSUME_YES; then 822 | INSTALL_SAIKU_ADHOC=1 823 | else 824 | echo 825 | echo $ECHO_FLAG "Install Saiku Adhoc? This will delete everything in $SOLUTION_DIR/system/saiku-adhoc. you sure? (y/N) " 826 | read -e answer < /dev/tty 827 | 828 | case $answer in 829 | [Yy]* ) INSTALL_SAIKU_ADHOC=1;; 830 | * ) ;; 831 | esac 832 | fi 833 | 834 | 835 | 836 | nothingToDo (){ 837 | echo Nothing to do. Exiting 838 | cleanup 839 | exit 1 840 | } 841 | 842 | if [ "$MODULES" != "" ]; then 843 | INSTALL_MARKETPLACE=0 844 | INSTALL_CDF=0 845 | INSTALL_CDA=0 846 | INSTALL_CDE=0 847 | INSTALL_CGG=0 848 | INSTALL_CFR=0 849 | INSTALL_SPARKL=0 850 | INSTALL_CDC=0 851 | INSTALL_CDV=0 852 | INSTALL_SAIKU=0 853 | INSTALL_SAIKU_ADHOC=0 854 | MODULES_ARR=$(echo $MODULES | tr "," "\n") 855 | for MODULE in $MODULES_ARR 856 | do 857 | case $MODULE in 858 | marketplace) INSTALL_MARKETPLACE=1;; 859 | cdf) INSTALL_CDF=1;; 860 | cda) INSTALL_CDA=1;; 861 | cde) INSTALL_CDE=1;; 862 | cgg) INSTALL_CGG=1;; 863 | cfr) INSTALL_CFR=1;; 864 | sparkl) INSTALL_SPARKL=1;; 865 | cdc) INSTALL_CDC=1;; 866 | cdv) INSTALL_CDV=1;; 867 | saiku) INSTALL_SAIKU=1;; 868 | saikuadhoc) INSTALL_SAIKU_ADHOC=1;; 869 | * ) ;; 870 | esac 871 | done 872 | fi 873 | 874 | 875 | [ $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 876 | 877 | 878 | # downloading files 879 | 880 | echo 881 | echo Downloading files 882 | echo 883 | 884 | 885 | [ $INSTALL_MARKETPLACE -eq 0 ] || downloadMarketplace 886 | [ $INSTALL_CDF -eq 0 ] || downloadCDF 887 | [ $INSTALL_CDA -eq 0 ] || downloadCDA 888 | [ $INSTALL_CDE -eq 0 ] || downloadCDE 889 | [ $INSTALL_CGG -eq 0 ] || downloadCGG 890 | [ $BRANCH != 'dev' ] || [ $INSTALL_CFR -eq 0 ] || downloadCFR 891 | [ $INSTALL_SPARKL -eq 0 ] || downloadSparkl 892 | [ $INSTALL_CDC -eq 0 ] || downloadCDC 893 | ([ $BRANCH != 'dev' ] && [ $BASERVER_VERSION = '5x' ] ) || [ $INSTALL_CDV -eq 0 ] || downloadCDV 894 | [ $BASERVER_VERSION = '4x' ] || [ $INSTALL_SAIKU -eq 0 ] || downloadSaiku 895 | [ $BASERVER_VERSION = '5x' ] || [ $INSTALL_SAIKU_ADHOC -eq 0 ] || downloadSaikuAdhoc 896 | 897 | 898 | # installing files 899 | 900 | echo 901 | echo Installing files 902 | echo 903 | 904 | [ $INSTALL_MARKETPLACE -eq 0 ] || installMarketplace 905 | [ $INSTALL_CDF -eq 0 ] || installCDF 906 | [ $INSTALL_CDA -eq 0 ] || installCDA 907 | [ $INSTALL_CDE -eq 0 ] || installCDE 908 | [ $INSTALL_CGG -eq 0 ] || installCGG 909 | [ $BRANCH != 'dev' ] || [ $INSTALL_CFR -eq 0 ] || installCFR 910 | [ $INSTALL_SPARKL -eq 0 ] || installSparkl 911 | [ $INSTALL_CDC -eq 0 ] || installCDC 912 | ([ $BRANCH != 'dev' ] && [ $BASERVER_VERSION = '5x' ] ) || [ $INSTALL_CDV -eq 0 ] || installCDV 913 | [ $BASERVER_VERSION = '4x' ] || [ $INSTALL_SAIKU -eq 0 ] || installSaiku 914 | [ $BASERVER_VERSION = '5x' ] || [ $INSTALL_SAIKU_ADHOC -eq 0 ] || installSaikuAdhoc 915 | 916 | 917 | 918 | cleanup 919 | 920 | echo 921 | echo Done! 922 | echo 923 | 924 | exit 0 925 | --------------------------------------------------------------------------------