"Fossies" - the Fresh Open Source Software Archive

Member "rapidminer-studio/RapidMiner-Studio.sh" (5 Nov 2019, 4936 Bytes) of package /linux/misc/rapidminer-studio-9.5.0.zip:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Bash source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 #!/bin/bash
    2 
    3 ############################################################
    4 ##                                                        ##
    5 ##       Unix Start Script for RapidMiner Studio          ##
    6 ##                                                        ##
    7 ##  This script tries to determine the location of        ##
    8 ##  RapidMiner Studio, searches for a proper Java         ##
    9 ##  executable and starts the program.                    ##
   10 ##                                                        ##
   11 ############################################################
   12 
   13 ## remove _JAVA_OPTIONS environment variable for this run ##
   14 ## it could contain stuff that break Studio launching so we ignore it completely ##
   15 unset _JAVA_OPTIONS
   16 
   17 if [ -z "${RAPIDMINER_HOME}" ] ; then
   18     RAPIDMINER_HOME="$(cd "$(dirname "$0")" 2>/dev/null && pwd)"
   19     echo "RAPIDMINER_HOME is not set. Trying the directory '${RAPIDMINER_HOME}'..."
   20 fi 
   21 
   22 ##########################
   23 ##                      ##
   24 ##  Searching for Java  ##
   25 ##                      ##
   26 ##########################
   27 
   28 # JAVA_HOME set, so use it
   29 if [ ! -z "${JAVA_HOME}" ] ; then
   30     if [ -x "${JAVA_HOME}/bin/java" ]; then
   31         JAVA="${JAVA_HOME}/bin/java"
   32     fi
   33 fi
   34 
   35 # otherwise, try to find java using which
   36 if [ -z "${JAVA}" ] ; then
   37     _jfnd="`which java`"
   38     if [ -x "${_jfnd}" ]; then
   39         JAVA="${_jfnd}"
   40     else
   41         echo 'Could not find the java executable in default path or ${JAVA_HOME}/bin/java.'
   42         echo "Edit $0 and/or your local startup files."
   43         exit 1
   44     fi
   45     unset _jfnd
   46 fi
   47 
   48 
   49 
   50 ###############################################
   51 ##                                           ##
   52 ##  Launch RapidMiner and check for updates  ##
   53 ##                                           ##
   54 ###############################################
   55 
   56 update_root=~/.RapidMiner/update
   57 update_dir=${update_root}/RUinstall
   58 update_script=${update_root}/UPDATE
   59 
   60 LAUNCH=1
   61 while [ ${LAUNCH} -eq 1 ]
   62 do
   63     # Performing possible update
   64     if [ -d "${update_dir}" ]; then
   65         if [ -w "${RAPIDMINER_HOME}" ] ; then
   66             echo "======================================================================="
   67             echo "Performing update. Copying files from '${update_dir}' to '${RAPIDMINER_HOME}'."
   68             cp -rf "${update_dir}"/* "${RAPIDMINER_HOME}"
   69             rm -rf "${update_dir}"
   70             echo "Copy complete."
   71             if [ -f "${update_script}" ] ; then
   72                 echo "Deleting obsolete files listed in ${update_script}."
   73                 {
   74                     while read COMMAND FILE
   75                     do
   76                         if [ "DELETE" = "${COMMAND}" ] ; then
   77                             # Strip rapidminer/ prefix
   78                             FILE=`echo ${FILE} | sed -e 's/^rapidminer\///'`
   79                             TO_DELETE=${RAPIDMINER_HOME}/${FILE}
   80                             if [ -f "${TO_DELETE}" ] ; then
   81                                 echo "Deleting regular file ${TO_DELETE}"
   82                                 rm "${TO_DELETE}"
   83                             elif [ -d "${TO_DELETE}" ] ; then
   84                                 echo "Deleting directory ${TO_DELETE}"
   85                                 rmdir "${TO_DELETE}"
   86                             else
   87                                 echo "Cannot delete file ${TO_DELETE} (does not exist)"
   88                             fi                          
   89                         else
   90                             echo "Unknown update command: ${COMMAND}"
   91                         fi
   92                     done
   93                 } < ${update_script}
   94                 rm "${update_script}"
   95                 echo "Completed deletion of obsolete files."
   96             else
   97                 echo "No update script found in ${update_script}."
   98             fi
   99             rm -rf "${update_root}"
  100             echo "Update complete"
  101             echo "======================================================================="
  102         else
  103             echo "======================================================================="
  104             echo "ATTENTION: An update was downloaded, but we cannot write to"
  105             echo "           ${RAPIDMINER_HOME}. "
  106             echo "           Ignoring update. Please restart as super user."
  107             echo "======================================================================="
  108         fi
  109     fi
  110 
  111     # Compile launch parameters
  112     rmClasspath="${RAPIDMINER_HOME}"/lib/*
  113     JVM_OPTIONS=$("$JAVA" "-Djava.awt.headless=true" -cp "${rmClasspath}" com.rapidminer.launcher.JVMOptionBuilder "$@")
  114     
  115     # Launch Studio
  116     LAUNCH=0
  117     if [ $# -gt 0 ]; then
  118       eval \"$JAVA\" $JVM_OPTIONS -cp \"${rmClasspath}\" com.rapidminer.launcher.GUILauncher \"$@\"
  119     else
  120       eval \"$JAVA\" $JVM_OPTIONS -cp \"${rmClasspath}\" com.rapidminer.launcher.GUILauncher
  121     fi
  122 
  123 
  124     if [ $? -eq 2 ]
  125     then
  126         echo RapidMiner Studio will now relaunch 
  127         LAUNCH=1
  128     fi
  129 done