home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / JBuilder8.iso / Linux / ent_install.bin < prev    next >
Text File  |  2002-11-12  |  44KB  |  1,549 lines

  1. #!/bin/sh
  2. #################################################################################################
  3. #
  4. # LAXUNIX.SH - LaunchAnywhere (tm) version 5.0
  5. #
  6. # (c) Copyright 1999-2002 Zero G Software, Inc., all rights reserved.
  7. #
  8. #  To run this script you will need to have the following:
  9. #    1) a Java VM installed (however, it will handle a lack of Java nicely).
  10. #    2) a Java-style properties file having the same name as this script 
  11. #        with the suffix .lax.  If this script is appended to the
  12. #        self-extractor, it will look for the properties file in the
  13. #        directory specified by $seLaxPath; otherwise, it will look in
  14. #        the same directory that this script is in.
  15. #    3) a Java program in the file "lax.jar".
  16. #
  17. #  The .lax property file must contain at least the following properties:
  18. #    1)  lax.class.path  classpath (do not include the environment variable $CLASSPATH )
  19. #    2)  lax.nl.java.launcher.main.class  (main class of LaunchAnywhere Executable)
  20. #
  21. #################################################################################################
  22.  
  23. #
  24. # Since USERENV is already set in the self-extractor, if its not set we know
  25. # this is not an installer but a separate launcher. 
  26. # USERENV is just a flag passed from use.sh.
  27. #
  28. IS_INSTALLER=''
  29. [ $USERENV ] && IS_INSTALLER=true
  30.  
  31. #
  32. # later on we might add things to the PATH, but we want to preserve the PATH
  33. # order for which VMs are the first ones found.
  34. #
  35. VM_SEARCH_PATH="$PATH"
  36.  
  37. ####################################################################################
  38. # Set some constants
  39. if [ "$1" = "LAX_VM" ]; then
  40.     lax_vm="LAX_VM"
  41.     lax_vm_value="$2"
  42.     shift 2
  43. else
  44.     lax_vm=""
  45. fi 
  46. anyVMlist="JDK_J2 D12 JRE_J2 R12 JDK_J1 JRE_J1 JDK JRE ALL" 
  47.  
  48.  
  49. ####################################################################################
  50. # Format commandline args
  51. # To overcome the problem of quoted args (with internal spaces) to the launcher
  52. # is that they get "unquoted" or separated into discreet args when they are put
  53. # on the cmdline for the application.  This following block makes  sure the stay intact
  54. overrideDefaultUIMode="false"
  55. ignoreMode="false";
  56. uimode="not set"
  57. hasSeenI="false"
  58. tmpArgs=""
  59. for arg in "$@"
  60. do
  61.     if [ "$arg" != "" ]; then
  62.         tmpArgs="$tmpArgs \"$arg\""
  63.         if [ "$arg" = "-i" -o "$arg" = "-I" ]; then
  64.             hasSeenI="true"
  65.         elif [ "$hasSeenI" = "true" ]; then
  66.             lowerArg=`echo $arg | tr "[:upper:]" "[:lower:]"`
  67.             if [ "$lowerArg" = "awt" ]; then
  68.                 uimode="awt"
  69.                 overrideDefaultUIMode="true"
  70.             elif [ "$lowerArg" = "swing" ]; then
  71.                 uimode="swing"
  72.                 overrideDefaultUIMode="true"
  73.             elif [ "$lowerArg" = "gui" ]; then
  74.                 uimode="gui"
  75.                 overrideDefaultUIMode="true"
  76.             elif [ "$lowerArg" = "console" ]; then
  77.                 uimode="console"
  78.                 overrideDefaultUIMode="true"
  79.             elif [ "$lowerArg" = "text" ]; then
  80.                 uimode="console"
  81.                 overrideDefaultUIMode="true"
  82.             elif [ "$lowerArg" = "silent" ]; then
  83.                 uimode="silent"
  84.                 overrideDefaultUIMode="true"
  85.             else
  86.                 ignoreMode="true"
  87.             fi
  88.         fi
  89.     fi
  90. done
  91. cmdLineArgs="$tmpArgs"
  92. thisScript="$0"
  93. # make sure thisScript is an abs path
  94. case $thisScript in
  95.     /*)
  96.     ;;
  97.     *)
  98.         thisScript="`pwd`/$thisScript"
  99.     ;;
  100. esac
  101.  
  102. ####################################################################################
  103. #
  104. # WHere does the LAX_DEBUG output go?
  105. #
  106.  
  107. if [ "$LAX_DEBUG" = "file" ]; then
  108.     jx_log="`pwd`/jx.log"
  109.     rm -f "$jx_log"
  110.     touch "$jx_log"
  111.     if [ "$?" -gt "0" ]; then
  112.         jx_log_ok="false"
  113.         echo "Could not create $jx_log.  Sending debug output to console."
  114.     else 
  115.         jx_log_ok="true"
  116.     fi
  117. fi
  118.  
  119. debugOut()
  120. {
  121.     case "$LAX_DEBUG" in
  122.         "file" ) 
  123.             if [ "$jx_log_ok" = "true" ]; then
  124.                 echo "$1" >> "$jx_log"
  125.             else
  126.                 echo "$1"
  127.             fi
  128.         ;;
  129.         ""     )
  130.             echo "$1" >> /dev/null
  131.         ;;
  132.         *      )
  133.             echo "$1"
  134.         ;;
  135.     esac
  136. }
  137.  
  138. ####################################################################################
  139. #
  140. # UNIX ENVIRONMENT configuration
  141. #
  142. debugOut ""
  143. debugOut "========= Analyzing UNIX Environment ================================="
  144.  
  145.  
  146. # Get os type , note that it is LOWER-CASED.  Used here and later on
  147. osName=`uname -s 2> /dev/null | tr "[:upper:]" "[:lower:]" 2> /dev/null`
  148. debugOut "Setting UNIX ($osName) flavor specifics."
  149. vmScript=".java_wrapper"
  150. case "$osName" in
  151.     *irix*)
  152.         cpuName="unknown"
  153.     ;;
  154.     *hp-ux*|*hpux*)
  155.         cpuName=`uname -m 2> /dev/null`
  156.     ;;
  157.     *solaris*|*sunos*)
  158.         cpuName=`uname -p 2> /dev/null`
  159.         THREADS_FLAG="";    export THREADS_FLAG 
  160.         PATH=/usr/bin:$PATH;    export PATH
  161.     ;;
  162.     *aix*)
  163.         cpuName="unknown"
  164.     ;;
  165.     *freebsd*)
  166.         cpuName=`uname -p 2> /dev/null`
  167.     ;;
  168.     *linux*)
  169.         cpuName=`uname -m 2> /dev/null`
  170.     ;;
  171.     # tlb 2001-09-18 updating to support Darwin
  172.     *rhapsody*|*darwin*)
  173.         cpuName=`uname -p 2> /dev/null`
  174.         vmScript=".java_command"
  175.     ;;
  176.     *compaq*|*dg*|*osf*)
  177.         cpuName="unknown"
  178.     ;;
  179.     *)
  180.         cpuName="unknown"
  181.     ;;
  182. esac
  183.  
  184.  
  185. if [ -x /bin/ls ]; then
  186.     lsCMD="/bin/ls"
  187. elif [ -x /usr/bin/ls ]; then
  188.     lsCMD="/usr/bin/ls"
  189. else
  190.     lsCMD="ls"
  191. fi
  192.  
  193. debugOut "Importing UNIX environment into LAX properties."
  194.  
  195. ####################################################################################
  196. # CREATE ENV.PROPERTIES and figure out if this is being exec'd from an installer
  197. #
  198. # We need POSIX awk. On some systems it's called awk, on others
  199. # nawk. It's most frequently called nawk, so start with that.
  200. #
  201. debugOut "Checking for POSIX awk."
  202.   
  203. AWK=nawk
  204. ( $AWK '{}' ) < /dev/null 2>&0 || AWK=awk
  205.  
  206.  
  207. if [ -z "$envPropertiesFile" ]
  208. then
  209.     if [ -d /tmp ]
  210.     then
  211.         envPropertiesFile=/tmp/env.properties.$$
  212.     else
  213.         envPropertiesFile="$HOME/env.properties.$$"
  214.     fi
  215. fi
  216.  
  217. #
  218. # Convert environment variables to LAX properties. The variables
  219. # are also named with alternate case (all upper, all lower).
  220. #
  221. # E.g.
  222. #     export My_Env_Var="abc
  223. #     def"
  224. #
  225. # is converted to:
  226. #     lax.nl.env.exact_case.My_Env_Var=abc def
  227. #     lax.nl.env.MY_ENV_VAR=abc def
  228. #     lax.nl.env.my_env_var=abc def
  229. #
  230. # The second gsub() is used to escape backslashes so that when the properties 
  231. # file is read by the java.util.Properties object, there is not a problem
  232. # with incorrectly interpreted escaped unicode.
  233. #
  234. # This code segment is written in POSIX awk for performance reasons.
  235. #
  236.   
  237. $AWK -v LAX_PREFIX=lax.nl.env. '
  238. END { 
  239.     for (var in ENVIRON) 
  240.     {
  241.         # get variable value
  242.         value = ENVIRON[var]
  243.  
  244.         # strip newlines
  245.         gsub(/\n/, " ", value)
  246.   
  247.         # convert one backslash to two
  248.         gsub(/\\/, "\\\\", value)
  249.   
  250.         # print as LAX property
  251.         print LAX_PREFIX "exact_case." var "=" value
  252.         print LAX_PREFIX tolower(var) "=" value
  253.         print LAX_PREFIX toupper(var) "=" value
  254.     }
  255. }' < /dev/null > $envPropertiesFile
  256.  
  257.  
  258.  
  259. ####################################################################################
  260. #
  261. # Tracing symbolic links to actual launcher location
  262. #
  263.  
  264. resolveLink()
  265. {
  266.     rl_linked="true"
  267.     rl_operand="$1"
  268.     rl_origDir="`dirname "$1"`"
  269.  
  270.     # bypass the whole thing if this isnt a link
  271.     rl_ls=`$lsCMD -l "$rl_operand"`
  272.     case "$rl_ls" in
  273.         *"->"*)
  274.         ;;
  275.         *)
  276.             resolvedLink="$rl_operand"
  277.             return
  278.         ;;
  279.     esac 
  280.     
  281.     while [ "$rl_linked" = "true" ]; do
  282.         # if the operand is not of an abs path, get its abs path
  283.         case "$rl_operand" in
  284.             /*)
  285.                 rl_origDir=`dirname "$rl_operand"`
  286.             ;;
  287.             \./*)
  288.                 rl_origDir=`pwd`
  289.                 rl_operand="$rl_origDir/$rl_operand"
  290.             ;;
  291.             *)
  292.                 rl_operand="$rl_origDir/$rl_operand"
  293.             ;;
  294.         esac
  295.         #
  296.         # the prevPrev hack is here because .../java often points to .java_wrapper.
  297.         # at the end of the resolution rl_operand actually points to garbage
  298.         # signifying it is done resolving the link.  So prev is actually .java_wrapper.
  299.         # but we want the one just before that, its the real vm starting poiint we want
  300.         #
  301.         rl_prevOperand="$rl_operand"
  302.         rl_ls=`$lsCMD -l "$rl_operand"`
  303.         # get the output ls into a list
  304.         set x $rl_ls
  305.         # get rid of x and file info from ls -l
  306.         shift 9
  307.         
  308.         #is this a link?
  309.         case "$rl_ls" in
  310.             *"->"*)
  311.                 rl_linked="true"
  312.                 # is a link, shift past the "->"
  313.                 rl_linker=""
  314.                 while [ "$1" != "->" -a $# -gt 1 ]; do
  315.                     rl_linker="$rl_linker $1"
  316.                     shift
  317.                 done
  318.     
  319.                 if [ "$1" = "->" ]; then
  320.                     shift
  321.                 fi
  322.             ;;
  323.             *)
  324.                 # not a link, the rest must be the targets name
  325.                 rl_linked="false"
  326.             ;;
  327.         esac
  328.         # now grab what's left 
  329.         rl_linkee="$*"
  330.  
  331.         # debugOut "Following link to LAX $rl_linker -> $rl_linkee"
  332.  
  333.         if [ "$rl_linked" = "true" -a "`basename "$rl_linkee"`" != "$vmScript" ]; then
  334.             # set to true incase the thing linked to is also a link and we can
  335.             # try again.  The current think linked to now becomes the operand
  336.             rl_operand="$rl_linkee"
  337.             # if the linkee is not abs, make it abs relative to the linker
  338.             case "$rl_operand" in
  339.                 /*)
  340.                 ;;
  341.                 *)
  342.                     rl_operand="$rl_origDir/$rl_operand"
  343.                 ;;
  344.             esac
  345.         else
  346.             # otherwise, this operand is not a link itself and we are done
  347.             rl_resolvedLink="$rl_prevOperand"
  348.             # however, do not resolve the last leg of a VMs linked scripts. this will
  349.             # disrupt their scripts.  it is expecting a link to the .java* script
  350.             # let us believe it is not linked and continue on...
  351.             if [ "`basename "$rl_linkee"`" = "$vmScript" ]; then
  352.                 rl_linked="false"
  353.             fi
  354.         fi
  355.         # make sure the path returned is absolute
  356.         case "$rl_operand" in
  357.             \.\/*)
  358.                 rl_operand="`pwd`/$rl_operand"
  359.             ;;
  360.         esac
  361.     done
  362.  
  363.     # remove "/./" in paths, make it "/"
  364.     # i,e,  "/a/b/./c" becomes "/a/b/c"
  365.     resolvedLink=`echo "$rl_resolvedLink" |  sed 's,/\./,/,'`
  366. }
  367.  
  368. ####################################################################################
  369. #
  370. #  FINDING THE LAX FILE
  371. #
  372. # If this is an installer, use $seLaxPath
  373. #
  374. debugOut ""
  375. debugOut "========= Analyzing LAX =============================================="
  376. olddir=`pwd`
  377. resolveLink "$thisScript"
  378. absLauncherName="$resolvedLink"
  379. cd "`dirname "$absLauncherName"`"
  380. if [ "$IS_INSTALLER" != "" ]; then
  381.     if [ ! -z "$seLaxPath" ]; then
  382.         propfname="$seLaxPath"
  383.     else
  384.         # legacy for old self-extractors
  385.         propfname="$templaxpath"
  386.     fi 
  387. else
  388.     propfname="$absLauncherName.lax"
  389. fi
  390.  
  391.  
  392. if [ ! -r "$propfname" ]; then
  393.     debugOut "The file "$propfname" could"
  394.     debugOut "not be found, and the program cannot be run without it."
  395.     debugOut "Try reinstalling the program."
  396.     exit;
  397. else 
  398.     debugOut "LAX found............................ OK."
  399. fi
  400.  
  401.  
  402. ####################################################################################
  403. # READING THE LAX FILE
  404. #
  405. OFS="$IFS"
  406. # run prop file through sed calls that do:
  407. # 1. transform first '=' on a line into a control-O
  408. # 2. transform all other ='s to control-F
  409. # 3. transform control-Os back to =
  410. # this is to differentiate the lhs=rhs processing from confusing the first = from other
  411. # = that might be part of the value.  Later on those =-tranformed-to-control-Fs are
  412. # transformed back to = signs.
  413. set x `cat "$propfname" | sed -e 's~^\([^\=]*\)\=\(.*\)~\1\\2~g' -e 's~=~~g' -e 's~~=~g' | grep '='`; shift
  414.  
  415. while test $# -gt 0; do
  416.     # line separator
  417.     case "x${1}x" in
  418.         *"="* ) BIFS=" "; ;;
  419.         *     ) BIFS="" ; ;;
  420.     esac
  421.     # word separator
  422.     case "x${2}x" in
  423.         *"="* ) AIFS=""; ;;
  424.         *     ) AIFS=""; ;;
  425.     esac
  426.     INPUT="$INPUT$BIFS$1$AIFS"
  427.     shift
  428. done
  429.  
  430. while test "x$INPUT" != "x"; do
  431.     set x $INPUT; shift
  432.     X="$1"
  433.     shift
  434.     INPUT="$@" 
  435.     IFS="=$AIFS"
  436.     set x $X; shift
  437.     IFS="$OFS"
  438.  
  439.     lhs="${1}"
  440.     shift
  441.     rhs="$@"
  442.  
  443.     # transform non lhs=rhs delimiting = signs back from ^F to =
  444.     case "$rhs" in
  445.         **)
  446.         rhs=`echo $rhs | sed 's~~=~g'`
  447.         ;;
  448.     esac
  449.  
  450.     # assing the values
  451.     case $lhs in
  452.         lax.class.path*)
  453.             lax_class_path="$rhs"
  454.         ;;
  455.         lax.main.class*)
  456.             lax_main_class="$rhs"
  457.         ;;
  458.         lax.nl.java.launcher.main.class*)
  459.             lax_nl_java_launcher_main_class="$rhs"
  460.         ;;
  461.         lax.nl.current.vm*)
  462.             lax_nl_current_vm="$rhs"
  463.         ;;
  464.         lax.user.dir*)
  465.             lax_user_dir="$rhs"
  466.             lax_user_dir=`echo $lax_user_dir | sed 's;^[ ]*\(.*\)[ ]*$;\1;'`
  467.         ;;
  468.         lax.resource.dir*)
  469.             lax_resource_dir="$rhs"
  470.             lax_resource_dir=`echo $lax_resource_dir | sed 's;^[ ]*\(.*\)[ ]*$;\1;'`
  471.         ;;
  472.         lax.stdout.redirect*)
  473.             lax_stdout_redirect="$rhs"
  474.         ;;
  475.         lax.stderr.redirect*)
  476.             lax_stderr_redirect="$rhs"
  477.         ;;
  478.         lax.dir*)
  479.             lax_dir="$rhs"
  480.         ;;
  481.         lax.always.ask*)
  482.             lax_always_ask="$rhs"
  483.         ;;
  484.         lax.application.name*)
  485.             lax_application_name="$rhs"
  486.         ;;
  487.         lax.nl.message.vm.not.loaded*)
  488.             lax_nl_message_vm_loaded="$rhs"
  489.         ;;
  490.         lax.nl.valid.vm.list*)
  491.             # transform an blank value to "ALL"
  492.             case "$rhs" in
  493.                 "") rhs="ALL"; ;;
  494.             esac
  495.             lax_nl_valid_vm_list="$rhs"
  496.         ;;
  497.         lax.nl.java.option.check.source*)
  498.             verify="$rhs"
  499.         ;;
  500.         lax.nl.java.option.verify.mode*)
  501.             verify_mode="$rhs"
  502.         ;;
  503.         lax.nl.java.option.verbose*)
  504.             verbo="$rhs"
  505.         ;;
  506.         lax.nl.java.option.garbage.collection.extent*)
  507.             gcxtnt="$rhs"
  508.         ;;
  509.         lax.nl.java.option.garbage.collection.background.thread*)
  510.             gcthrd="$rhs"
  511.         ;;
  512.         lax.nl.java.option.native.stack.size.max*)
  513.             nsmax="$rhs"
  514.         ;;
  515.         lax.nl.java.option.java.stack.size.max*)
  516.             jsmax="$rhs"
  517.         ;;
  518.         lax.nl.java.option.java.heap.size.max*)
  519.             jhmax="$rhs"
  520.         ;;
  521.         lax.nl.java.option.java.heap.size.initial*)
  522.             jhinit="$rhs"
  523.         ;;
  524.         lax.nl.java.option.debugging*)
  525.             debug="$rhs"
  526.         ;;
  527.         lax.nl.$osName.$cpuName.java.compiler*)
  528.             lax_nl_osname_cpuname_java_compiler="$rhs"
  529.         ;;
  530.         lax.nl.$osName.java.compiler*)
  531.             lax_nl_osname_java_compiler="$rhs"
  532.         ;;
  533.         lax.nl.java.compiler*)
  534.             lax_nl_java_compiler="$rhs"
  535.         ;;
  536.         lax.nl.java.option.additional*)
  537.             lax_nl_java_option_additional="$rhs"
  538.         ;;
  539.         ######################################################
  540.         # tlb 2001-09-18
  541.         # Reading default UI mode for UNIX
  542.         lax.installer.unix.ui.default*)
  543.             lax_installer_unix_ui_default="$rhs"
  544.         ;;        
  545.         ######################################################
  546.         # JIT overrides
  547.         lax.nl.unix.JDK_J1.java.compiler*)
  548.             lax_nl_unix_JDK_J1_java_compiler="$rhs"
  549.         ;;
  550.         lax.nl.unix.JDK_J2.java.compiler*)
  551.             lax_nl_unix_JDK_J2_java_compiler="$rhs"
  552.         ;;
  553.         lax.nl.unix.JRE_J1.java.compiler*)
  554.             lax_nl_unix_JRE_J1_java_compiler="$rhs"
  555.         ;;
  556.         lax.nl.unix.JRE_J2.java.compiler*)
  557.             lax_nl_unix_JRE_J2_java_compiler="$rhs"
  558.         ;;
  559.         lax.nl.unix.J1.java.compiler*)
  560.             lax_nl_unix_J1_java_compiler="$rhs"
  561.         ;;
  562.         lax.nl.unix.J2.java.compiler*)
  563.             lax_nl_unix_J2_java_compiler="$rhs"
  564.         ;;
  565.         lax.nl.unix.JRE.java.compiler*)
  566.             lax_nl_unix_JRE_java_compiler="$rhs"
  567.         ;;
  568.         lax.nl.unix.JDK.java.compiler*)
  569.             lax_nl_unix_JDK_java_compiler="$rhs"
  570.         ;;
  571.         lax.nl.unix.ALL.java.compiler*)
  572.             lax_nl_unix_ALL_java_compiler="$rhs"
  573.         ;;
  574.         #
  575.         lax.nl.JDK_J1.java.compiler*)
  576.             lax_nl_JDK_J1_java_compiler="$rhs"
  577.         ;;
  578.         lax.nl.JDK_J2.java.compiler*)
  579.             lax_nl_JDK_J2_java_compiler="$rhs"
  580.         ;;
  581.         lax.nl.JRE_J1.java.compiler*)
  582.             lax_nl_JRE_J1_java_compiler="$rhs"
  583.         ;;
  584.         lax.nl.JRE_J2.java.compiler*)
  585.             lax_nl_JRE_J2_java_compiler="$rhs"
  586.         ;;
  587.         lax.nl.J1.java.compiler*)
  588.             lax_nl_J1_java_compiler="$rhs"
  589.         ;;
  590.         lax.nl.J2.java.compiler*)
  591.             lax_nl_J2_java_compiler="$rhs"
  592.         ;;
  593.         lax.nl.JRE.java.compiler*)
  594.             lax_nl_JRE_java_compiler="$rhs"
  595.         ;;
  596.         lax.nl.JDK.java.compiler*)
  597.             lax_nl_JDK_java_compiler="$rhs"
  598.         ;;
  599.         lax.nl.ALL.java.compiler*)
  600.             lax_nl_ALL_java_compiler="$rhs"
  601.         ;;
  602.         #
  603.         lax.nl.$osName.JDK_J1.java.compiler*)
  604.             lax_nl_osname_JDK_J1_java_compiler="$rhs"
  605.         ;;
  606.         lax.nl.$osName.JDK_J2.java.compiler*)
  607.             lax_nl_osname_JDK_J2_java_compiler="$rhs"
  608.         ;;
  609.         lax.nl.$osName.JRE_J1.java.compiler*)
  610.             lax_nl_osname_JRE_J1_java_compiler="$rhs"
  611.         ;;
  612.         lax.nl.$osName.JRE_J2.java.compiler*)
  613.             lax_nl_osname_JRE_J2_java_compiler="$rhs"
  614.         ;;
  615.         lax.nl.$osName.J1.java.compiler*)
  616.             lax_nl_osname_J1_java_compiler="$rhs"
  617.         ;;
  618.         lax.nl.$osName.J2.java.compiler*)
  619.             lax_nl_osname_J2_java_compiler="$rhs"
  620.         ;;
  621.         lax.nl.$osName.JRE.java.compiler*)
  622.             lax_nl_osname_JRE_java_compiler="$rhs"
  623.         ;;
  624.         lax.nl.$osName.JDK.java.compiler*)
  625.             lax_nl_osname_JDK_java_compiler="$rhs"
  626.         ;;
  627.         lax.nl.$osName.ALL.java.compiler*)
  628.             lax_nl_osname_ALL_java_compiler="$rhs"
  629.         ;;
  630.         #
  631.         # JIT overrides
  632.         ######################################################
  633.     esac
  634. done
  635.  
  636. debugOut "LAX properties read.................. OK."
  637.  
  638. if [ "${lax_class_path:-""}" = "" ]; then
  639.     debugOut "The classpath specified in the LAX properties file"
  640.     debugOut "is invalid.  Try reinstalling the program."    
  641.     exit;
  642. fi
  643. if [ "${lax_nl_java_launcher_main_class:-""}" = "" ]; then
  644.     debugOut "The main class specified in the LAX properties file"
  645.     debugOut "is invalid.  Try reinstalling the program."
  646.     exit;
  647. fi
  648.  
  649. if [ ! -z "$INSTALLER_OVERRIDE_VMLIST" ]; then
  650.     lax_nl_valid_vm_list="$INSTALLER_OVERRIDE_VMLIST"
  651. fi
  652.  
  653. ###################################################
  654. # tlb 2001-09-18
  655. # Making sure the default UNIX UI mode is honored
  656. # if overrideDefaultUIMode is not set, which means no commandline
  657. # options were entered at the commandline regarding
  658. # ui mode, we will look to the LAX file to set a ui
  659. # mode. If there is no such setting in the LAX,
  660. # which would be an error, we default to GUI.
  661. if [ "$IS_INSTALLER" = "true" ]; then
  662.     if [ "$overrideDefaultUIMode" = "false" ]; then
  663.         if [ -n "$lax_installer_unix_ui_default" -a "$ignoreMode" = "false" ]; then
  664.             if [ $lax_installer_unix_ui_default = SILENT ]; then
  665.                 isSilent="true"
  666.                 cmdLineArgs="$cmdLineArgs -i SILENT"
  667.                 uimode="silent"
  668.             elif [ $lax_installer_unix_ui_default = CONSOLE ]; then
  669.                 isConsole="true"
  670.                 cmdLineArgs="$cmdLineArgs -i CONSOLE"
  671.                 uimode="console"
  672.             elif [ $lax_installer_unix_ui_default = GUI ]; then
  673. # Uncomment the following if statement and comment out the three lines after
  674. # this comment to enable failsafe operation of installers when X is missing
  675. # FAILSAFE
  676. #                if [ -z "$DISPLAY" ]; then
  677. #                    isSilent="false"
  678. #                    isConsole="true"
  679. #                    cmdLineArgs="$cmdLineArgs -i CONSOLE"
  680. #                    uimode="console"
  681. #                    debugOut "WARNING! DISPLAY variable not set. Will attempt to run installer in CONSOLE mode."
  682. #                else
  683. #                    isSilent="false"
  684. #                    isConsole="false"
  685. #                    uimode="gui"
  686. #                fi
  687. # comment the following three lines out when changing to FAILSAFE
  688.                 isSilent="false"
  689.                 isConsole="false"
  690.                 uimode="gui"
  691.             fi
  692.         fi
  693.     fi
  694. fi
  695.  
  696. ####################################################################################
  697. #
  698. # if  user.dir != .   then relative paths on the classpath will be broken.  they
  699. # are expecting the pwd to be '.' (meaning the install dir).  If user.dir is
  700. # any other directory, it will break
  701. lax_class_path=`echo "$lax_class_path" | sed 's^;^:^g'`
  702. absInstallDir=`dirname "$absLauncherName"`
  703. OFS="$IFS"
  704. IFS=":"
  705. set x $lax_class_path; shift
  706. IFS="$OFS"
  707. tmp_lcp=""
  708. while test $# -gt 0; do
  709.     case "$1" in
  710.         \/*)
  711.             if [ "$tmp_lcp" = "" ]; then
  712.                 tmp_lcp="$1"
  713.             else
  714.                 tmp_lcp="$tmp_lcp:$1"
  715.             fi
  716.         ;;
  717.         *|*\$ENV_CLASSPATH\$*)
  718.             if [ "$tmp_lcp" = "" ]; then
  719.                 tmp_lcp="${absInstallDir}/$1"
  720.             else
  721.                 tmp_lcp="$tmp_lcp:${absInstallDir}/$1"
  722.             fi
  723.         ;;
  724.     esac
  725.     shift
  726. done
  727. lax_class_path="$tmp_lcp"
  728.  
  729. # resolve $ENV_CLASSPATH$
  730. OFS="$IFS"
  731. IFS=":"
  732. set x $lax_class_path; shift
  733. IFS="$OFS"
  734. tmp_lcp=""
  735. while test $# -gt 0; do
  736.     case "$1" in
  737.         *\$ENV_CLASSPATH\$*)
  738.             if [ "$tmp_lcp" = "" ]; then
  739.                 tmp_lcp="$CLASSPATH"
  740.             else
  741.                 tmp_lcp="$tmp_lcp:$CLASSPATH"
  742.             fi
  743.         ;;
  744.         *)
  745.             if [ "$tmp_lcp" = "" ]; then
  746.                 tmp_lcp="$1"
  747.             else
  748.                 tmp_lcp="$tmp_lcp:$1"
  749.             fi
  750.         ;;
  751.     esac
  752.     shift
  753. done
  754. lax_class_path="$tmp_lcp"
  755.  
  756.  
  757.  
  758. ####################################################################################
  759. # just incase this the lax was written in DOS, be sure to make all ';' path
  760. # separators into :'s or it will fubar the commandline
  761. #
  762. case "$smclp" in
  763.     *\;*)
  764.         oldIFS=$IFS
  765.         IFS=";"
  766.         for smclp_piece in $smclp; do
  767.             tmp_smclp="$tmp_smclp:$smclp_piece"
  768.         done
  769.         IFS=$oldIFS
  770.         clp=$tmp_smclp
  771.     ;;
  772. esac
  773.  
  774. ##################################################################
  775. # Setting stdout and stderr redirection
  776. #
  777. if [ "$LAX_DEBUG" = "file" -o "$LAX_DEBUG" = "" ]; then
  778.     echo "lax.stderr.redirect=$lax_stderr_redirect" >> $envPropertiesFile
  779.     echo "lax.stdout.redirect=$lax_stdout_redirect" >> $envPropertiesFile
  780. else
  781.     echo "lax.stderr.redirect=console" >> $envPropertiesFile
  782.     echo "lax.stdout.redirect=console" >> $envPropertiesFile
  783.     lax_stdout_redirect="console"
  784.     lax_stderr_redirect="console"
  785. fi
  786.  
  787. lax_version="4.5"
  788.  
  789. validVMtypeList="$lax_nl_valid_vm_list"
  790.  
  791. # MMA 04.26.2000
  792. #
  793. # Added check for validVMtypeList not being set to any value, in
  794. # which case we should just set the valid list to all. 
  795. #
  796. if [ "$validVMtypeList" = "ALL" -o "$validVMtypeList" = "" ]; then
  797.     validVMtypeList=$anyVMlist
  798. fi
  799.  
  800.  
  801. #############################################################
  802. # PICK A VALID VM
  803. #
  804.  
  805. debugOut "" 
  806. debugOut "========= Finding VM ================================================="
  807. debugOut "Valid VM types.......................... $validVMtypeList"
  808.  
  809. #
  810. # If the vm gets a relative path, we must make it absolute to the Install
  811. #   Directory    tm 3/3
  812. #
  813. if [ ! -z "${lax_nl_current_vm:-""}" ]; then
  814.     # tlb 2001-09-18 updating the LAX to support CD-ROM installations
  815.     # the variable `expr "$lax_nl_current_vm" : '\/'` will evaluate to 1 if the path starts with /
  816.     isAbsPath=`expr "$lax_nl_current_vm" : '\/'`
  817.       if [ "$isAbsPath" = "0" ]; then
  818.         # When running a CD-ROM installer lax_dir is not set, lax_dir is set by the SEA.
  819.         # We set it to the working directory if it is not set
  820.         if [ -z "$lax_dir" ]; then
  821.             lax_dir=`pwd`
  822.             abs_lax_nl_current_vm="${lax_dir}"/"${lax_nl_current_vm}"
  823.         else
  824.             abs_lax_nl_current_vm="${lax_dir}""${lax_nl_current_vm}"
  825.         fi        
  826.     else
  827.         abs_lax_nl_current_vm="$lax_nl_current_vm"
  828.     fi
  829.     debugOut "Absolute LAX_VM path.................... $abs_lax_nl_current_vm"
  830. fi
  831.  
  832.  
  833. #################################################################################
  834. # inspectVM()
  835. #
  836. # param:      a pathname to a potential VM file, maybe a link
  837. #
  838. # returns:    $inspectedVMpath        the real path to the VM file
  839. # returns:    $inspectedVMtype        the type of the VM
  840. # returns:    $inspectedOldVMtype     ?
  841. #
  842. inspectVM()
  843. {
  844.     resolveLink "$1"
  845.  
  846.     inspectee="$resolvedLink"
  847.     inspecteeDir=`dirname "$inspectee"`
  848.     inspecteeName=`basename "$inspectee"`
  849.  
  850.     inspectedVMpath="$inspectee"
  851.  
  852.     #
  853.     # is it JDK1.1 , JDK1.2  or JRE1.2?
  854.     #
  855.     if [ "$inspecteeName" = "oldjava" ]; then
  856.         inspectedOldVMtype="OLDJAVA"
  857.         inspectedVMtype="OLDJAVA"
  858.     elif [ "$inspecteeName" = "java" ]; then
  859.  
  860.         ############################################################
  861.         # Do some OS-specific quirky stuff
  862.         #
  863.         # MacOS X / Rhapsody
  864.         #
  865.         quirk_classesZip=""
  866.         if [ "$osName" = "rhapsody" ]; then
  867.             if [ "`expr "$inspecteeDIR" : ".*JavaVM.framework$"`" != "0" ]; then
  868.                 quirk_classesZip="$file/Classes/classes.jar"
  869.                 inspecteeDir="$inspecteeDir/Home/bin"
  870.             fi
  871.         fi
  872.         # END OS quirky stuff
  873.         ############################################################
  874.  
  875.         #
  876.         # is it JDK1.1?
  877.         # 
  878.         if [ -r "$inspecteeDir/../lib/classes.zip" -o -r "$quirk_classesZip" ]; then
  879.             inspectedOldVMtype="JDK"
  880.             inspectedVMtype="JDK_J1"
  881.         else
  882.             # JDK1.2
  883.             # 
  884.             # is the "java" JRE1.2 or JDK1.2?
  885.             #
  886.             if [ -r "$inspecteeDir/../lib/dt.jar" ]
  887.             then
  888.                 inspectedOldVMtype="D12"
  889.                 inspectedVMtype="JDK_J2"
  890.             else
  891.                 inspectedOldVMtype="R12"
  892.                 inspectedVMtype="JRE_J2"
  893.             fi
  894.         fi
  895.     elif [ "$inspecteeName" = "jre" ]; then
  896.         inspectedOldVMtype="JRE"
  897.         inspectedVMtype="JRE_J1"
  898.     else
  899.         inspectedOldVMtype="UNKNOWN"
  900.         inspectedVMtype="UNKNOWN"
  901.     fi
  902. }
  903. ###
  904. ### end inspectVM()
  905. ###
  906. ########################################################################################
  907.  
  908.  
  909. # massage valid VM list.  Expand inclusive types (i.e. JRE = JRE_J1 and JRE_J2 )
  910. tmpValidVMlist=""
  911. for type in $validVMtypeList; do
  912.     case $type in
  913.         J1)        tmpValidVMlist="$tmpValidVMlist JRE_J1 JDK_J1" ;;
  914.         J2)        tmpValidVMlist="$tmpValidVMlist JRE_J2 JDK_J2" ;;
  915.         JRE)    tmpValidVMlist="$tmpValidVMlist JRE_J2 R12 JRE_J1" ;;
  916.         JDK)    tmpValidVMlist="$tmpValidVMlist JDK_J2 D12 JDK_J1" ;;
  917.         *)        tmpValidVMlist="$tmpValidVMlist $type " ;;
  918.     esac
  919. done
  920. validVMtypeList="$tmpValidVMlist"
  921. debugOut "Expanded Valid VM types................. $validVMtypeList"
  922.  
  923. # if a VM was forced on the command line use it otherwise search
  924. if [ "$lax_vm" = "LAX_VM" ]; then
  925.     # Using VM passed in as argument
  926.     inspectVM "$lax_vm_value"
  927.     actvmType="$inspectedVMtype"
  928.     actvm="$lax_vm_value"
  929.     debugOut "* Using VM:.........(LAX_VM)............ $actvm"
  930. else
  931.     # 1st inspect the  lax.nl.current.vm.  As long as it is in the
  932.     # valid vm list it takes precedence over everything else.  
  933.     laxVMisValid="false"
  934.     # is the lax current vm is specifies
  935.     if [ ! -z "$abs_lax_nl_current_vm" -a -x "$abs_lax_nl_current_vm" ]; then
  936.         # inspect it
  937.         inspectVM "$abs_lax_nl_current_vm"
  938.         eval laxVMtype="$inspectedVMtype"
  939.         # if the type of this vm is in the valid list, deem it valid
  940.  
  941.         case "$validVMtypeList" in
  942.             *$laxVMtype*)
  943.                 laxVMisValid="true"
  944.             ;;
  945.         esac
  946.     fi
  947.     # if the lax current vm is valid use it
  948.      overwriteLaxVM="true"
  949.     if [ "$laxVMisValid" = "true" ]; then
  950.         # dont overwrite the lax.nl.current.vm  if this one works just fine
  951.         overwriteLaxVM="false"
  952.         actvm="$abs_lax_nl_current_vm"
  953.         actvmType="$laxVMtype"
  954.         debugOut "* Using VM.....(lax.nl.current.vm)...... $actvm"
  955.     else    
  956.     # other wise search the path
  957.         debugOut "WARNING! No valid lax.nl.current.vm available."
  958.         # overwrite the lax.nl.current.vm  if the one in there didnt work
  959.         overwriteLaxVM="true"
  960.  
  961.         # sift through the path to look for VMs
  962.  
  963.         # unique the PATH to limit the amount of work; see bug #6285.
  964.         uniquedPath=`echo $VM_SEARCH_PATH | tr ':' '\012' | sort | uniq`
  965.  
  966.         vmNumber=0;
  967.         OFS="$IFS"
  968.         IFS=":"
  969.         set x $uniquedPath; shift
  970.         IFS="$OFS"
  971.         debugOut "Searching for VMs in PATH:"
  972.         for pathDir in $*; do
  973.             debugOut "Looking in:............................. $pathDir"
  974.             # For each type of binary vm name
  975.             for binaryName in java jre oldjava; do
  976.  
  977.                 vmPath="$pathDir/$binaryName"
  978.  
  979.                 # if the binary exists, is executable and is not a directory...
  980.                 if [ -x "$vmPath" -a \( ! -d "$vmPath" \) ]; then
  981.                     debugOut "  Found VM:............................. $vmPath"
  982.                     inspectVM "$vmPath"
  983.                     # set up a Bourne-style array of VM props using var1, var2, etc...
  984.                     eval vmBinary$vmNumber="$inspectedVMpath"
  985.                     eval vmType$vmNumber="$inspectedVMtype"
  986.                     eval oldVMtype$vmNumber="$inspectedOldVMtype"
  987.                     vmNumber=`expr ${vmNumber:-0} + 1`
  988.                 fi
  989.             done
  990.         done
  991.     
  992.         #########################################
  993.         # VERIFY VMS against valid types
  994.         #
  995.         actvmType=""
  996.         vmHighNumber="$vmNumber"
  997.  
  998.         # for each type of valid VM
  999.         for validType in $validVMtypeList; do
  1000.             vmNumber="0";
  1001.  
  1002.             # run through the list of VMs found
  1003.             while [ "$vmNumber" -lt $vmHighNumber ]; do
  1004.                 eval type="$"vmType$vmNumber""
  1005.                 eval oldType="$"oldVMtype$vmNumber""
  1006.                 eval  bin="$"vmBinary$vmNumber""
  1007.         
  1008.                 # if the type of this VM is of '$type' or '$oldType'
  1009.                 # make it the actual vm (actvm) to use
  1010.                 case "${type} ${oldType}" in
  1011.                     *${validType}*)
  1012.         
  1013.                         actvm="$bin"
  1014.                         actvmType="$type"
  1015.                         debugOut "* Using VM:............................. $actvm"
  1016.                         break 2
  1017.                     ;;
  1018.                 esac
  1019.                 vmNumber=`expr ${vmNumber:-0} + 1`
  1020.             done
  1021.         done    
  1022.     fi
  1023. fi
  1024.  
  1025. # If no VMs are found in path
  1026. if [ -z "$actvm" ]
  1027. then
  1028.     echo "No Java virtual machine could be found from your PATH"
  1029.     echo "environment variable.  You must install a VM prior to"
  1030.     echo "running this program."
  1031.     
  1032.     # Mikey [5/16/2000] -- If this was SEA'd then remove the temp directory
  1033.     if [ "$IS_INSTALLER" = "true" ]; then
  1034.         debugOut "Removing temporary installation directory: \"$lax_user_dir\""
  1035.         rm -rf "$lax_user_dir"
  1036.     fi
  1037.     
  1038.     cd "$olddir"
  1039.     exit
  1040. fi
  1041.  
  1042. # noLaxBackup is true for self-extractor, and the current vm should not
  1043. # be changed if the LAX_VM tag is used
  1044. noLaxBackup=${noLaxBackup:="false"}
  1045. if [ "$overwriteLaxVM" = "true" -a "$lax_vm" != "LAX_VM" -a "$noLaxBackup" != "true" -a \
  1046.  -w "$propfname" ]
  1047. then
  1048.     sedscript="s;^lax.nl.current.vm.*;lax.nl.current.vm=$actvm;"
  1049.     sed $sedscript "$propfname">file.lax 
  1050.     mv "$propfname" "$propfname.bak" > /dev/null 2>&1
  1051.     mv file.lax "$propfname" > /dev/null 2>&1
  1052.     rm "$propfname.bak" > /dev/null 2>&1
  1053. fi
  1054.  
  1055. # set up a variable to esilty know if we are going to run 1.1 or 1.2 
  1056. # for setting up VM cmd line options later on
  1057. case "$actvmType" in
  1058.     "JRE" | "JDK" | "JRE_J1" | "JDK_J1" )
  1059.         actvmVersion="1.1"
  1060.     ;;
  1061.     "R12" | "D12" | "JDK_J2" | "JRE_J2" | "OLDJAVA")
  1062.         actvmVersion="1.2"
  1063.     ;;
  1064.     *)
  1065.         actvmVersion=""
  1066.     ;;
  1067. esac
  1068.  
  1069. # is this a HotSpot (tm) VM?
  1070. \"$actvm\" -version 2>&1 | grep -i hotspot > /dev/null 2>&1
  1071. if [ $? -eq 0 ]; then
  1072.     actvmIsHotSpot="true";
  1073.     debugOut "Current VM is a HotSpot VM"
  1074. else
  1075.     actvmIsHotSpot="false";
  1076.     debugOut "Current VM is NOT a HotSpot VM"
  1077. fi
  1078.  
  1079. #
  1080. # end of finding VMs
  1081. ##########################################################################################
  1082.  
  1083. ####################################################################################
  1084. # Determining VM invocation options to use
  1085. #
  1086.  
  1087. #
  1088. # Verification
  1089. #
  1090. if [ "$actvmVersion" = "1.1" ]; then
  1091.     if [ "$verify" = "off" ]; then
  1092.         options="$options -noverify"
  1093.     else
  1094.         if [ "$verify_mode" = "remote" ]; then
  1095.             options="$options -verifyremote"
  1096.         elif [ "$verify_mode" = "none" ]; then
  1097.             options="$options -noverify"
  1098.         elif [ "$verify_mode" = "all" ]; then
  1099.             options="$options -verify"
  1100.         fi
  1101.     fi
  1102. fi
  1103.  
  1104. verbo=${verbo:="none"}
  1105. if [ $verbo = "normal" ]; then
  1106.     if [ "$actvmVersion" = "1.1" ]; then
  1107.         options="$options -verbose"
  1108.     elif [ "$actvmVersion" = "1.2" ]; then
  1109.         options="$options -verbose:class"
  1110.     fi
  1111. elif [ $verbo = "all" ]; then
  1112.     if [ "$actvmVersion" = "1.1" ]; then
  1113.         options="$options -verbose -verbosegc"
  1114.     elif [ "$actvmVersion" = "1.2" ]; then
  1115.         options="$options -verbose:class -verbose:gc"
  1116.     fi
  1117. elif [ $verbo = "gc" ]; then
  1118.     if [ "$actvmVersion" = "1.1" ]; then
  1119.         options="$options -verbosegc"
  1120.     elif [ "$actvmVersion" = "1.2" ]; then
  1121.         options="$options -verbose:gc"
  1122.     fi    
  1123. fi
  1124.  
  1125. #
  1126. # Memory mgnt
  1127. #
  1128. gcxtnt=${gcxtnt:="none"}
  1129. if [ $gcxtnt = "min" ]
  1130. then
  1131.     if [ "$actvmVersion" = "1.1" ]; then
  1132.         options="$options -noclassgc"
  1133.     elif [ "$actvmVersion" = "1.2" ]; then
  1134.         options="$options -Xnoclassgc"
  1135.     fi
  1136. fi
  1137.  
  1138. gcthrd=${gcthrd:="none"}
  1139. if [ "$actvmVersion" = "1.1" ]; then
  1140.     if [ $gcthrd = "off" ]
  1141.     then
  1142.         options="$options -noasyncgc"
  1143.     fi
  1144. fi
  1145.  
  1146.  
  1147. nsmax=${nsmax:="none"}
  1148. if [ "$nsmax" != "none" ]; then
  1149.         if [ "$actvmVersion" = "1.1" ]; then
  1150.                 options="$options -ss$nsmax"
  1151.         elif [ "$actvmVersion" = "1.2" ]; then
  1152.                 options="$options -Xss$nsmax"
  1153.         fi
  1154. fi
  1155.  
  1156. jsmax=${jsmax:="none"}
  1157. if [ "$jsmax" != "none" ]; then
  1158.         if [ "$actvmVersion" = "1.1" ]; then
  1159.                 options="$options -oss$jsmax"
  1160.         elif [ "$actvmVersion" = "1.2" ]; then
  1161.                 options="$options -Xoss$jsmax"
  1162.         fi
  1163. fi
  1164.  
  1165.  
  1166. jhmax=${jhmax:="none"}
  1167. if [ "$jhmax" != "none" ]; then
  1168.     if [ "$actvmVersion" = "1.1" ]; then
  1169.         options="$options -mx$jhmax"
  1170.     elif [ "$actvmVersion" = "1.2" ]; then
  1171.         options="$options -Xmx$jhmax"
  1172.     fi
  1173. fi
  1174.  
  1175. jhinit=${jhinit:="none"}
  1176. if [ "$jhinit" != "none" ]; then
  1177.     if [ "$actvmVersion" = "1.1" ]; then
  1178.         options="$options -ms$jhinit"
  1179.     elif [ "$actvmVersion" = "1.2" ]; then
  1180.         options="$options -Xms$jhinit"
  1181.     fi
  1182. fi
  1183.  
  1184. debug=${debug:-"off"}
  1185. if [ $debug != "off" ]; then
  1186.     if [ "$actvmVersion" = "1.1" ]; then
  1187.         options="$options -debug"
  1188.     elif [ "$actvmVersion" = "1.2" ]; then
  1189.         options="$options -Xdebug"
  1190.     fi
  1191. fi
  1192.  
  1193. ###############################################################
  1194. # JIT options
  1195. # Resetting java home and JIT compiler environment variables
  1196. #
  1197. jitOnOrOff=on;
  1198. #
  1199. # turn off according to VM type
  1200. #
  1201. if   [ ! -z "$lax_nl_osname_JDK_J1_java_compiler" -a "$actvmType" = "JDK_J1" ]; then
  1202.     jitOnOrOff=$lax_nl_osname_JDK_J1_java_compiler
  1203. elif [ ! -z "$lax_nl_osname_JDK_J2_java_compiler" -a "$actvmType" = "JDK_J2" ]; then
  1204.     jitOnOrOff=$lax_nl_osname_JDK_J2_java_compiler
  1205. elif [ ! -z "$lax_nl_osname_JRE_J1_java_compiler" -a "$actvmType" = "JRE_J1" ]; then
  1206.     jitOnOrOff=$lax_nl_osname_JRE_J1_java_compiler
  1207. elif [ ! -z "$lax_nl_osname_JRE_J2_java_compiler" -a "$actvmType" = "JRE_J2" ]; then
  1208.     jitOnOrOff=$lax_nl_osname_JRE_J2_java_compler
  1209. elif [ ! -z "$lax_nl_osname_J1_java_compiler" -a "$actvmType" = "J1" ]; then
  1210.     jitOnOrOff=$lax_nl_osname_J1_java_compiler
  1211. elif [ ! -z "$lax_nl_osname_J2_java_compiler" -a "$actvmType" = "J2" ]; then
  1212.     jitOnOrOff=$lax_nl_osname_J2_java_compiler
  1213. elif [ ! -z "$lax_nl_osname_JRE_java_compiler" -a "$actvmType" = "JRE" ]; then
  1214.     jitOnOrOff=$lax_nl_osname_JRE_java_compiler
  1215. elif [ ! -z "$lax_nl_osname_JDK_java_compiler" -a "$actvmType" = "JDK" ]; then
  1216.     jitOnOrOff=$lax_nl_osname_JDK_java_compiler
  1217. elif [ ! -z "$lax_nl_osname_ALL_java_compiler" ]; then
  1218.     jitOnOrOff=$lax_nl_osname_ALL_java_compiler
  1219. #
  1220. elif [ ! -z "$lax_nl_unix_JDK_J1_java_compiler" -a "$actvmType" = "JDK_J1" ]; then
  1221.     jitOnOrOff=$lax_nl_unix_JDK_J1_java_compiler
  1222. elif [ ! -z "$lax_nl_unix_JDK_J2_java_compiler" -a "$actvmType" = "JDK_J2" ]; then
  1223.     jitOnOrOff=$lax_nl_unix_JDK_J2_java_compiler
  1224. elif [ ! -z "$lax_nl_unix_JRE_J1_java_compiler" -a "$actvmType" = "JRE_J1" ]; then
  1225.     jitOnOrOff=$lax_nl_unix_JRE_J1_java_compiler
  1226. elif [ ! -z "$lax_nl_unix_JRE_J2_java_compiler" -a "$actvmType" = "JRE_J2" ]; then
  1227.     jitOnOrOff=$lax_nl_unix_JRE_J2_java_compler
  1228. elif [ ! -z "$lax_nl_unix_J1_java_compiler" -a "$actvmType" = "J1" ]; then
  1229.     jitOnOrOff=$lax_nl_unix_J1_java_compiler
  1230. elif [ ! -z "$lax_nl_unix_J2_java_compiler" -a "$actvmType" = "J2" ]; then
  1231.     jitOnOrOff=$lax_nl_unix_J2_java_compiler
  1232. elif [ ! -z "$lax_nl_unix_JRE_java_compiler" -a "$actvmType" = "JRE" ]; then
  1233.     jitOnOrOff=$lax_nl_unix_JRE_java_compiler
  1234. elif [ ! -z "$lax_nl_unix_JDK_java_compiler" -a "$actvmType" = "JDK" ]; then
  1235.     jitOnOrOff=$lax_nl_unix_JDK_java_compiler
  1236. elif [ ! -z "$lax_nl_unix_ALL_java_compiler" ]; then
  1237.     jitOnOrOff=$lax_nl_unix_ALL_java_compiler
  1238. #
  1239. elif [ ! -z "$lax_nl_JDK_J1_java_compiler" -a "$actvmType" = "JDK_J1" ]; then
  1240.     jitOnOrOff=$lax_nl_JDK_J1_java_compiler
  1241. elif [ ! -z "$lax_nl_JDK_J2_java_compiler" -a "$actvmType" = "JDK_J2" ]; then
  1242.     jitOnOrOff=$lax_nl_JDK_J2_java_compiler
  1243. elif [ ! -z "$lax_nl_JRE_J1_java_compiler" -a "$actvmType" = "JRE_J1" ]; then
  1244.     jitOnOrOff=$lax_nl_JRE_J1_java_compiler
  1245. elif [ ! -z "$lax_nl_JRE_J2_java_compiler" -a "$actvmType" = "JRE_J2" ]; then
  1246.     jitOnOrOff=$lax_nl_JRE_J2_java_compler
  1247. elif [ ! -z "$lax_nl_J1_java_compiler" -a "$actvmType" = "J1" ]; then
  1248.     jitOnOrOff=$lax_nl_J1_java_compiler
  1249. elif [ ! -z "$lax_nl_J2_java_compiler" -a "$actvmType" = "J2" ]; then
  1250.     jitOnOrOff=$lax_nl_J2_java_compiler
  1251. elif [ ! -z "$lax_nl_JRE_java_compiler" -a "$actvmType" = "JRE" ]; then
  1252.     jitOnOrOff=$lax_nl_JRE_java_compiler
  1253. elif [ ! -z "$lax_nl_JDK_java_compiler" -a "$actvmType" = "JDK" ]; then
  1254.     jitOnOrOff=$lax_nl_JDK_java_compiler
  1255. elif [ ! -z "$lax_nl_ALL_java_compiler" ]; then
  1256.     jitOnOrOff=$lax_nl_ALL_java_compiler
  1257. #
  1258. elif [ ! -z "$lax_nl_osname_java_compiler" ]; then
  1259.     jitOnOrOff=$lax_nl_osname_java_compiler
  1260. elif [ ! -z "$lax_nl_java_compiler" ]; then
  1261.     jitOnOrOff=$lax_nl_java_compiler
  1262. else
  1263.     jitOnOrOff=on
  1264. fi
  1265.  
  1266. # JIT is ON by default, so we only need to change its status
  1267. # the above else-if lists figures it should be OFF
  1268. if [ "$jitOnOrOff" = "off" ]; then
  1269.     if [ "$actvmVersion" = "1.1" ]; then
  1270.         case "$osName" in
  1271.             *irix*)
  1272.                 jitinvoc="-nojit"
  1273.                 JIT_OPTIONS="-nojit"
  1274.                 export JIT_OPTIONS
  1275.             ;;
  1276.             *hp-ux*|*hpux*)
  1277.                 JIT_OPTIONS="-nojit"
  1278.                 export JIT_OPTIONS
  1279.                 jitinvoc="-nojit"
  1280.             ;;
  1281.             *solaris*|*sunos*)
  1282.                 jitinvoc="-Djava.compiler="
  1283.             ;;
  1284.             *aix*)
  1285.                 JAVA_COMPILER=off
  1286.                 export JAVA_COMPILER
  1287.             ;;
  1288.             *freebsd*)
  1289.                 jitinvoc="-Djava.compiler="
  1290.             ;;
  1291.             *linux*)
  1292.                 jitinvoc="-Djava.compiler="
  1293.             ;;
  1294.             *rhapsody*|*macos*)
  1295.             ;;
  1296.             *compaq*|*dg*|*osf*)
  1297.                 jitinvoc="-nojit"
  1298.             ;;
  1299.             *)
  1300.                 debugOut "Unknown OS name (\"$osName\"). Cannot set JIT Options."
  1301.             ;;
  1302.         esac
  1303.     elif [ "$actvmVersion" = "1.2" ]; then
  1304.         jitinvoc="-Djava.compiler=NONE"
  1305.     else
  1306.         debugOut "Unknown VM version. Cannot set JIT Options."
  1307.     fi
  1308. fi
  1309.  
  1310. if [ "$actvmIsHotSpot" = "true" ];then
  1311.     jitinvoc=""
  1312. fi
  1313.  
  1314. options="$jitinvoc $options"
  1315.  
  1316. # glibc floating stack problem on Linux
  1317. if [ `uname -s` = Linux ]
  1318. then
  1319.     case `uname -r` in
  1320.     2.[456]*) 
  1321.         LD_ASSUME_KERNEL=2.2.5
  1322.         export LD_ASSUME_KERNEL
  1323.         ;;
  1324.     esac
  1325. fi
  1326.  
  1327. ##################################################################################
  1328. # LAUNCH VM
  1329.  
  1330. # Passing in addtional stuff
  1331. options="$options $lax_nl_java_option_additional"
  1332.  
  1333.  
  1334. # Changing working directory
  1335. if [ ! "$lax_user_dir" = "" ]
  1336. then
  1337.     if [ ! "$lax_user_dir" = "." ];
  1338.     then
  1339.         cd "$lax_user_dir"
  1340.     fi
  1341. else
  1342.     cd "$olddir"
  1343. fi
  1344.  
  1345. # Optional printout of all variable values for debugging purposes
  1346.  
  1347. debugOut ""
  1348. debugOut "========= Virtual Machine Options ===================================="
  1349. debugOut "LAX properties incorporated............. OK."
  1350. debugOut "classpath............................... \"$lax_class_path\""
  1351. debugOut "main class.............................. \"$lax_main_class\""
  1352. debugOut ".lax file path.......................... \"$propfname\""
  1353. debugOut "user directory.......................... \"$lax_user_dir\""
  1354. debugOut "stdout to............................... \"$lax_stdout_redirect\""
  1355. debugOut "sterr to................................ \"$lax_stderr_redirect\""
  1356. debugOut "install directory....................... \"$lax_dir\""
  1357. debugOut "JIT..................................... ${jittype:-"none"}"
  1358. debugOut "option (verify)......................... ${verify:-"none"}"
  1359. debugOut "option (verbosity)...................... ${verbo:-"none"}"
  1360. debugOut "option (garbage collection extent)...... ${gcxtnt:-"none"}"
  1361. debugOut "option (garbage collection thread)...... ${gcthrd:-"none"}"
  1362. debugOut "option (native stack max size).......... ${nsmax:-"none"}"
  1363. debugOut "option (java stack max size)............ ${jsmax:-"none"}"
  1364. debugOut "option (java heap max size)............. ${jhmax:-"none"}"
  1365. debugOut "option (java heap initial size)......... ${jhinit:-"none"}"
  1366. debugOut "option (lax.nl.java.option.additional).. ${lax_nl_java_option_additional:-"none"}"
  1367. resolveLink "$actvm"
  1368. actvm="$resolvedLink"
  1369.  
  1370. actvmBinaryName=`basename "$actvm"`
  1371. # get dirname of binary
  1372. actvmHome=`dirname "$actvm"`
  1373. # is the dir the binary is in named "bin"?
  1374. if [ "`basename "$actvmHome"`" = "bin" ]; then
  1375.     # if so then the dir above bin is the java home
  1376.     JAVA_HOME=`dirname "$actvmHome"`
  1377. else
  1378.     JAVA_HOME=
  1379. fi
  1380.  
  1381. # Making $JAVA_HOME available to the application.
  1382. export JAVA_HOME
  1383.  
  1384. # [RW] reset the locale that what we remember it to be (see use.sh line 22)
  1385. if [ "$IS_INSTALLER" = "true" ]; then
  1386.     if [ "X$OLD_LANG" = X ]
  1387.     then
  1388.          # no locale was defined prior to running this program
  1389.         unset LANG
  1390.     else
  1391.         # there was a locale: revert back to it
  1392.         LANG="$OLD_LANG"
  1393.     fi
  1394. fi
  1395.  
  1396. ###########################################################################
  1397. # tlb 2001-09-18
  1398. # Moving the checking for the DISPLAY variable down here as there are  
  1399. # options in the LAX that might override the need for checking the DISPLAY.
  1400. # Those options need loading before the check is performed.
  1401. # Also making sure we don't report an error when running on Mac OS X.
  1402.  
  1403.  
  1404. debugOut ""
  1405. debugOut "========= Display settings ==========================================="
  1406. #
  1407. # check the display
  1408. #
  1409. isRemoteDisplay="false"
  1410. if [ "$IS_INSTALLER" = "true" -a "$isConsole" = "false" -a "$isSilent" = "false" -a ! "$osName" = "darwin" ]; then
  1411.     hostname=`hostname`
  1412.     isRemoteDisplay="true"
  1413.     for display in ${hostname}:0 ${hostname}:0.0 localhost:0 localhost:0.0 unix:0 unix:0.0 :0 :0.0
  1414.     do
  1415.         if [ "$DISPLAY" = "$display" ]; then
  1416.             isRemoteDisplay="false";
  1417.         fi
  1418.     done
  1419. fi
  1420.  
  1421. xDisp="local"
  1422. if [ "$isRemoteDisplay" = "true" ]; then
  1423.     xDisp="remote"
  1424. fi
  1425. if [  -z "$DISPLAY" ]; then
  1426.     xDisp="not set"
  1427. fi
  1428. debugOut "X display............................... $xDisp"
  1429.  
  1430.  
  1431. if [ -z "$DISPLAY" -a "$uimode" = "gui" ]; then
  1432.     debugOut "WARNING:  This shell's DISPLAY variable has not been set."
  1433.     debugOut "This installer is  configured to run in GUI and will probably"
  1434.     debugOut "fail.  Try running this  installer in console or silent mode,"
  1435.     debugOut "or on another  UNIX  host which has the DISPLAY variable set,"
  1436.     debugOut "if the installer unexpectedly fails."
  1437. else
  1438.     if [ "$isRemoteDisplay" = "true" -a "$uimode" = "gui" ]; then
  1439.         debugOut "WARNING:  The name  of  this  host ($hostname) and  the setting"
  1440.         debugOut "of this  shell's DISPLAY ($DISPLAY) variable do not match."
  1441.         debugOut "If this launcher is being displayed to a Microsoft Windows desktop"
  1442.         debugOut "through X Windows the Java Virtual Machine might abort. Try running"
  1443.         debugOut "this installer locally on the target system or through X Windows to"
  1444.         debugOut "another UNIX host if the installer unexpectedly fails."
  1445.     fi
  1446. fi
  1447.  
  1448. debugOut "UI mode................................. $uimode"
  1449.  
  1450.  
  1451. # COMMENT ME TO REMOVE OUTPUT FROM NORMAL INSTALLER EXECUTION
  1452. if [ "$IS_INSTALLER" = "true" ]; then
  1453.     echo ""
  1454.     echo "Launching installer..."
  1455.     echo ""
  1456. fi
  1457.  
  1458.  
  1459. if [ "$actvmBinaryName" = "jre" ]; then
  1460.  
  1461.  
  1462.     CLASSPATH=
  1463.     export CLASSPATH
  1464.     # MMA - clear ENV to address a problem where the shell initialization
  1465.     # file (.Xshrc) pointed to by ENV may overide the classpath we have just set,
  1466.     # causing the app to fail.  Drawback is that other environment variables set
  1467.     # in the init file will not be available in the environment (they will be
  1468.     # available as Java system properties, however).  Comment out the two lines
  1469.     # below to change this behavior.
  1470.     ENV=
  1471.     export ENV
  1472.  
  1473.     # I split these up so they would be a bit clearer on the screen.
  1474.     debugOut ""
  1475.     debugOut "========= VM Command Line ============================================"
  1476.     debugOut "\"$actvm\" $options -cp \"$lax_class_path\" $lax_nl_java_launcher_main_class \"$propfname\" \"$envPropertiesFile\" $cmdLineArgs"
  1477.  
  1478.     # Here is where we actually run the app in Java:
  1479.     debugOut ""
  1480.     debugOut "========= Executing JRE =============================================="
  1481.     eval \"$actvm\" $options -cp \"$lax_class_path\" $lax_nl_java_launcher_main_class \"$propfname\" \"$envPropertiesFile\" $cmdLineArgs
  1482.     exitValue=$?
  1483.     debugOut "========= JRE Finished ==============================================="
  1484.     debugOut ""
  1485.  
  1486. elif [ "$actvmBinaryName" = "java" -o "$actvmBinaryName" = "oldjava" ]; then
  1487.  
  1488.     CLASSPATH="$lax_class_path"
  1489.       export CLASSPATH 
  1490.     # MMA - clear ENV to address a problem where the shell initialization
  1491.     # file (.Xshrc) pointed to by ENV may overide the classpath we have just set,
  1492.     # causing the app to fail.  Drawback is that other environment variables set
  1493.     # in the init file will not be available in the environment (they will be
  1494.     # available as Java system properties, however).  Comment out the two lines
  1495.     # below to change this behavior.
  1496.     ENV=
  1497.     export ENV
  1498.     # I split these up so they would be a bit clearer on the screen.
  1499.     debugOut ""
  1500.     debugOut "========= VM Command Line ============================================"
  1501.     debugOut "CLASSPATH=$lax_class_path"
  1502.     debugOut "\"$actvm\" $options $lax_nl_java_launcher_main_class \"$propfname\" \"$envPropertiesFile\" $cmdLineArgs"
  1503.     # Here is where we actually run the app in Java:
  1504.     debugOut ""
  1505.     debugOut "========= Executing JAVA ============================================="
  1506.     eval \"$actvm\" $options $lax_nl_java_launcher_main_class \"$propfname\" \"$envPropertiesFile\" $cmdLineArgs
  1507.     exitValue=$?
  1508.     debugOut "========= JAVA Finished =============================================="
  1509.     debugOut ""
  1510.  
  1511. else
  1512.  
  1513.     debugOut VMTYPE_UNKNOWN="$actvmBinaryName"
  1514.  
  1515. fi
  1516.  
  1517. #  Change back to directory used priory to this script running.
  1518.  
  1519. cd "$olddir"
  1520.  
  1521. if [ "$IS_INSTALLER" = "true" ]; then
  1522.     debugOut "Removing tmp install dir: \"$lax_user_dir\""
  1523.     rm -rf "$lax_user_dir"
  1524. fi
  1525. rm -f "$envPropertiesFile"
  1526.  
  1527. if [ "$IS_INSTALLER" = "true" -a ${exitValue:-0} -eq 134 ]; then
  1528.     echo ""
  1529.     echo "The installation did not complete successfully.  It appears that your"
  1530.     echo "Java VM might not have all the appropriate patches necessary to run"
  1531.     echo "properly.  Please refer to the following web page to obtain information"
  1532.     echo "regarding the necessary patches."
  1533.     echo "        http://www.ZeroG.com/patches/unix"
  1534.     if [ "$isRemoteDisplay" = "true" ]; then
  1535.         echo ""
  1536.         echo "It also appears that this installation was performed on a remote host"
  1537.         echo "and the output is being displayed locally.  If this launcher is being"
  1538.         echo "displayed to a Microsoft Windows desktop through X Windows, the Java"
  1539.         echo "Virtual Machine might have caused the installation to fail. Try running"
  1540.         echo "this installer locally on the target system or through X Windows to"
  1541.         echo "another UNIX host."
  1542.     fi
  1543.     echo ""
  1544. fi
  1545.  
  1546. exit $exitValue
  1547.