home *** CD-ROM | disk | FTP | other *** search
Wrap
Text File | 2000-02-29 | 27.3 MB | 109,858 lines
Text Truncated. Only the first 1MB is shown below. Download the file for the complete contents.
#!/bin/sh PATH=$PATH:/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin BLOCKSIZE=32768 ARCHSTART=1 ARCHSIZE=28542292 ARCHBLOCKS=872 DEFAULTPERMS=022 # # START OF use.sh # # 2.5b4 echo "InstallAnywhere is preparing to install..." # # For making the env.properties files below # Needs to be done here to avoid variables created # within this script # USERENV=`set | sed 's,^\(.*\),"\1",'` # # SAVE PWD SO WE CAN RESTORE IT # PPWD=`pwd` # # FIND THE LOCATION OF THE SELF-EXTRACTOR # linked=true initname=`basename $0` initdir=`dirname $0` if [ ! $initdir = "." ] then cd $initdir fi initdir=`pwd` currname=$initname while [ $linked = true ] do #lsstring=`ls -dgon $currname` lsstring=`ls -l $currname` islink="`expr "$lsstring" : ".*[\>]\(.*\)"`" if [ ${islink:-""} = "" -o ${islink:-"0"} = "0" ] then linked=false else nextdir="`expr "$islink" : "\(.*\).*/"`" currname="`expr "$islink" : ".*/\(.*\)"`" if [ ${currname:-""} = "" ] then currname=$islink fi if [ ${nextdir:-""} != "" -a ${nextdir:-"0"} != "0" ] then cd $nextdir fi fi done SEA_LOC="`pwd`/$currname" cd "$PPWD" # # SETUP TEMP, SETUP LOCATIONS # if [ -d /tmp ] ; then INSTBASE=/tmp else INSTBASE=$HOME fi cd "$INSTBASE" mkdir install.dir.$$ cd install.dir.$$ mkdir InstallerData ZIPLOC="$INSTBASE"/install.dir.$$ envPropertiesFile="$ZIPLOC/env.properties" # Set up trap for interrupted installations # This trap will catch if the user hits ^C in the console window where # this script is being run. When caught the following function will # be run to clean up the /tmp/install.dir.XXXX directory # tmp_dir_cleanup () { echo echo "WARNING! This installation has been interrupted. The" echo "installation process will now terminate and the temporary" echo "files it is using will be deleted from $ud." echo cd $PPWD rm -rf $ud exit; } trap "tmp_dir_cleanup" 1 2 3 4 6 8 10 12 13 15 installerdatapath="$ZIPLOC"/InstallerData installzippath="$installerdatapath"/installer.zip cd "$PPWD" # # DEFINE ALL-PURPOSE ERROR MESSAGE # errormsg="The download file appears to be corrupted. Please try\nto download again, and make sure you are using 'binary' mode.\n\nPlease do not attempt to install this archive file." # # EXTRACT THE INSTALL.ZIP ARCHIVE # dd if=$0 of=$installzippath bs=$BLOCKSIZE skip=$ARCHSTART count=$ARCHBLOCKS 1> /dev/null 2> /dev/null thesize=`ls -l $installzippath | awk '{print $5}'` if expr $thesize != $ARCHSIZE 1>/dev/null then echo $errormsg exit 1 fi cd "$PPWD" # # WRITE A FILE IN THE INSTALL.ZIP FOLDER NAMED sea_loc THAT # CONTAINS THE PATH TO THE SELF-EXTRACTOR # echo "$SEA_LOC" > "$ZIPLOC"/sea_loc # # CREATE AN LAX FILE FOR THE STANDARD LAUNCHER WHICH WILL BE APPENDED # TO THIS SCRIPT AT BUILD TIME # templaxpath="$ZIPLOC"/temp.lax echo "lax.class.path="$installerdatapath":"$installzippath > $templaxpath echo "lax.main.class=com.zerog.ia.installer.Main" >> $templaxpath echo "lax.main.method=main" >> $templaxpath echo "lax.nl.message.vm.not.loaded=The installer either could not find a Java VM, or the Java VM on this system is too old. The installer requires Java 1.1.5 or later. It can be downloaded from http://java.sun.com/products/jdk/1.1/jre/" >> $templaxpath echo "lax.nl.java.launcher.main.class=com.zerog.lax.LAX" >> $templaxpath echo "lax.nl.java.launcher.main.method=main" >> $templaxpath echo "lax.command.line.args=\$CMD_LINE_ARGUMENTS\$" >> $templaxpath echo "lax.nl.current.vm=" >> $templaxpath echo "lax.nl.java.compiler=off" >> $templaxpath echo "lax.nl.java.option.verify.mode=none" >> $templaxpath echo "lax.nl.java.option.check.source=off" >> $templaxpath # so the installer can find sea_loc, and logs will go into the temp dir # not the working dir echo "lax.user.dir=""$ZIPLOC" >> $templaxpath # # TELL THE STANDARD LAUNCHER THAT IT SHOULD NOT BACKUP THIS # LAX FILE, SINCE WE ARE THE SELF-EXTRACTOR # noLaxBackup=true umask $DEFAULTPERMS # # END OF use.sh # #! /bin/sh # LaunchAnywhere (tm) version 3.0 # (c) Copyright 1999,2000 Zero G Software, Inc., all rights reserved. # # To run this script you will need to have the following: # 1) a Java VM installed (however, it will handle a lack of Java nicely). # 2) a Java-style properties file having the same name as this script # with the suffix .lax. If this script is appended to the # self-extractor, it will look for the properties file in the # directory specified by $templaxpath; otherwise, it will look in # the same directory that this script is in. # 3) a Java program in the file "lax.jar". # # The .lax property file must contain at least the following properties: # 1) lax.class.path classpath (do not include the environment variable $CLASSPATH) # 2) lax.nl.java.launcher.main.class (main class of LaunchAnywhere Executable) # 3) lax.currentVM (VM to launch with) # # This program is also used for the "Try It!" feature of the InstallAnywhere # designer. If the name of a VM is passed in as an argument when invoking # this script, the VM will be checked for validity and used to run the # application specified in the .lax file. #################################################################################### # # UNIX ENVIRONMENT configuration # # Get os type , note that it is LOWER-CASED. Used here and later on os_name=`uname -s 2> /dev/null | tr "[:upper:]" "[:lower:]" 2> /dev/null` if [ "$os_name" = "solaris" -o "$os_name" = "sunos" ]; then THREADS_FLAG=""; export THREADS_FLAG PATH=/usr/bin:$PATH; export PATH fi #################################################################################### # # CREATE ENV.PROPERTIES and figure out if this is being exec'd from an installer # # Since USERENV is already set in the self-extractor, its its not set we know # this is not an installer but a separate launcher. USERENV holds env variable # pairs # IS_INSTALLER="" if [ -z "$USERENV" ] then USERENV=`set | sed 's,^\(.*\),"\1",'` else IS_INSTALLER="true" fi if [ -z "$envPropertiesFile" ] then if [ -d /tmp ] then envPropertiesFile=/tmp/env.properties.$$ else envPropertiesFile=$HOME/env.properties.$$ fi fi # # create the properties files BEFORE writing to it so that we can change is permissions to be more # secure... who knows? maybe the user has a password in an environment variable! # touch $envPropertiesFile chmod 600 $envPropertiesFile # # The first sed call is to escape spaces and tables from the RHS of environment values. This white space would # be interpreted as separate arguments to the for statement. So this escaping with ||| for spaces and @@@ for tabs # makes sure that env values with such whitespace is accounted for # for setting in $USERENV do lhs=`echo $setting | sed 's/^"\(.*\)=.*/\1/'` rhs=`echo $setting | sed 's/^.*=\(.*\)"/\1/'` echo lax.nl.env.$lhs=$rhs >> $envPropertiesFile llhs=`echo $lhs | tr [:upper:] [:lower:] 2> /dev/null` # dont make duplicates, if the variablename was in all # lowercase, dont give it again if [ "$llhs" != "$lhs" ] then echo lax.nl.env.$llhs=$rhs >> $envPropertiesFile fi done #################################################################################### # # Tracing symbolic links to actual launcher location # olddir=`pwd` linked=true initname=`basename $0 2> /dev/null` initdir=`dirname $0 2> /dev/null` if [ ! "$initdir" = "." ] then cd $initdir fi initdir=`pwd` currname=$initname while [ "$linked" = true ] do lsstring=`ls -l $currname` islink=`expr "$lsstring" : ".*[\>]\(.*\)"` if [ ${islink:-""} = "" -o ${islink:-"0"} = "0" ] then linked=false else nextdir=`expr "$islink" : "\(.*\).*/"` currname=`expr "$islink" : ".*/\(.*\)"` if [ ${currname:-""} = "" ] then currname=$islink fi if [ ${nextdir:-""} != "" -a ${nextdir:-"0"} != "0" ] then cd $nextdir fi fi done #################################################################################### # # FINDING THE LAX FILE # # If this is an installer, use $templaxpath # if [ "$IS_INSTALLER" != "" ]; then propfname=$templaxpath else propfname=$currname.lax fi if [ ! -r "$propfname" ]; then echo "The file "$propfname" could not be found, and the" echo "program cannot be run without it. Try reinstalling the program." exit; fi #################################################################################### # # READING THE LAX FILE # getparam='BEGIN { FS="=" } { if(index($1,"#")!=1) if($1==value) print $2}' clp=`awk "$getparam" value="lax.class.path" $propfname` mainc=`awk "$getparam" value="lax.nl.java.launcher.main.class" $propfname` tmp_vm=`awk "$getparam" value="lax.nl.current.vm" $propfname` ud=`awk "$getparam" value="lax.user.dir" $propfname` out=`awk "$getparam" value="lax.stdout.redirect" $propfname` err=`awk "$getparam" value="lax.stderr.redirect" $propfname` insdir=`awk "$getparam" value="lax.dir" $propfname` ask=`awk "$getparam" value="lax.always.ask" $propfname` app_name=`awk "$getparam" value="lax.application.name" $propfname` no_vm_msg=`awk "$getparam" value="lax.nl.message.vm.loaded" $propfname` # # special casing LAX VM settings # launcher usage JRE,JDK,R12(JRE),D12(JDK) # if [ "$IS_INSTALLER" != "" ] then vm_list="R11 D11 D12old" else vm_list=`awk "$getparam" value="lax.nl.valid.vm.list" $propfname` vm_list=`echo $vm_list | sed 's/,/ /g'` fi lax_version="3.0" # # vm switch # modifier to -verify option to -verifyremote, -verify(all) or nothing # verify_type=`awk "$getparam" value="lax.nl.java.option.check.source" $propfname` if [ "$app_name" != "" ] then options="$options -Dlax.application.name=\"$app_name\"" fi if [ "$lax_version" != "" ] then options="$options -Dlax.version=\"$lax_version\"" fi # # If the vm gets a relative path, we must make it absolute to the Install # Directory tm 3/3 # if [ "${tmp_vm:-""}" = "" ] then vm="" else first_char=`echo $tmp_vm | sed 's,^\(.\).*,\1,'` if [ "$first_char" = "/" ] then vm=$tmp_vm else vm=$insdir$tmp_vm fi fi # # Reading in VM invocation options # verify=`awk "$getparam" value="lax.nl.java.option.verify.mode" $propfname` verbo=`awk "$getparam" value="lax.nl.java.option.verbose" $propfname` gcxtnt=`awk "$getparam" value="lax.nl.java.option.garbage.collection.extent" $propfname` gcthrd=`awk "$getparam" value="lax.nl.java.option.garbage.collection.background.thread" $propfname` nsmax=`awk "$getparam" value="lax.nl.java.option.native.stack.size.max" $propfname` jsmax=`awk "$getparam" value="lax.nl.java.option.java.stack.size.max" $propfname` jhmax=`awk "$getparam" value="lax.nl.java.option.java.heap.size.max" $propfname` jhinit=`awk "$getparam" value="lax.nl.java.option.java.heap.size.initial" $propfname` debug=`awk "$getparam" value="lax.nl.java.option.debugging" $propfname` #################################################################################### # # Checking for invalid classpath and/or main class # if [ "${clp:-""}" = "" ] then echo "The classpath specified in the LAX properties file" echo "is invalid. Try reinstalling the program." exit; fi if [ "${mainc:-""}" = "" ] then echo "The main class specified in the LAX properties file" echo "is invalid. Try reinstalling the program." exit; fi #################################################################################### # Determining absolute classpaths # Checking if environment variable CLASSPATH needs to be included # clphead=`expr "$clp" : "\(.*\).*[$]ENV_CLASSPATH"` clptail=`expr "$clp" : ".*[$]\(.*\)"` if [ "${clphead:-"0"}" = "0" ] then clphead="" fi if [ ${clptail:-"0"} = "0" ] then clptail="" fi if [ "$clphead" = "$clptail" ] then smclp=$clp else smclp=$clphead$CLASSPATH$clptail fi #################################################################################### # Creating absolute classpaths for relative paths # here=`pwd` #################################################################################### # commands is an awk script that divides up the classpath by semicolon, # and then concatenates them together by colon # commands='{ numitems=split($0,arr); newitem = ""; for (item=1; item<=numitems; item++) {if (item<numitems) {sep=":"} else {sep=""};newitem = newitem arr[item] sep}; print newitem}' smclp=`echo $smclp | awk -F\; "$commands"` #`echo $smclp` i=1 finished=false while [ $finished = false ] do commands='BEGIN { FS=":" } { print $arg }' thisclp=`echo $smclp | awk "$commands" arg=$i -` if [ "${thisclp:-""}" = "" ] then finished=true else testclp=`expr "$thisclp" : "\([/]\)"` if [ "${testclp:-""}" = "" -o "${testclp:-"0"}" = "0" ] then absclp=$absclp$here/$thisclp: else absclp=$absclp$thisclp: fi fi i=`expr $i + 1` done clp=$absclp #################################################################################### # Renaming .lax file by absolute classpath (if not self-extractor) # if [ ${templaxpath:-""} = "" ] then propfname=$here/$propfname fi #################################################################################### # Determining VM invocation options to use # verify=${verify:="null"} if [ "$verify" = "remote" -o "$verify_type" = "remote" ] then options="-verifyremote" elif [ "$verify" = "all" ] then if [ "$verify_type" = "remote" ] then options="-verifyremote" else options="-verify" fi elif [ "$verify" = "none" -o "$verify_type" = "remote" ] then options="-noverify" fi verbo=${verbo:="none"} if [ $verbo = "normal" ] then options="$options -verbose" elif [ $verbo = "all" ] then options="$options -verbose -verbosegc" elif [ $verbo = "gc" ] then options="$options -verbosegc" fi gcxtnt=${gcxtnt:="none"} if [ $gcxtnt = "min" ] then options="$options -noclassgc" fi gcthrd=${gcthrd:="none"} if [ $gcthrd = "off" ] then options="$options -noasyncgc" fi if [ ! nsmax=${nsmax:="none"} ] then options="$options -ss$nsmax" fi if [ ! ${jsmax:-"none"} = "none" ] then options="$options -oss$jsmax" fi if [ ! ${jhmax:-""} = "" ] then options="$options -mx$jhmax" fi if [ ! ${jhinit:-""} = "" ] then options="$options -ms$jhinit" fi ################################################################## # Setting stdout and stderr redirection # laxdebug=$LAX_DEBUG if [ ! ${laxdebug:-""} = "" ] then out="console" err="console" options="-Dlax.stderr.redirect=console -Dlax.stdout.redirect=console $options" else out=${out:=null} if [ $out = "null" -o $out = "NULL" ] then out="notconsole" fi err=${err:=null} if [ $err = "null" -o $err = "NULL" ] then err="notconsole" fi fi ################################################################## # Resetting java home and JIT compiler environment variables # J_HOME= export J_HOME ################################################################## # Determining what type of JIT to use (if any) # ostype=`uname -s` if [ $ostype = "SunOS" ] then ostype="Solaris" cputype=`uname -p` else cputype=`uname -m` fi jitinvoc="" jittype="" ################################################################## # Looking for JIT in props file jittype=`awk "$getparam" value="lax.nl.$ostype.$cputype.java.compiler" $propfname` if [ ${jittype:-""} = "" ] then jittype=`awk "$getparam" value="lax.nl.$ostype.java.compiler" $propfname` fi if [ ${jittype:-""} = "" ] then jittype=`awk "$getparam" value="lax.nl.java.compiler" $propfname` fi ostype=${ostype:=""} if [ $ostype = "IRIX64" ] then jitinvoc="-nojit" elif [ $ostype = "HP-UX" -o $ostype = "IRIX" ] then if [ ${jittype:-""} = "off" ] then # old method #jitinvoc="-nojit -Djava.compiler=" JIT_OPTIONS="-nojit" export JIT_OPTIONS fi elif [ $ostype = "Solaris" ] then if [ ${jittype:-""} = "off" ] then jitinvoc="-Djava.compiler=" fi elif [ $ostype = "AIX" ] then if [ ${jittype:-""} = "off" ] then JAVA_COMPILER=off export JAVA_COMPILER fi else if [ ${jittype:-""} = "off" ] then jitinvoc="-Djava.compiler=" fi fi options="$jitinvoc $options" ################################################################## # Passing in PATH environment variable # options="$options -Dlax.nl.env.path=$PATH" ################################################################## # load valid VM types # # Sift through the types found in the lax file. As they are # discovered set the variable to "OK" so that the VM search # logic will accept that type of VM if found. If the vm_list # is empty (e.g. the option is not used in the LAX file) then # accept any type of VM # typeD11="" typeR11="" typeD12="" typeD12old="" typeR12="" num_types=0; for vm_type in $vm_list do case "$vm_type" in 'D11') typeD11="OK" num_types=`expr $num_types + 1` ;; 'R11') typeR11="OK" num_types=`expr $num_types + 1` ;; 'D12') typeD12="OK" typeD12old="OK" num_types=`expr $num_types + 1` ;; 'D12old') typeD12old="OK" num_types=`expr $num_types + 1` ;; 'R12') typeR12="OK" num_types=`expr $num_types + 1` ;; 'JDK') typeD11="OK" typeD12="OK" typeD12old="OK" num_types=`expr $num_types + 1` ;; 'JRE') typeR11="OK" typeR12="OK" num_types=`expr $num_types + 1` ;; esac done ################################################################## # is the VM type list empty? # if [ ${num_types:-"0"} -le 0 ]; then # the vm_list must be empty, accept any type typeD11="OK"; typeR11="OK"; typeD12="OK"; typeR12="OK"; typeD12old="OK" fi ################################################################## # if its not an installer , ignore old java # if [ "$IS_INSTALLER" = "" ] then typeD12old="" fi lax_vm="LAX_VM" # Getting VM #check to see if it was passed into us #echo "checking for VM" if [ "${1:-""}" = "$lax_vm" ] then # Using VM passed in as argument actvm=$2 else #echo "Looking for Java VMs on your PATH" # Looking for VMs from props file on path if [ ${ask:-"false"} = "true" ] then vm="" fi # check if the current VM still exists. If not, look for one. # tm 3/3 if [ ! -x "$vm" -o -d "$vm" ]; then echo "" echo "Please choose a Java virtual machine to run this program." echo "(These virtual machines were found on your PATH)" echo "---------------------------------------------------------" getpaths='BEGIN {FS=":"}{ for(i=1;i<=NF;i++) print $i; }' # Printing list of javas and jres pathCheckList="" pathc=1 for file in `echo "$PATH" | awk "$getpaths"` do # # save the original-thought-to-be location of the VM # so its fammilar to uses when listed # origDir=$file; # # is it JDK1.1 , JDK1.2 (or OLDJAVA) or JRE1.2? # if [ -x "$file/java" -a \( ! -d "$file/java" \) ]; then ############################################################ # # If this is a link, resolve it # We only do this for "java"s and not "jre"s because it doesnt matter # if a jre is a symlink or not due to this logic used in finding VMs # linkDir=`dirname $file/java 2> /dev/null` minusLoutput=`ls -l $file/java` minusLoutput=`expr "$minusLoutput" : ".*[\>] \(.*\)"` minusLoutput=`dirname $minusLoutput 2> /dev/null` # if its not just the java link to .java_wrapper if [ "$minusLoutput" != "." ]; then while [ "$minusLoutput" != "" -a "$minusLoutput" != "0" ] do if [ `expr "$minusLoutput" : "^/"` = 0 ]; then minusLoutput=$linkDir/$minusLoutput fi minusLprev=$minusLoutput minusLoutput=`ls -l $minusLoutput 2> /dev/null` minusLoutput=`expr "$minusLoutput" : ".*[\>] \(.*\)"` linkDir=`dirname $minusLoutput 2> /dev/null` if [ "$linkDir" = "." ]; then linkDir=$minusLprev fi file=$minusLprev done if [ ! -d "$file" ]; then file=`dirname $file 2> /dev/null` fi # hack ugh, sometimes a trailing "/." is left, this removes it # (the java_wrapper fix above, at the start of the loop might # actually be fixing it.) noTrailingDot=`expr "$file" : "\(.*\)/\."` if [ "$noTrailingDot" != "" -a "$noTrailingDot" != "0" ]; then file=$noTrailingDot fi fi ############################################################ # Do some OS-specific quirky stuff # # MacOS X / Rhapsody # quirk_classesZip="" if [ "$os_name" = "rhapsody" ]; then if [ "`expr "$file" : ".*JavaVM.framework$"`" != "0" ]; then quirk_classesZip="$file/Classes/classes.jar" file="$file/Home/bin" fi fi # END OS quirky stuff ############################################################ # # is it JDK1.1? # if [ -r "$file/../lib/classes.zip" -o -r "$quirk_classesZip" ]; then if [ "$typeD11" = "OK" ]; then # JDK1.1 if [ "`expr "$pathCheckList" : ".*$origDir/java.*"`" = "0" -o "`expr "$pathCheckList" : ".*$origDir/java.*"`" = "" ]; then eval part$pathc="$file/java" eval vmver$pathc="D11" printf "%2d.\t$origDir/java\n" $pathc pathc=`expr $pathc + 1` pathCheckList="$pathCheckList $origDir/java" fi fi else # JDK1.2 # # is there an "oldjava" (1.2) # if [ -r "$file/oldjava" -a "$typeD12old" = "OK" ] then if [ "`expr "$pathCheckList" : ".*$origDir/oldjava.*"`" = "0" -o "`expr "$pathCheckList" : ".*$origDir/oldjava.*"`" = "" ]; then eval part$pathc="$file/oldjava" eval vmver$pathc="D12old" printf "%2d.\t$origDir/java\n" $pathc pathc=`expr $pathc + 1` pathCheckList="$pathCheckList $origDir/oldjava" fi fi # # is the "java" JRE1.2 or JDK1.2? # if [ -r "$file/../lib/dt.jar" ] then # JDK1.2 if [ "$typeD12" = "OK" ] then if [ "`expr "$pathCheckList" : ".*$origDir/java.*"`" = "0" -o "`expr "$pathCheckList" : ".*$origDir/java.*"`" = "" ]; then eval part$pathc="$file/java" eval vmver$pathc="D12" printf "%2d.\t$origDir/java\n" $pathc pathc=`expr $pathc + 1` pathCheckList="$pathCheckList $origDir/java" fi fi else # JRE1.2 if [ "$typeR12" = "OK" ] then if [ "`expr "$pathCheckList" : ".*$origDir/java.*"`" = "0" -o "`expr "$pathCheckList" : ".*$origDir/java.*"`" = "" ]; then eval part$pathc="$file/java" eval vmver$pathc="R12" printf "%2d.\t$origDir/java\n" $pathc pathc=`expr $pathc + 1` pathCheckList="$pathCheckList $origDir/java" fi fi fi fi fi # # is it a JRE1.1? # if [ -x $file/jre -a \( ! -d $file/jre \) -a "$typeR11" = "OK" ] then # 1.1 JRE if [ "`expr "$pathCheckList" : ".*$origDir/jre.*"`" = "0" -o "`expr "$pathCheckList" : ".*$origDir/jre.*"`" = "" ]; then printf "%2d.\t$origDir/jre\n" $pathc eval part$pathc="$file/jre" eval vmver$pathc="R11" pathc=`expr $pathc + 1` pathCheckList="$pathCheckList $origDir/jre" fi fi done printf "%2d.\tExit.\n\n" $pathc # If no VMs are found in path if [ $pathc -eq 1 ] then echo "No Java virtual machine could be found from your PATH" echo "environment variable. You must install a VM prior to" echo "running this program." cd $olddir #rm -rf $ud exit fi # Taking selection if [ ! ${LAX_NONINTERACTIVE:-""} = "" ] then # Automatically choosing first VM sel="1" eval actvm="\$part$sel" echo "Automatically selecting $actvm..." else # echo -n "Please enter your selection (number): " printf "Please enter your selection (number): " read sel # Checking for validity if [ $sel -eq $pathc ] then cd $olddir #rm -rf $ud exit elif [ $sel -lt 1 -o $sel -ge $pathc ] then echo "Invalid Selection: This program will terminate." cd $olddir #rm -rf $ud exit fi fi eval vmver="\$vmver$sel" eval actvm="\$part$sel" # noLaxBackup is true for self-extractor noLaxBackup=${noLaxBackup:="false"} if [ ! "$noLaxBackup" = true -a -w "$propfname" ] then sedscript="s;lax.nl.current.vm.*;lax.nl.current.vm=$actvm;" sed $sedscript $propfname>file.lax mv $propfname $propfname.bak > /dev/null 2>&1 mv file.lax $propfname > /dev/null 2>&1 rm $propfname.bak > /dev/null 2>&1 fi else actvm=$vm fi fi # Changing working directory if [ ! "$ud" = "" ] then if [ ! "$ud" = "." ]; then cd "$ud" fi else cd "$olddir" fi # Optional printout of all variable values for debugging purposes if [ ! ${laxdebug:-""} = "" ] then echo "classpath: $clp" echo "main class: $mainc" echo ".lax file path: $propfname" echo "user directory: $ud" echo "stdout to: $out" echo "sterr to: $err" echo "install directory: $insdir" echo "JIT: $jittype" echo "option (verify): $verify" echo "option (verbosity): $verbo" echo "option (garbage collection extent): $gcxtnt" echo "option (garbage collection thread): $gcthrd" echo "option (native stack max size): $nsmax" echo "option (java stack max size): $jsmax" echo "option (java heap max size): $jhmax" echo "option (java heap initial size): $jhinit" fi # Setting jre/java invocation command # if the VM was passed into us, then we shift the # arguments over by two, one for "LAX_VM" and one for # the vm path if [ "${1:-""}" = $lax_vm ] then shift 2 fi # before running the VM and tacking on the cmdline args, we need # to make sure that cmdline args to the launcher are passed # correctly to the application. To overcome the problem of quoted # args (with internal spaces) to the launcher is that they get # "unquoted" or separated into discreet args when they are put # on the cmdline for the application. This following block makes # sure the stay intact cmdlineargs="" for arg in $* do if [ "$1" != "" ] then cmdlineargs="$cmdlineargs \"$1\"" shift 1 fi done vmtype=`expr "$actvm" : ".*/\(.*\)"` runVM () { # # Setting the JAVA_HOME based on the location of the jre # # What we will do is strip off /bin$ from the END of this # variable. If the path doesn't contain 'bin' we leave # JAVA_HOME blank. However, its useless to try and set # the home from a link, so we have to find the true home # on the disk of the VM first # actvm_remaining=$actvm # #first check to see if the VM is a link and follow it # linkDir=`dirname $actvm_remaining 2> /dev/null` minusLoutput=`ls -l $actvm_remaining` minusLoutput=`expr "$minusLoutput" : ".*[\>] \(.*\)"` while [ "$minusLoutput" != "" -a "$minusLoutput" != "0" ] do if [ `expr "$minusLoutput" : "^/"` = 0 ]; then minusLoutput=$linkDir/$minusLoutput fi minusLprev=$minusLoutput minusLoutput=`ls -l $minusLoutput` minusLoutput=`expr "$minusLoutput" : ".*[\>] \(.*\)"` linkDir=`dirname $minusLoutput 2> /dev/null` actvm_remaining=$minusLprev done # # from the true home of the VM, fill JAVA_HOME # JAVA_HOME="" until [ "$actvm_remaining" = "" ] do last=`expr "$actvm_remaining" : '.*/\(.*\)'` rest=`expr "$actvm_remaining" : '\(.*\)/.*'` if [ "$last" = "bin" ] then JAVA_HOME=$rest break else actvm_remaining=$rest fi done # Making $JAVA_HOME available to the application. export JAVA_HOME echo JAVA_HOME=\"$JAVA_HOME\" if [ $vmtype = "jre" ] then CLASSPATH= export CLASSPATH # I split these up so they would be a bit # clearer on the screen. echo "Running:" echo "-----" echo "$actvm $options -cp \"$clp\" $mainc $propfname $envPropertiesFile $cmdlineargs" echo "-----" # Here is where we actually run the app in Java: eval $actvm $options -cp \"$clp\" $mainc $propfname $envPropertiesFile $cmdlineargs else CLASSPATH=$clp export CLASSPATH debug=${debug:-"off"} if [ ! $debug = "off" ] then options="$options -debug" fi # I split these up so they would be a bit clearer on the screen. echo "Running:" echo "-----" echo "$actvm $options $mainc $propfname $envPropertiesFile $cmdlineargs" echo "-----" # Here is where we actually run the app in Java: eval $actvm $options $mainc $propfname $envPropertiesFile $cmdlineargs fi } # Invocation of VM if [ $out = "console" -a $err = "console" ] then runVM elif [ $out = "console" ] then runVM 2> /dev/null elif [ $err = "console" ] then runVM 1> /dev/null else runVM 1> /dev/null 2> /dev/null fi # Change back to directory used priory to this script running. cd $olddir rm -f $envPropertiesFile if [ -f $ZIPLOC/sea_loc ] ; then rm -Rf $ZIPLOC fi exit 0