Advertisement
Guest User

Untitled

a guest
Dec 28th, 2012
384
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 73.00 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. PATH=$PATH:/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin
  4. BLOCKSIZE=32768
  5. ARCHSTART=3
  6. ARCHSIZE=7628243
  7. ARCHREALSIZE=7628243
  8. RESSIZE=186
  9. RESREALSIZE=6090465
  10. ARCHBLOCKS=233
  11. DEFAULTPERMS=002
  12. INSTALLER_OVERRIDE_VMLIST="1.5+"
  13. INSTALLER_STDERR_REDIRECT=""
  14. INSTALLER_STDOUT_REDIRECT=""
  15. INSTALLER_HEAP_SIZE_INITIAL="16777216"
  16. INSTALLER_HEAP_SIZE_MAX="50331648"
  17. INSTALLER_OPTIONAL_ARGS=""
  18. RESOURCE_DIR="Linux"
  19. DEFAULT_UI_MODE="GUI"
  20. #!/bin/sh
  21. #################################################################################################
  22. #
  23. # USE.SH - InstallAnywhere (tm) UNIX Self Extractor Version 11.5
  24. #
  25. # (c) Copyright 1997-2010 Flexera Software Inc. and/or InstallShield Co. Inc., all rights reserved.
  26. #
  27. #################################################################################################
  28.  
  29. GREP="grep"
  30. # /usr/bin/grep is stripped down on Solaris
  31. [ `uname` = "SunOS" -a -x /usr/xpg4/bin/grep ] && GREP=/usr/xpg4/bin/grep
  32.  
  33. ####################################################################################
  34. # Format commandline args
  35. # To overcome the problem of quoted args (with internal spaces) to the launcher
  36. # is that they get "unquoted" or separated into discreet args when they are put
  37. # on the cmdline for the application. This following block makes sure the stay intact
  38. uimodeuse="not set"
  39. hasSeenIUse="false"
  40. tmpArgsUse=""
  41. origArgsUse=$@
  42. for arg in "$@"
  43. do
  44. if [ "$arg" != "" ]; then
  45. tmpArgsUse="$tmpArgsUse \"$arg\""
  46. if [ "$arg" = "-i" -o "$arg" = "-I" ]; then
  47. hasSeenIUse="true"
  48. elif [ "$hasSeenIUse" = "true" ]; then
  49. lowerArg=`echo $arg | tr "[:upper:]" "[:lower:]"`
  50. if [ "$lowerArg" = "silent" ]; then
  51. uimodeuse="silent"
  52. fi
  53. fi
  54. fi
  55. done
  56.  
  57. if [ "$uimodeuse" != "silent" ]; then
  58. echo "Preparing to install..."
  59. fi
  60.  
  61. if [ $JRESTART ]; then
  62. VM_INCLUDED="true"
  63. else
  64. VM_INCLUDED="false"
  65. fi
  66.  
  67. if [ $RESSIZE ]; then
  68. RESOURCEZIP_INCLUDED="true"
  69. else
  70. RESOURCEZIP_INCLUDED="false"
  71. fi
  72.  
  73. # remember what the current locale is
  74. OLD_LANG="$LANG"
  75.  
  76. # then force it to POSIX for foreign environments where the primary locale
  77. # isn't one we can safely work in; see bug #3411
  78. LANG=C ; export LANG
  79.  
  80.  
  81. #################################################################################################
  82. # Gather the OS/execution environment
  83. #
  84.  
  85. # USERENV is just a flag to laxunix.sh
  86. USERENV=1
  87.  
  88. ORIG_PWD=`pwd`
  89. OS_NAME=`uname -s 2> /dev/null | tr "[:upper:]" "[:lower:]" 2> /dev/null`
  90.  
  91. # always run POSIX commands first
  92. PATH=/usr/xpg4/bin:"$PATH"
  93.  
  94. # enforce POSIX behavior of GNU commands
  95. POSIXLY_CORRECT=1 ; export POSIXLY_CORRECT
  96.  
  97. # POSIX df lists available space in 512 byte-blocks, in the fourth column
  98. OS_BLOCKSIZE=512
  99. DF_AVAIL_COL=4
  100.  
  101. # find out whether df groks the POSIX option; if not, just use regular df and
  102. # hope it does what we expect
  103. [ $LAX_DEBUG ] && echo "Checking for POSIX df."
  104.  
  105. DF_CMD='df -P'
  106.  
  107. if $DF_CMD / >/dev/null 2>&1
  108. then
  109. # POSIX df found
  110. [ $LAX_DEBUG ] && echo "Found POSIX df."
  111.  
  112. POSIX_XPG_DF_CMD() {
  113. df -P "$1" | awk '{ if (NF == 1) { line1 = $0; getline; $0 = line1 $0 } print $0 }'
  114. }
  115. DF_CMD=POSIX_XPG_DF_CMD
  116. else
  117. [ $LAX_DEBUG ] && echo "POSIX df not found; free space calculation may be wrong."
  118. DF_CMD=df
  119. fi
  120.  
  121. # This checks if the -n 1 argument works
  122. [ $LAX_DEBUG ] && echo 'Checking tail options...'
  123. TAIL_CMD='tail -n 1 /dev/null'
  124. if $TAIL_CMD 2>/dev/null
  125. then
  126. TAILN1ARG="-n 1";
  127. else
  128. TAILN1ARG="-1";
  129. fi
  130. [ $LAX_DEBUG ] && echo "Using tail $TAILN1ARG."
  131.  
  132. # Irix patch (is this still necessary?)
  133. #if [ `expr "$OS_NAME" : '.*irix.*'` -gt 0 ]; then
  134. # DF_AVAIL_COL=5
  135. #fi
  136.  
  137.  
  138. if [ -x /bin/ls ]; then
  139. lsCMD="/bin/ls"
  140. elif [ -x /usr/bin/ls ]; then
  141. lsCMD="/usr/bin/ls"
  142. else
  143. lsCMD="ls"
  144. fi
  145.  
  146.  
  147. #################################################################################################
  148. # Set up trap for interrupted installations
  149. # This trap will catch if the user hits ^C in the console window where
  150. # this script is being run. When caught the following function will
  151. # be run to clean up the /tmp/install.dir.XXXX directory
  152. #################################################################################################
  153. tmp_dir_cleanup () {
  154. echo
  155. echo "WARNING! This installation has been interrupted. The"
  156. echo "installation process will now terminate and the temporary"
  157. echo "files it is using will be deleted from $ZIPLOC."
  158. echo
  159. cd "$ORIG_PWD"
  160. rm -rf "$ZIPLOC"
  161. rm -f "$INSTBASE/env.properties.$$"
  162. exit 11;
  163. }
  164. trap "tmp_dir_cleanup" 1 2 3 4 6 8 10 12 13 15
  165.  
  166.  
  167. #################################################################################################
  168. # resolveLink()
  169. # param $1 a file or directory name
  170. # sets $resolveLink the name of the linked disk entity
  171. #################################################################################################
  172. resolveLink()
  173. {
  174. rl_linked="true"
  175. rl_operand="$1"
  176. rl_origDir="`dirname "$1"`"
  177.  
  178. # MMA - 2001.04.04 - if 'dirname' returns '.', then we need the current working directory path
  179. if [ "$rl_origDir" = "." ]; then
  180. rl_origDir=`pwd`
  181. fi
  182.  
  183. rl_ls=`$lsCMD -l "$rl_operand"`
  184.  
  185. # MMA - 2001.02.28 - always resolve path to absolute.
  186.  
  187. while [ "$rl_linked" = "true" ]; do
  188. # if the operand is not of an abs path, get its abs path
  189. case "$rl_operand" in
  190. /*)
  191. rl_origDir=`dirname "$rl_operand"`
  192. ;;
  193. \./*)
  194. rl_origDir=`pwd`
  195. rl_operand="$rl_origDir/$rl_operand"
  196. ;;
  197. \../*)
  198. rl_origDir=`pwd`
  199. rl_operand="$rl_origDir/$rl_operand"
  200. ;;
  201. *)
  202. rl_operand="$rl_origDir/$rl_operand"
  203. ;;
  204. esac
  205. #
  206. # the prevPrev hack is here because .../java often points to .java_wrapper.
  207. # at the end of the resolution rl_operand actually points to garbage
  208. # signifying it is done resolving the link. So prev is actually .java_wrapper.
  209. # but we want the one just before that, its the real vm starting poiint we want
  210. #
  211. rl_prevOperand="$rl_operand"
  212. rl_ls=`$lsCMD -l "$rl_operand"`
  213. # get the output ls into a list
  214. set x $rl_ls
  215. # get rid of x and file info from ls -l
  216. shift 9
  217.  
  218. #is this a link?
  219. case "$rl_ls" in
  220. *"->"*)
  221. rl_linked="true"
  222. # is a link, shift past the "->"
  223. rl_linker=""
  224. while [ "$1" != "->" -a $# -gt 1 ]; do
  225. rl_linker="$rl_linker $1"
  226. shift
  227. done
  228.  
  229. if [ "$1" = "->" ]; then
  230. shift
  231. fi
  232. ;;
  233. *)
  234. # not a link, the rest must be the targets name
  235. rl_linked="false"
  236. ;;
  237. esac
  238. # now grab what's left
  239. rl_linkee="$@"
  240.  
  241. # debugOut "Following link to LAX $rl_linker -> $rl_linkee"
  242.  
  243. if [ "$rl_linked" = "true" -a "`basename "$rl_linkee"`" != "$vmScript" ]; then
  244. # set to true incase the thing linked to is also a link and we can
  245. # try again. The current think linked to now becomes the operand
  246. rl_operand="$rl_linkee"
  247. # if the linkee is not abs, make it abs relative to the linker
  248. case "$rl_operand" in
  249. /*)
  250. ;;
  251. *)
  252. rl_operand="$rl_origDir/$rl_operand"
  253. ;;
  254. esac
  255. else
  256. # otherwise, this operand is not a link itself and we are done
  257. rl_resolvedLink="$rl_prevOperand"
  258. # however, do not resolve the last leg of a VMs linked scripts. this will
  259. # disrupt their scripts. it is expecting a link to the .java* script
  260. # let us believe it is not linked and continue on...
  261. if [ "`basename "$rl_linkee"`" = "$vmScript" ]; then
  262. rl_linked="false"
  263. fi
  264. fi
  265. # make sure the path returned is absolute
  266. case "$rl_operand" in
  267. \.\/*)
  268. rl_operand="`pwd`/$rl_operand"
  269. ;;
  270. esac
  271. done
  272.  
  273. # remove "/./" in paths, make it "/"
  274. # i,e, "/a/b/./c" becomes "/a/b/c"
  275. resolvedLink=`echo "$rl_resolvedLink" | sed 's,/\./,/,'`
  276. }
  277.  
  278.  
  279.  
  280.  
  281. #################################################################################################
  282. # Find the true location of the self extractor, move to the right place
  283. #
  284.  
  285. # -- if it's a relative path, make it absolute
  286. if pwd -P 2>&1 > /dev/null; then
  287. PWD="pwd -P"
  288. else
  289. PWD="pwd"
  290. fi
  291.  
  292. ARGZERO=$0
  293. if [ -z "`echo $ARGZERO | grep '^/'`" ]; then
  294. ARGZERO="`$PWD`/$ARGZERO"
  295. fi
  296. # this line removes turns ./ & // into /
  297. ARGZERO=`echo $ARGZERO | sed s,\\\\./,/,g | sed s,//,/,g`
  298. # -- done fixing up relative path
  299.  
  300. # -- this shouldn't be necessary, but I'm going to leave it in anyways
  301. resolveLink "$ARGZERO"
  302. SEA_LOC="$resolvedLink"
  303.  
  304. [ $LAX_DEBUG ] && echo "True location of the self extractor: $SEA_LOC"
  305.  
  306.  
  307. #################################################################################################
  308. # Set up tmp install location
  309. #
  310. if [ $IATEMPDIR ]; then
  311. INSTBASE=$IATEMPDIR
  312. if [ $LAX_DEBUG ]; then
  313. echo "Forcing install base (including tmp dir) to: $IATEMPDIR"
  314. fi
  315. if [ ! -d "$INSTBASE" ]; then
  316. echo "You have used the IATEMPDIR to set the install base and tmp dir"
  317. echo "for this installation. However, the directory"
  318. echo " $INSTBASE"
  319. echo "does not exist or is not a directory. Please choose a valid directory."
  320. exit 1;
  321. fi
  322. else
  323. if [ -d /tmp ]; then
  324. INSTBASE=/tmp
  325. else
  326. INSTBASE="$HOME"
  327. if [ $LAX_DEBUG ]; then
  328. echo "WARNING: /tmp is not a directory! Using $HOME for install base and tmp dir."
  329. fi
  330. fi
  331. fi
  332. ZIPLOC="$INSTBASE/install.dir.$$"
  333. INSTALLER_DATA_DIR="$ZIPLOC/InstallerData"
  334. INSTALL_ZIP="$INSTALLER_DATA_DIR/installer.zip"
  335. INSTALL_PADDED_ZIP="$INSTALLER_DATA_DIR/installer.padded"
  336. DISK1_DIR="$INSTALLER_DATA_DIR/Disk1"
  337. INSTDATA_DIR="$DISK1_DIR/InstData"
  338. RESOURCE_ZIP="$INSTDATA_DIR/Resource1.zip"
  339. ENV_PROPERTIES="$ZIPLOC/env.properties"
  340. TMP_LAX="$ZIPLOC/temp.lax"
  341.  
  342. [ $LAX_DEBUG ] && echo "Creating installer data directory: $ZIPLOC"
  343. mkdir "$ZIPLOC" > /dev/null 2>&1
  344.  
  345. if [ $? -ne 0 ]; then
  346. echo "The temporary install directory: "
  347. echo " $INSTBASE"
  348. echo "does not exist or you do not have permission to write to it."
  349. echo "Please set the IATEMPDIR environment variable to a directory"
  350. echo "to which you have the permission."
  351. echo "To set the variable enter one of the following"
  352. echo "commands at the UNIX command line prompt before running this"
  353. echo "installer again:"
  354. echo ""
  355. echo "- for Bourne shell (sh), ksh, bash and zsh:"
  356. echo ""
  357. echo " $ IATEMPDIR=/your/temp/space/directory"
  358. echo " $ export IATEMPDIR"
  359. echo ""
  360. echo "- for C shell (csh) and tcsh:"
  361. echo ""
  362. echo " $ setenv IATEMPDIR /your/temp/space/directory"
  363. echo ""
  364. fi
  365.  
  366. [ $LAX_DEBUG ] && echo "Creating installer data directory: $INSTALLER_DATA_DIR"
  367. mkdir "$INSTALLER_DATA_DIR" > /dev/null 2>&1
  368.  
  369.  
  370. #################################################################################################
  371. # Gather disk free-space info
  372. #
  373. [ $LAX_DEBUG ] && echo "Gathering free-space information..."
  374.  
  375. EXTRA_SPACE=512
  376. if [ $VM_INCLUDED = "true" ]; then
  377. BASE_SIZE=`expr \( $ARCHREALSIZE + $JREREALSIZE + $RESREALSIZE \)`
  378. BASE_SIZE=`expr $BASE_SIZE \* 2 + $BASE_SIZE`
  379. NEEDED_SPACE=`expr $BASE_SIZE / $OS_BLOCKSIZE + $EXTRA_SPACE`
  380. else
  381. NEEDED_SPACE=`expr $ARCHSIZE / $OS_BLOCKSIZE + $EXTRA_SPACE`
  382. fi
  383.  
  384. [ $LAX_DEBUG ] && echo "Space needed to complete the self-extraction: $NEEDED_SPACE blocks"
  385.  
  386. sePwd=`pwd`
  387. cd "$INSTBASE"
  388.  
  389. AVAIL_SPACE=`$DF_CMD . 2>/dev/null | awk "{print \\\$$DF_AVAIL_COL}" | tail $TAILN1ARG`
  390.  
  391. isValidNumber()
  392. {
  393. awk 'BEGIN {
  394. if ( ARGV[1] ~ /^[0-9]+$/ ) {
  395. exit(0);
  396. } else {
  397. exit(1);
  398. }
  399. }' "$1"
  400.  
  401. return $?
  402. }
  403.  
  404. isValidNumber "$AVAIL_SPACE"
  405. if [ ! $? ]; then
  406. echo "DF output not POSIX standard"
  407.  
  408. AVAIL_SPACE=`$DF_CMD . 2>/dev/null | awk -F: '{ print $2 }' | awk '{ print $1 }' | tail $TAILN1ARG`
  409.  
  410. isValidNumber "$AVAIL_SPACE"
  411. if [ ! $? ]; then
  412. unset $AVAIL_SPACE
  413. fi
  414. fi
  415.  
  416. [ $LAX_DEBUG ] && echo "Available space: $AVAIL_SPACE blocks"
  417.  
  418. cd "$sePwd"
  419.  
  420. # if space info gathering worked well...
  421. if [ $LAX_DEBUG ]; then
  422. echo "Available blocks: $AVAIL_SPACE Needed blocks: $NEEDED_SPACE (block = $OS_BLOCKSIZE bytes)"
  423. fi
  424. if [ ! \( -z $AVAIL_SPACE -o -z $NEEDED_SPACE \) ]; then
  425. if [ ${AVAIL_SPACE:-0} -lt ${NEEDED_SPACE:-0} ]; then
  426.  
  427. #
  428. # MMA - 2001.03.01 - try the home directory first if not enough space in /tmp or $IATEMPDIR
  429. #
  430. if [ "$INSTBASE" != "$HOME" ]; then
  431.  
  432. if [ -d "$ZIPLOC" ]; then
  433. rmdir "$ZIPLOC" > /dev/null 2>&1
  434. fi
  435.  
  436. echo "WARNING: $INSTBASE does not have enough disk space!"
  437. echo " Attempting to use $HOME for install base and tmp dir."
  438.  
  439. INSTBASE="$HOME"
  440. ZIPLOC="$INSTBASE/install.dir.$$"
  441. INSTALLER_DATA_DIR="$ZIPLOC/InstallerData"
  442. INSTALL_ZIP="$INSTALLER_DATA_DIR/installer.zip"
  443. INSTALL_PADDED_ZIP="$INSTALLER_DATA_DIR/installer.padded"
  444. DISK1_DIR="$INSTALLER_DATA_DIR/Disk1"
  445. INSTDATA_DIR="$DISK1_DIR/InstData"
  446. RESOURCE_ZIP="$INSTDATA_DIR/Resource1.zip"
  447. ENV_PROPERTIES="$ZIPLOC/env.properties"
  448. TMP_LAX="$ZIPLOC/temp.lax"
  449.  
  450. [ $LAX_DEBUG ] && echo "Creating installer data directory: $ZIPLOC"
  451.  
  452. if mkdir "$ZIPLOC" > /dev/null 2>&1
  453. then
  454. # successful
  455. :
  456. else
  457. echo "The temporary install directory: "
  458. echo " $INSTBASE"
  459. echo "does not exist or you do not have permission to write to it."
  460. echo "Please set the IATEMPDIR environment variable to a directory"
  461. echo "to which you have the permission."
  462. echo "To set the variable enter one of the following"
  463. echo "commands at the UNIX command line prompt before running this"
  464. echo "installer again:"
  465. echo ""
  466. echo "- for Bourne shell (sh), ksh, bash and zsh:"
  467. echo ""
  468. echo " $ IATEMPDIR=/your/temp/space/directory"
  469. echo " $ export IATEMPDIR"
  470. echo ""
  471. echo "- for C shell (csh) and tcsh:"
  472. echo ""
  473. echo " $ setenv IATEMPDIR /your/temp/space/directory"
  474. echo ""
  475. fi
  476.  
  477. [ $LAX_DEBUG ] && echo "Creating installer data directory: $INSTALLER_DATA_DIR"
  478. mkdir "$INSTALLER_DATA_DIR" > /dev/null 2>&1
  479.  
  480. cd "$INSTBASE"
  481. AVAIL_SPACE=`$DF_CMD . 2>/dev/null | awk "{print \\\$$DF_AVAIL_COL}" | tail $TAILN1ARG `
  482.  
  483. isValidNumber "$AVAIL_SPACE"
  484. if [ ! $? ]; then
  485. echo "DF output not POSIX standard"
  486.  
  487. AVAIL_SPACE=`$DF_CMD . 2>/dev/null | awk -F: '{ print $2 }' | awk '{ print $1 }' | tail $TAILN1ARG`
  488.  
  489. isValidNumber "$AVAIL_SPACE"
  490. if [ ! $? ]; then
  491. unset $AVAIL_SPACE
  492. fi
  493. fi
  494.  
  495.  
  496. cd "$sePwd"
  497.  
  498. if [ $LAX_DEBUG ]; then
  499. echo "Available blocks: $AVAIL_SPACE Needed blocks: $NEEDED_SPACE (block = $OS_BLOCKSIZE bytes)"
  500. fi
  501.  
  502. if [ ! \( -z $AVAIL_SPACE -o -z $NEEDED_SPACE \) ]; then
  503. if [ ${AVAIL_SPACE:-0} -lt ${NEEDED_SPACE:-0} ]; then
  504.  
  505. # figure out num of Kb needed to install
  506. free_up=`expr ${NEEDED_SPACE:-0} - ${AVAIL_SPACE:-0}`
  507. free_up=`expr ${free_up:-1} \* $OS_BLOCKSIZE`
  508. free_up=`expr ${free_up:-1024} / 1024`
  509.  
  510. echo ""
  511. echo "WARNING! The amount of $INSTBASE disk space required to perform"
  512. echo "this installation is greater than what is available. Please"
  513. echo "free up at least $free_up kilobytes in $INSTBASE and attempt this"
  514. echo "installation again. You may also set the IATEMPDIR environment"
  515. echo "variable to a directory on a disk partition with enough free"
  516. echo "disk space. To set the variable enter one of the following"
  517. echo "commands at the UNIX command line prompt before running this"
  518. echo "installer again:"
  519. echo ""
  520. echo "- for Bourne shell (sh), ksh, bash and zsh:"
  521. echo ""
  522. echo " $ IATEMPDIR=/your/free/space/directory"
  523. echo " $ export IATEMPDIR"
  524. echo ""
  525. echo "- for C shell (csh) and tcsh:"
  526. echo ""
  527. echo " $ setenv IATEMPDIR /your/free/space/directory"
  528. echo ""
  529. exit 12;
  530. fi
  531. else
  532. echo "WARNING! The amount of $INSTBASE disk space required and/or available"
  533. echo "could not be determined. The installation will attempted anyway."
  534. fi
  535. fi
  536. #
  537. # End MMA - 2001.03.01
  538. #
  539. fi
  540. else
  541. echo "WARNING! The amount of $INSTBASE disk space required and/or available"
  542. echo "could not be determined. The installation will be attempted anyway."
  543. fi
  544.  
  545. #################################################################################################
  546. # Extract the JRE if included
  547. #
  548. if [ "$VM_INCLUDED" = "true" ]
  549. then
  550.  
  551. # determine where to place the jre
  552. RESOURCE_PATH="$ZIPLOC/$RESOURCE_DIR/resource"
  553. JRE_PADDED="$RESOURCE_PATH/jre_padded"
  554. JRE_TARZ="$RESOURCE_PATH/vm.tar.Z"
  555. JRE_TAR="$RESOURCE_PATH/vm.tar"
  556.  
  557. # compute number of blocks to extract
  558. JRE_BLOCKS=`expr $JREREALSIZE / $BLOCKSIZE`
  559. JRE_REMAINDER=`expr $JREREALSIZE % $BLOCKSIZE`
  560. if [ ${JRE_REMAINDER:-0} -gt 0 ]; then
  561. JRE_BLOCKS=`expr $JRE_BLOCKS + 1`
  562. fi
  563.  
  564. [ $LAX_DEBUG ] && echo "Computed number of blocks to extract: $JRE_BLOCKS"
  565.  
  566. # save the old directory and switch into the temp directory
  567. sePwd=`pwd`
  568. cd "$ZIPLOC"
  569. # make the platform directory and switch into it
  570. mkdir "$RESOURCE_DIR"
  571. cd "$RESOURCE_DIR"
  572. # make the resource directory
  573. mkdir resource
  574. # switch back to the previous directory
  575. cd "$sePwd"
  576.  
  577. # COMMENT ME TO REMOVE OUTPUT FROM NORMAL INSTALLER EXECUTION
  578. if [ "$uimodeuse" != "silent" ]; then
  579. echo "Extracting the JRE from the installer archive..."
  580. fi
  581.  
  582. # extract the jre
  583. [ $LAX_DEBUG ] && echo "Extracting JRE from $0 to $JRE_PADDED ..."
  584. dd if="$0" of="$JRE_PADDED" bs=$BLOCKSIZE skip=$JRESTART count=$JRE_BLOCKS > /dev/null 2>&1
  585. R1=$?
  586. [ $LAX_DEBUG ] && echo "Extracting done, exit code = $R1"
  587.  
  588. [ $LAX_DEBUG ] && echo "Extracting JRE from $JRE_PADDED to $JRE_TARZ ..."
  589. dd if="$JRE_PADDED" of="$JRE_TARZ" bs=$JREREALSIZE count=1 > /dev/null 2>&1
  590. R2=$?
  591. [ $LAX_DEBUG ] && echo " Extracting done, exit code = $R2"
  592.  
  593. rm -f "$JRE_PADDED"
  594.  
  595. # verify the integrity of the jre archive
  596. JRE_TARZ_SIZE=`cksum "$JRE_TARZ" | awk '{ print $2 }'`
  597. if [ "${JRE_TARZ_SIZE:=0}" -ne "${JREREALSIZE:=1}" -o "$R1" -ne 0 -o "$R2" -ne 0 ]; then
  598. echo "The included VM could not be extracted. Please try to download"
  599. echo "the installer again and make sure that you download using 'binary'"
  600. echo "mode. Please do not attempt to install this currently downloaded copy."
  601. exit 13
  602. fi
  603.  
  604. # unpack the jre archive
  605. pre_unpack_pwd=`pwd`
  606. cd "$RESOURCE_PATH"
  607.  
  608. # COMMENT ME TO REMOVE OUTPUT FROM NORMAL INSTALLER EXECUTION
  609. if [ "$uimodeuse" != "silent" ]; then
  610. echo "Unpacking the JRE..."
  611. fi
  612.  
  613. [ $LAX_DEBUG ] && echo "Unpacking the JRE..."
  614.  
  615. JRE_EXPANDED="false"
  616.  
  617. if [ $LAX_DEBUG ]; then
  618. type gzip
  619. else
  620. type gzip > /dev/null
  621. fi
  622.  
  623. if [ $? -eq 0 ]; then
  624. gzip -d "$JRE_TARZ"
  625. if [ $? -eq 0 ]; then
  626. # gzip successful
  627. JRE_EXPANDED="true"
  628. [ $LAX_DEBUG ] && echo " GZIP done."
  629. else
  630. [ $LAX_DEBUG ] && echo " GZIP failed, attempting UNCOMPRESS."
  631. fi
  632. else
  633. [ $LAX_DEBUG ] && echo " GZIP not found, attempting UNCOMPRESS."
  634. fi
  635.  
  636. if [ "$JRE_EXPANDED" = "false" ]; then
  637. uncompress "$JRE_TARZ"
  638. if [ $? -eq 0 ]; then
  639. # uncompress successful
  640. JRE_EXPANDED="true"
  641. [ $LAX_DEBUG ] && echo " UNCOMPRESS done."
  642. else
  643. [ $LAX_DEBUG ] && echo " UNCOMPRESS failed."
  644. fi
  645. fi
  646.  
  647. # in case TYPE failed.
  648. if [ "$JRE_EXPANDED" = "false" ]; then
  649. gzip -d "$JRE_TARZ"
  650. if [ $? -eq 0 ]; then
  651. # uncompress successful
  652. JRE_EXPANDED="true"
  653. [ $LAX_DEBUG ] && echo " GZIP done."
  654. else
  655. [ $LAX_DEBUG ] && echo " GZIP failed."
  656. fi
  657. fi
  658.  
  659. if [ "$JRE_EXPANDED" = "true" ]; then
  660. tar xf "$JRE_TAR"
  661. if [ $? -eq 0 ]; then
  662. # tar successful
  663. [ $LAX_DEBUG ] && echo " TAR done."
  664. else
  665. echo "The included VM could not be unarchived (TAR). Please try to download"
  666. echo "the installer again and make sure that you download using 'binary'"
  667. echo "mode. Please do not attempt to install this currently downloaded copy."
  668. exit 15
  669. fi
  670. else
  671. echo "The included VM could not be uncompressed (GZIP/UNCOMPRESS). Please try to"
  672. echo "download the installer again and make sure that you download using 'binary'"
  673. echo "mode. Please do not attempt to install this currently downloaded copy."
  674. exit 15
  675. fi
  676.  
  677. chmod -R 755 jre > /dev/null 2>&1
  678.  
  679. # Switch back to the previous directory
  680. cd "$pre_unpack_pwd"
  681.  
  682. # Figure out the path to the bundled VM
  683. bundledVMPath="$RESOURCE_PATH/$LAX_NL_CURRENT_VM"
  684.  
  685. else
  686.  
  687. if [ $LAX_DEBUG ]; then
  688. echo "This installation does not contain a VM."
  689. fi
  690.  
  691. # There is no path to a bundled VM
  692. bundledVMPath=""
  693.  
  694. fi
  695.  
  696. # COMMENT ME TO REMOVE OUTPUT FROM NORMAL INSTALLER EXECUTION
  697. if [ "$uimodeuse" != "silent" ]; then
  698. echo "Extracting the installation resources from the installer archive..."
  699. fi
  700.  
  701. #################################################################################################
  702. # Extract install.zip archive
  703. #
  704.  
  705. INSTALLER_BLOCKS=`expr $ARCHREALSIZE / $BLOCKSIZE`
  706. INSTALLER_REMAINDER=`expr $ARCHREALSIZE % $BLOCKSIZE`
  707. if [ ${INSTALLER_REMAINDER:-0} -gt 0 ]; then
  708. INSTALLER_BLOCKS=`expr $INSTALLER_BLOCKS + 1`
  709. fi
  710.  
  711. # extract the install.zip
  712. if [ $VM_INCLUDED = "true" ]; then
  713.  
  714. [ $LAX_DEBUG ] && echo "Extracting install.zip from $0 to $INSTALL_PADDED_ZIP ..."
  715.  
  716. dd if="$0" of="$INSTALL_PADDED_ZIP" bs=$BLOCKSIZE \
  717. skip=`expr $JRESTART + $JRE_BLOCKS` count=$INSTALLER_BLOCKS > /dev/null 2>&1
  718.  
  719. [ $LAX_DEBUG ] && echo "Extracting to padded done, exit code = $?"
  720.  
  721. else
  722. [ $LAX_DEBUG ] && echo "Extracting install.zip from $0 to $INSTALL_ZIP ..."
  723.  
  724. dd if="$0" of="$INSTALL_PADDED_ZIP" bs=$BLOCKSIZE \
  725. skip=$ARCHSTART count=$INSTALLER_BLOCKS > /dev/null 2>&1
  726.  
  727.  
  728. [ $LAX_DEBUG ] && echo "Extracting to padded done, exit code = $?"
  729. fi
  730.  
  731.  
  732. dd if="$INSTALL_PADDED_ZIP" of="$INSTALL_ZIP" bs=$ARCHREALSIZE \
  733. count=1 > /dev/null 2>&1
  734.  
  735.  
  736. [ $LAX_DEBUG ] && echo "Extracting from padded to zip done, exit code = $?"
  737.  
  738. rm -f $INSTALL_PADDED_ZIP
  739.  
  740. # verify the integrity of the install.zip
  741. INSTALL_ZIP_SIZE=`cksum "$INSTALL_ZIP" | awk '{ print $2 }'`
  742.  
  743. if [ ${ARCHREALSIZE:=0} -ne ${INSTALL_ZIP_SIZE:=1} ]; then
  744. echo "The size of the extracted files to be installed are corrupted. Please"
  745. echo "try to download the installer again and make sure that you download"
  746. echo "using 'binary' mode."
  747. echo "Please do not attempt to install this currently downloaded copy."
  748. exit 16
  749. fi
  750.  
  751. # extract the resource1.zip if it exists (web installers only)
  752. if [ $RESOURCEZIP_INCLUDED = "true" ]; then
  753.  
  754. [ $LAX_DEBUG ] && echo "Creating disk1 data directory: $DISK1_DIR"
  755. mkdir "$DISK1_DIR" > /dev/null 2>&1
  756. [ $LAX_DEBUG ] && echo "Creating instdata data directory: $INSTDATA_DIR"
  757. mkdir "$INSTDATA_DIR" > /dev/null 2>&1
  758.  
  759.  
  760. [ $LAX_DEBUG ] && echo "Extracting resources from $0 to $RESOURCE_ZIP ..."
  761.  
  762. if [ $RESSIZE -eq 0 ]; then
  763. touch $RESOURCE_ZIP
  764. elif [ $VM_INCLUDED = "true" ]; then
  765. dd if="$0" of="$RESOURCE_ZIP" bs=$BLOCKSIZE \
  766. skip=`expr $JRESTART + $JRE_BLOCKS + $INSTALLER_BLOCKS` count=$RESSIZE > /dev/null 2>&1
  767. else
  768. dd if="$0" of="$RESOURCE_ZIP" bs=$BLOCKSIZE \
  769. skip=`expr $ARCHSTART + $INSTALLER_BLOCKS` count=$RESSIZE > /dev/null 2>&1
  770. fi
  771.  
  772. [ $LAX_DEBUG ] && echo "Extracting done, exit code = $?"
  773.  
  774. # verify the integrity of the resource1zip
  775. RESOURCE_ZIP_SIZE=`cksum "$RESOURCE_ZIP" | awk '{ print $2 }'`
  776. if [ ${RESREALSIZE:=0} -ne ${RESOURCE_ZIP_SIZE:=1} ]; then
  777. echo "The size of the extracted files to be installed are corrupted. Please"
  778. echo "try to download the installer again and make sure that you download"
  779. echo "using 'binary' mode."
  780. echo "Please do not attempt to install this currently downloaded copy."
  781. exit 16
  782. fi
  783. fi
  784.  
  785. # COMMENT ME TO REMOVE OUTPUT FROM NORMAL INSTALLER EXECUTION
  786. if [ "$uimodeuse" != "silent" ]; then
  787. echo "Configuring the installer for this system's environment..."
  788. fi
  789.  
  790. #
  791. # write a file in the installerData dir named "sea_loc" that
  792. # contains the path to the self-extractor
  793. #
  794. echo "$SEA_LOC" > "$ZIPLOC"/sea_loc
  795.  
  796. #################################################################################################
  797. # Create a lax file for the launcher
  798. #
  799.  
  800. TMP_LAX="$ZIPLOC/temp.lax"
  801.  
  802. echo "lax.user.dir=$ZIPLOC" > $TMP_LAX
  803. echo "lax.resource.dir=$RESOURCE_DIR" >> $TMP_LAX
  804. echo "lax.class.path="$INSTALLER_DATA_DIR":"$INSTALL_ZIP >> $TMP_LAX
  805. echo "lax.main.class=com.zerog.ia.installer.Main" >> $TMP_LAX
  806. echo "lax.main.method=main" >> $TMP_LAX
  807. 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/" >> $TMP_LAX
  808.  
  809. echo "lax.nl.java.launcher.main.class=com.zerog.lax.LAX" >> $TMP_LAX
  810. echo "lax.nl.java.launcher.main.method=main" >> $TMP_LAX
  811. echo "lax.command.line.args=\$CMD_LINE_ARGUMENTS\$" >> $TMP_LAX
  812. echo "lax.nl.current.vm=$bundledVMPath" >> $TMP_LAX
  813. echo "lax.nl.java.compiler=off" >> $TMP_LAX
  814. echo "lax.nl.java.option.verify.mode=none" >> $TMP_LAX
  815. echo "lax.nl.java.option.check.source=off" >> $TMP_LAX
  816. echo "lax.stderr.redirect=$INSTALLER_STDERR_REDIRECT" >> $TMP_LAX
  817. echo "lax.stdout.redirect=$INSTALLER_STDOUT_REDIRECT" >> $TMP_LAX
  818. echo "lax.nl.java.option.java.heap.size.initial=$INSTALLER_HEAP_SIZE_INITIAL" >> $TMP_LAX
  819. echo "lax.nl.java.option.java.heap.size.max=$INSTALLER_HEAP_SIZE_MAX" >> $TMP_LAX
  820. echo "lax.nl.java.option.additional=$INSTALLER_OPTIONAL_ARGS" >> $TMP_LAX
  821. echo "lax.installer.unix.internal.property.0=$LAX_INSTALLER_UNIX_INTERNAL_PROPERTY_0" >> $TMP_LAX
  822. echo "lax.installer.unix.ui.default=$DEFAULT_UI_MODE" >> $TMP_LAX
  823.  
  824. #################################################################################################
  825. # Tell the standard launcher that it should backup this lax file
  826. # since this is a self extractor and not a launcher
  827. #
  828. noLaxBackup=true
  829. templaxpath="$TMP_LAX"
  830. umask $DEFAULTPERMS
  831.  
  832. # Tell the launcher where to find the properties file
  833. seLaxPath="$TMP_LAX"
  834.  
  835. #################################################################################################
  836. ### END OF USE.SH ###############################################################################
  837. #################################################################################################
  838.  
  839. #!/bin/sh
  840. #################################################################################################
  841. #
  842. # LAXUNIX.SH - LaunchAnywhere (tm) version 11.5
  843. #
  844. # (c) Copyright 1999-2010 Flexera Software, Inc., all rights reserved.
  845. #
  846. # To run this script you will need to have the following:
  847. # 1) a Java VM installed (however, it will handle a lack of Java nicely).
  848. # 2) a Java-style properties file having the same name as this script
  849. # with the suffix .lax. If this script is appended to the
  850. # self-extractor, it will look for the properties file in the
  851. # directory specified by $seLaxPath; otherwise, it will look in
  852. # the same directory that this script is in.
  853. # 3) a Java program in the file "lax.jar".
  854. #
  855. # The .lax property file must contain at least the following properties:
  856. # 1) lax.class.path classpath (do not include the environment variable $CLASSPATH )
  857. # 2) lax.nl.java.launcher.main.class (main class of LaunchAnywhere Executable)
  858. #
  859. #################################################################################################
  860.  
  861. #
  862. # Since USERENV is already set in the self-extractor, if its not set we know
  863. # this is not an installer but a separate launcher.
  864. # USERENV is just a flag passed from use.sh.
  865. #
  866. IS_INSTALLER=''
  867. [ $USERENV ] && IS_INSTALLER=true
  868.  
  869. #
  870. # later on we might add things to the PATH, but we want to preserve the PATH
  871. # order for which VMs are the first ones found.
  872. #
  873. VM_SEARCH_PATH="$PATH"
  874.  
  875. ####################################################################################
  876. # Set some constants
  877. if [ "$1" = "LAX_VM" ]; then
  878. lax_vm="LAX_VM"
  879. lax_vm_value="$2"
  880. shift 2
  881. else
  882. lax_vm=""
  883. fi
  884. anyVMlist="JDK_J2 D12 JRE_J2 R12 JDK_J1 JRE_J1 JDK JRE ALL"
  885.  
  886.  
  887. ####################################################################################
  888. # Format commandline args
  889. # To overcome the problem of quoted args (with internal spaces) to the launcher
  890. # is that they get "unquoted" or separated into discreet args when they are put
  891. # on the cmdline for the application. This following block makes sure the stay intact
  892. overrideDefaultUIMode="false"
  893. ignoreMode="false";
  894. uimode="not set"
  895. hasSeenI="false"
  896. tmpArgs=""
  897. origArgs=$@
  898. for arg in "$@"
  899. do
  900. if [ "$arg" != "" ]; then
  901. tmpArgs="$tmpArgs \"$arg\""
  902. if [ "$arg" = "-i" -o "$arg" = "-I" ]; then
  903. hasSeenI="true"
  904. elif [ "$hasSeenI" = "true" ]; then
  905. lowerArg=`echo $arg | tr "[:upper:]" "[:lower:]"`
  906. if [ "$lowerArg" = "awt" ]; then
  907. uimode="awt"
  908. overrideDefaultUIMode="true"
  909. elif [ "$lowerArg" = "swing" ]; then
  910. uimode="swing"
  911. overrideDefaultUIMode="true"
  912. elif [ "$lowerArg" = "gui" ]; then
  913. uimode="gui"
  914. overrideDefaultUIMode="true"
  915. elif [ "$lowerArg" = "console" ]; then
  916. uimode="console"
  917. overrideDefaultUIMode="true"
  918. elif [ "$lowerArg" = "text" ]; then
  919. uimode="console"
  920. overrideDefaultUIMode="true"
  921. elif [ "$lowerArg" = "silent" ]; then
  922. uimode="silent"
  923. overrideDefaultUIMode="true"
  924. else
  925. ignoreMode="true"
  926. fi
  927. fi
  928. fi
  929. done
  930. cmdLineArgs="$tmpArgs"
  931. thisScript="$0"
  932. # make sure thisScript is an abs path
  933. case $thisScript in
  934. /*)
  935. ;;
  936. *)
  937. thisScript="`pwd`/$thisScript"
  938. ;;
  939. esac
  940.  
  941. ####################################################################################
  942. #
  943. # WHere does the LAX_DEBUG output go?
  944. #
  945.  
  946. if [ "$LAX_DEBUG" = "file" ]; then
  947. jx_log="`pwd`/jx.log"
  948. rm -f "$jx_log"
  949. touch "$jx_log"
  950. if [ "$?" -gt "0" ]; then
  951. jx_log_ok="false"
  952. echo "Could not create $jx_log. Sending debug output to console."
  953. else
  954. jx_log_ok="true"
  955. fi
  956. fi
  957.  
  958. debugOut()
  959. {
  960. case "$LAX_DEBUG" in
  961. "file" )
  962. if [ "$jx_log_ok" = "true" ]; then
  963. echo "$1" >> "$jx_log"
  964. else
  965. echo "$1"
  966. fi
  967. ;;
  968. "" )
  969. echo "$1" >> /dev/null
  970. ;;
  971. * )
  972. echo "$1"
  973. ;;
  974. esac
  975. }
  976.  
  977. ####################################################################################
  978. #
  979. # UNIX ENVIRONMENT configuration
  980. #
  981. debugOut ""
  982. debugOut "========= Analyzing UNIX Environment ================================="
  983.  
  984.  
  985. # Get os type , note that it is LOWER-CASED. Used here and later on
  986. osName=`uname -s 2> /dev/null | tr "[:upper:]" "[:lower:]" 2> /dev/null`
  987. debugOut "Setting UNIX ($osName) flavor specifics."
  988. vmScript=".java_wrapper"
  989. case "$osName" in
  990. *irix*)
  991. cpuName="unknown"
  992. ;;
  993. *hp-ux*|*hpux*)
  994. cpuName=`uname -m 2> /dev/null`
  995. ;;
  996. *solaris*|*sunos*)
  997. cpuName=`uname -p 2> /dev/null`
  998. THREADS_FLAG=""; export THREADS_FLAG
  999. PATH=/usr/bin:$PATH; export PATH
  1000. ;;
  1001. *aix*)
  1002. cpuName="unknown"
  1003. ;;
  1004. *freebsd*)
  1005. cpuName=`uname -p 2> /dev/null`
  1006. ;;
  1007. *linux*)
  1008. cpuName=`uname -m 2> /dev/null`
  1009. ;;
  1010. # tlb 2001-09-18 updating to support Darwin
  1011. *rhapsody*|*darwin*)
  1012. cpuName=`uname -p 2> /dev/null`
  1013. vmScript=".java_command"
  1014. ;;
  1015. *compaq*|*dg*|*osf*)
  1016. cpuName="unknown"
  1017. ;;
  1018. *)
  1019. cpuName="unknown"
  1020. ;;
  1021. esac
  1022.  
  1023.  
  1024. if [ -x /bin/ls ]; then
  1025. lsCMD="/bin/ls"
  1026. elif [ -x /usr/bin/ls ]; then
  1027. lsCMD="/usr/bin/ls"
  1028. else
  1029. lsCMD="ls"
  1030. fi
  1031.  
  1032. debugOut "Importing UNIX environment into LAX properties."
  1033.  
  1034. ####################################################################################
  1035. #
  1036. # CREATE ENV.PROPERTIES and figure out if this is being exec'd from an installer
  1037. #
  1038. # We need POSIX awk. On some systems it's called awk, on others
  1039. # nawk. It's most frequently called nawk, so start with that.
  1040. #
  1041. debugOut "Checking for POSIX awk."
  1042.  
  1043. AWK=nawk
  1044. ( $AWK '{}' ) < /dev/null 2>&0 || AWK=awk
  1045.  
  1046. if [ -z "$IATEMPDIR" ]; then
  1047. TMPDIR=/tmp
  1048. else
  1049. TMPDIR=$IATEMPDIR
  1050. fi
  1051.  
  1052.  
  1053. if [ -z "$envPropertiesFile" ]
  1054. then
  1055. if [ -d $TMPDIR ]
  1056. then
  1057. envPropertiesFile=$TMPDIR/env.properties.$$
  1058. else
  1059. envPropertiesFile="$HOME/env.properties.$$"
  1060. fi
  1061. fi
  1062.  
  1063. #
  1064. # Convert environment variables to LAX properties. The variables
  1065. # are also named with alternate case (all upper, all lower).
  1066. #
  1067. # E.g.
  1068. # export My_Env_Var="abc
  1069. # def"
  1070. #
  1071. # is converted to:
  1072. # lax.nl.env.exact_case.My_Env_Var=abc def
  1073. # lax.nl.env.MY_ENV_VAR=abc def
  1074. # lax.nl.env.my_env_var=abc def
  1075. #
  1076. # The second gsub() is used to escape backslashes so that when the properties
  1077. # file is read by the java.util.Properties object, there is not a problem
  1078. # with incorrectly interpreted escaped unicode.
  1079. #
  1080. # This code segment is written in POSIX awk for performance reasons.
  1081. #
  1082.  
  1083. $AWK -v LAX_PREFIX=lax.nl.env. '
  1084. END {
  1085. for (var in ENVIRON)
  1086. {
  1087. # get variable value
  1088. value = ENVIRON[var]
  1089.  
  1090. # strip newlines
  1091. gsub(/\n/, " ", value)
  1092.  
  1093. # convert one backslash to two
  1094. gsub(/\\/, "\\\\", value)
  1095.  
  1096. # print as LAX property
  1097. print LAX_PREFIX "exact_case." var "=" value
  1098. print LAX_PREFIX tolower(var) "=" value
  1099. print LAX_PREFIX toupper(var) "=" value
  1100. }
  1101. }' < /dev/null > $envPropertiesFile
  1102.  
  1103.  
  1104.  
  1105. ####################################################################################
  1106. #
  1107. # Tracing symbolic links to actual launcher location
  1108. #
  1109.  
  1110. resolveLink()
  1111. {
  1112. rl_linked="true"
  1113. rl_operand="$1"
  1114. rl_origDir="`dirname "$1"`"
  1115.  
  1116. # bypass the whole thing if this isnt a link
  1117. rl_ls=`$lsCMD -l "$rl_operand"`
  1118. case "$rl_ls" in
  1119. *"->"*)
  1120. ;;
  1121. *)
  1122. resolvedLink="$rl_operand"
  1123. return
  1124. ;;
  1125. esac
  1126.  
  1127. while [ "$rl_linked" = "true" ]; do
  1128. # if the operand is not of an abs path, get its abs path
  1129. case "$rl_operand" in
  1130. /*)
  1131. rl_origDir=`dirname "$rl_operand"`
  1132. ;;
  1133. \./*)
  1134. rl_origDir=`pwd`
  1135. rl_operand="$rl_origDir/$rl_operand"
  1136. ;;
  1137. *)
  1138. rl_operand="$rl_origDir/$rl_operand"
  1139. ;;
  1140. esac
  1141. #
  1142. # the prevPrev hack is here because .../java often points to .java_wrapper.
  1143. # at the end of the resolution rl_operand actually points to garbage
  1144. # signifying it is done resolving the link. So prev is actually .java_wrapper.
  1145. # but we want the one just before that, its the real vm starting poiint we want
  1146. #
  1147. rl_prevOperand="$rl_operand"
  1148. rl_ls=`$lsCMD -l "$rl_operand"`
  1149. # get the output ls into a list
  1150. set x $rl_ls
  1151. # get rid of x and file info from ls -l
  1152. shift 9
  1153.  
  1154. #is this a link?
  1155. case "$rl_ls" in
  1156. *"->"*)
  1157. rl_linked="true"
  1158. # is a link, shift past the "->"
  1159. rl_linker=""
  1160. while [ "$1" != "->" -a $# -gt 1 ]; do
  1161. rl_linker="$rl_linker $1"
  1162. shift
  1163. done
  1164.  
  1165. if [ "$1" = "->" ]; then
  1166. shift
  1167. fi
  1168. ;;
  1169. *)
  1170. # not a link, the rest must be the targets name
  1171. rl_linked="false"
  1172. ;;
  1173. esac
  1174. # now grab what's left
  1175. rl_linkee="$*"
  1176.  
  1177. # debugOut "Following link to LAX $rl_linker -> $rl_linkee"
  1178.  
  1179. if [ "$rl_linked" = "true" -a "`basename "$rl_linkee"`" != "$vmScript" ]; then
  1180. # set to true incase the thing linked to is also a link and we can
  1181. # try again. The current think linked to now becomes the operand
  1182. rl_operand="$rl_linkee"
  1183. # if the linkee is not abs, make it abs relative to the linker
  1184. case "$rl_operand" in
  1185. /*)
  1186. ;;
  1187. *)
  1188. rl_operand="$rl_origDir/$rl_operand"
  1189. ;;
  1190. esac
  1191. else
  1192. # otherwise, this operand is not a link itself and we are done
  1193. rl_resolvedLink="$rl_prevOperand"
  1194. # however, do not resolve the last leg of a VMs linked scripts. this will
  1195. # disrupt their scripts. it is expecting a link to the .java* script
  1196. # let us believe it is not linked and continue on...
  1197. if [ "`basename "$rl_linkee"`" = "$vmScript" ]; then
  1198. rl_linked="false"
  1199. fi
  1200. fi
  1201. # make sure the path returned is absolute
  1202. case "$rl_operand" in
  1203. \.\/*)
  1204. rl_operand="`pwd`/$rl_operand"
  1205. ;;
  1206. esac
  1207. done
  1208.  
  1209. # remove "/./" in paths, make it "/"
  1210. # i,e, "/a/b/./c" becomes "/a/b/c"
  1211. resolvedLink=`echo "$rl_resolvedLink" | sed 's,/\./,/,'`
  1212. }
  1213.  
  1214. ####################################################################################
  1215. #
  1216. # FINDING THE LAX FILE
  1217. #
  1218. # If this is an installer, use $seLaxPath
  1219. #
  1220. debugOut ""
  1221. debugOut "========= Analyzing LAX =============================================="
  1222. olddir=`pwd`
  1223. resolveLink "$thisScript"
  1224. absLauncherName="$resolvedLink"
  1225. cd "`dirname "$absLauncherName"`"
  1226. if [ "$IS_INSTALLER" != "" ]; then
  1227. if [ ! -z "$seLaxPath" ]; then
  1228. propfname="$seLaxPath"
  1229. else
  1230. # legacy for old self-extractors
  1231. propfname="$templaxpath"
  1232. fi
  1233. else
  1234. propfname="$absLauncherName.lax"
  1235. fi
  1236.  
  1237.  
  1238. if [ ! -r "$propfname" ]; then
  1239. debugOut "The file "$propfname" could"
  1240. debugOut "not be found, and the program cannot be run without it."
  1241. debugOut "Try reinstalling the program."
  1242. exit;
  1243. else
  1244. debugOut "LAX found............................ OK."
  1245. fi
  1246.  
  1247.  
  1248. ####################################################################################
  1249. #
  1250. # READING THE LAX FILE
  1251. #
  1252. OFS="$IFS"
  1253. # run prop file through sed calls that do:
  1254. # 1. transform first '=' on a line into a control-O
  1255. # 2. transform all other ='s to control-F
  1256. # 3. transform control-Os back to =
  1257. # this is to differentiate the lhs=rhs processing from confusing the first = from other
  1258. # = that might be part of the value. Later on those =-tranformed-to-control-Fs are
  1259. # transformed back to = signs.
  1260. set x `cat "$propfname" | sed -e 's~^\([^\=]*\)\=\(.*\)~\1\\2~g' -e 's~=~~g' -e 's~~=~g' | grep '='`; shift
  1261.  
  1262. while test $# -gt 0; do
  1263. # line separator
  1264. case "x${1}x" in
  1265. *"="* ) BIFS=" "; ;;
  1266. * ) BIFS="" ; ;;
  1267. esac
  1268. # word separator
  1269. case "x${2}x" in
  1270. *"="* ) AIFS=""; ;;
  1271. * ) AIFS=""; ;;
  1272. esac
  1273. INPUT="$INPUT$BIFS$1$AIFS"
  1274. shift
  1275. done
  1276.  
  1277. while test "x$INPUT" != "x"; do
  1278. set x $INPUT; shift
  1279. X="$1"
  1280. shift
  1281. INPUT="$@"
  1282. IFS="=$AIFS"
  1283. set x $X; shift
  1284. IFS="$OFS"
  1285.  
  1286. lhs="${1}"
  1287. shift
  1288. rhs="$@"
  1289.  
  1290. # transform non lhs=rhs delimiting = signs back from ^F to =
  1291. case "$rhs" in
  1292. **)
  1293. rhs=`echo $rhs | sed 's~~=~g'`
  1294. ;;
  1295. esac
  1296.  
  1297. # assing the values
  1298. case $lhs in
  1299. lax.class.path*)
  1300. lax_class_path="$rhs"
  1301. ;;
  1302. lax.main.class*)
  1303. lax_main_class="$rhs"
  1304. ;;
  1305. lax.nl.java.launcher.main.class*)
  1306. lax_nl_java_launcher_main_class="$rhs"
  1307. ;;
  1308. lax.nl.current.vm*)
  1309. lax_nl_current_vm="$rhs"
  1310. ;;
  1311. lax.user.dir*)
  1312. lax_user_dir="$rhs"
  1313. lax_user_dir=`echo $lax_user_dir | sed 's;^[ ]*\(.*\)[ ]*$;\1;'`
  1314. ;;
  1315. lax.resource.dir*)
  1316. lax_resource_dir="$rhs"
  1317. lax_resource_dir=`echo $lax_resource_dir | sed 's;^[ ]*\(.*\)[ ]*$;\1;'`
  1318. ;;
  1319. lax.stdout.redirect*)
  1320. lax_stdout_redirect="$rhs"
  1321. ;;
  1322. lax.stderr.redirect*)
  1323. lax_stderr_redirect="$rhs"
  1324. ;;
  1325. lax.dir*)
  1326. lax_dir="$rhs"
  1327. ;;
  1328. lax.always.ask*)
  1329. lax_always_ask="$rhs"
  1330. ;;
  1331. lax.application.name*)
  1332. lax_application_name="$rhs"
  1333. ;;
  1334. lax.nl.message.vm.not.loaded*)
  1335. lax_nl_message_vm_loaded="$rhs"
  1336. ;;
  1337. lax.nl.valid.vm.list*)
  1338. # transform an blank value to "ALL"
  1339. case "$rhs" in
  1340. "") rhs="ALL"; ;;
  1341. esac
  1342. lax_nl_valid_vm_list="$rhs"
  1343. ;;
  1344. lax.nl.java.option.check.source*)
  1345. verify="$rhs"
  1346. ;;
  1347. lax.nl.java.option.verify.mode*)
  1348. verify_mode="$rhs"
  1349. ;;
  1350. lax.nl.java.option.verbose*)
  1351. verbo="$rhs"
  1352. ;;
  1353. lax.nl.java.option.garbage.collection.extent*)
  1354. gcxtnt="$rhs"
  1355. ;;
  1356. lax.nl.java.option.garbage.collection.background.thread*)
  1357. gcthrd="$rhs"
  1358. ;;
  1359. lax.nl.java.option.native.stack.size.max*)
  1360. nsmax="$rhs"
  1361. ;;
  1362. lax.nl.java.option.java.stack.size.max*)
  1363. jsmax="$rhs"
  1364. ;;
  1365. lax.nl.java.option.java.heap.size.max*)
  1366. jhmax="$rhs"
  1367. ;;
  1368. lax.nl.java.option.java.heap.size.initial*)
  1369. jhinit="$rhs"
  1370. ;;
  1371. lax.nl.java.option.debugging*)
  1372. debug="$rhs"
  1373. ;;
  1374. lax.nl.$osName.$cpuName.java.compiler*)
  1375. lax_nl_osname_cpuname_java_compiler="$rhs"
  1376. ;;
  1377. lax.nl.$osName.java.compiler*)
  1378. lax_nl_osname_java_compiler="$rhs"
  1379. ;;
  1380. lax.nl.java.compiler*)
  1381. lax_nl_java_compiler="$rhs"
  1382. ;;
  1383. lax.nl.java.option.additional*)
  1384. lax_nl_java_option_additional="$rhs"
  1385. ;;
  1386. ######################################################
  1387. # tlb 2001-09-18
  1388. # Reading default UI mode for UNIX
  1389. lax.installer.unix.ui.default*)
  1390. lax_installer_unix_ui_default="$rhs"
  1391. ;;
  1392. ######################################################
  1393. # JIT overrides
  1394. lax.nl.unix.JDK_J1.java.compiler*)
  1395. lax_nl_unix_JDK_J1_java_compiler="$rhs"
  1396. ;;
  1397. lax.nl.unix.JDK_J2.java.compiler*)
  1398. lax_nl_unix_JDK_J2_java_compiler="$rhs"
  1399. ;;
  1400. lax.nl.unix.JRE_J1.java.compiler*)
  1401. lax_nl_unix_JRE_J1_java_compiler="$rhs"
  1402. ;;
  1403. lax.nl.unix.JRE_J2.java.compiler*)
  1404. lax_nl_unix_JRE_J2_java_compiler="$rhs"
  1405. ;;
  1406. lax.nl.unix.J1.java.compiler*)
  1407. lax_nl_unix_J1_java_compiler="$rhs"
  1408. ;;
  1409. lax.nl.unix.J2.java.compiler*)
  1410. lax_nl_unix_J2_java_compiler="$rhs"
  1411. ;;
  1412. lax.nl.unix.JRE.java.compiler*)
  1413. lax_nl_unix_JRE_java_compiler="$rhs"
  1414. ;;
  1415. lax.nl.unix.JDK.java.compiler*)
  1416. lax_nl_unix_JDK_java_compiler="$rhs"
  1417. ;;
  1418. lax.nl.unix.ALL.java.compiler*)
  1419. lax_nl_unix_ALL_java_compiler="$rhs"
  1420. ;;
  1421. #
  1422. lax.nl.JDK_J1.java.compiler*)
  1423. lax_nl_JDK_J1_java_compiler="$rhs"
  1424. ;;
  1425. lax.nl.JDK_J2.java.compiler*)
  1426. lax_nl_JDK_J2_java_compiler="$rhs"
  1427. ;;
  1428. lax.nl.JRE_J1.java.compiler*)
  1429. lax_nl_JRE_J1_java_compiler="$rhs"
  1430. ;;
  1431. lax.nl.JRE_J2.java.compiler*)
  1432. lax_nl_JRE_J2_java_compiler="$rhs"
  1433. ;;
  1434. lax.nl.J1.java.compiler*)
  1435. lax_nl_J1_java_compiler="$rhs"
  1436. ;;
  1437. lax.nl.J2.java.compiler*)
  1438. lax_nl_J2_java_compiler="$rhs"
  1439. ;;
  1440. lax.nl.JRE.java.compiler*)
  1441. lax_nl_JRE_java_compiler="$rhs"
  1442. ;;
  1443. lax.nl.JDK.java.compiler*)
  1444. lax_nl_JDK_java_compiler="$rhs"
  1445. ;;
  1446. lax.nl.ALL.java.compiler*)
  1447. lax_nl_ALL_java_compiler="$rhs"
  1448. ;;
  1449. #
  1450. lax.nl.$osName.JDK_J1.java.compiler*)
  1451. lax_nl_osname_JDK_J1_java_compiler="$rhs"
  1452. ;;
  1453. lax.nl.$osName.JDK_J2.java.compiler*)
  1454. lax_nl_osname_JDK_J2_java_compiler="$rhs"
  1455. ;;
  1456. lax.nl.$osName.JRE_J1.java.compiler*)
  1457. lax_nl_osname_JRE_J1_java_compiler="$rhs"
  1458. ;;
  1459. lax.nl.$osName.JRE_J2.java.compiler*)
  1460. lax_nl_osname_JRE_J2_java_compiler="$rhs"
  1461. ;;
  1462. lax.nl.$osName.J1.java.compiler*)
  1463. lax_nl_osname_J1_java_compiler="$rhs"
  1464. ;;
  1465. lax.nl.$osName.J2.java.compiler*)
  1466. lax_nl_osname_J2_java_compiler="$rhs"
  1467. ;;
  1468. lax.nl.$osName.JRE.java.compiler*)
  1469. lax_nl_osname_JRE_java_compiler="$rhs"
  1470. ;;
  1471. lax.nl.$osName.JDK.java.compiler*)
  1472. lax_nl_osname_JDK_java_compiler="$rhs"
  1473. ;;
  1474. lax.nl.$osName.ALL.java.compiler*)
  1475. lax_nl_osname_ALL_java_compiler="$rhs"
  1476. ;;
  1477. #
  1478. # JIT overrides
  1479. ######################################################
  1480. esac
  1481. done
  1482.  
  1483. debugOut "LAX properties read.................. OK."
  1484.  
  1485. if [ "${lax_class_path:-""}" = "" ]; then
  1486. debugOut "The classpath specified in the LAX properties file"
  1487. debugOut "is invalid. Try reinstalling the program."
  1488. exit;
  1489. fi
  1490. if [ "${lax_nl_java_launcher_main_class:-""}" = "" ]; then
  1491. debugOut "The main class specified in the LAX properties file"
  1492. debugOut "is invalid. Try reinstalling the program."
  1493. exit;
  1494. fi
  1495.  
  1496. if [ ! -z "$INSTALLER_OVERRIDE_VMLIST" ]; then
  1497. lax_nl_valid_vm_list="$INSTALLER_OVERRIDE_VMLIST"
  1498. fi
  1499.  
  1500. ###################################################
  1501. # tlb 2001-09-18
  1502. # Making sure the default UNIX UI mode is honored
  1503. # if overrideDefaultUIMode is not set, which means no commandline
  1504. # options were entered at the commandline regarding
  1505. # ui mode, we will look to the LAX file to set a ui
  1506. # mode. If there is no such setting in the LAX,
  1507. # which would be an error, we default to GUI.
  1508.  
  1509. if [ "$overrideDefaultUIMode" = "false" ]; then
  1510. if [ -n "$lax_installer_unix_ui_default" -a "$ignoreMode" = "false" ]; then
  1511. if [ $lax_installer_unix_ui_default = SILENT ]; then
  1512. isSilent="true"
  1513. cmdLineArgs="$cmdLineArgs -m SILENT"
  1514. uimode="silent"
  1515. elif [ $lax_installer_unix_ui_default = CONSOLE ]; then
  1516. isConsole="true"
  1517. cmdLineArgs="$cmdLineArgs -m CONSOLE"
  1518. uimode="console"
  1519. elif [ $lax_installer_unix_ui_default = GUI ]; then
  1520. isSilent="false"
  1521. isConsole="false"
  1522. uimode="gui"
  1523. fi
  1524. fi
  1525. fi
  1526.  
  1527. ####################################################################################
  1528. #
  1529. # if user.dir != . then relative paths on the classpath will be broken. they
  1530. # are expecting the pwd to be '.' (meaning the install dir). If user.dir is
  1531. # any other directory, it will break
  1532. lax_class_path=`echo "$lax_class_path" | sed 's^;^:^g'`
  1533. absInstallDir=`dirname "$absLauncherName"`
  1534. OFS="$IFS"
  1535. IFS=":"
  1536. set x $lax_class_path; shift
  1537. IFS="$OFS"
  1538. tmp_lcp=""
  1539. while test $# -gt 0; do
  1540. case "$1" in
  1541. \/*)
  1542. if [ "$tmp_lcp" = "" ]; then
  1543. tmp_lcp="$1"
  1544. else
  1545. tmp_lcp="$tmp_lcp:$1"
  1546. fi
  1547. ;;
  1548. *|*\$ENV_CLASSPATH\$*)
  1549. if [ "$tmp_lcp" = "" ]; then
  1550. tmp_lcp="${absInstallDir}/$1"
  1551. else
  1552. tmp_lcp="$tmp_lcp:${absInstallDir}/$1"
  1553. fi
  1554. ;;
  1555. esac
  1556. shift
  1557. done
  1558. lax_class_path="$tmp_lcp"
  1559.  
  1560. # resolve $ENV_CLASSPATH$
  1561. OFS="$IFS"
  1562. IFS=":"
  1563. set x $lax_class_path; shift
  1564. IFS="$OFS"
  1565. tmp_lcp=""
  1566. while test $# -gt 0; do
  1567. case "$1" in
  1568. *\$ENV_CLASSPATH\$*)
  1569. if [ "$tmp_lcp" = "" ]; then
  1570. tmp_lcp="$CLASSPATH"
  1571. else
  1572. tmp_lcp="$tmp_lcp:$CLASSPATH"
  1573. fi
  1574. ;;
  1575. *)
  1576. if [ "$tmp_lcp" = "" ]; then
  1577. tmp_lcp="$1"
  1578. else
  1579. tmp_lcp="$tmp_lcp:$1"
  1580. fi
  1581. ;;
  1582. esac
  1583. shift
  1584. done
  1585. lax_class_path="$tmp_lcp"
  1586.  
  1587.  
  1588.  
  1589. ####################################################################################
  1590. # just incase this the lax was written in DOS, be sure to make all ';' path
  1591. # separators into :'s or it will fubar the commandline
  1592. #
  1593. case "$smclp" in
  1594. *\;*)
  1595. oldIFS=$IFS
  1596. IFS=";"
  1597. for smclp_piece in $smclp; do
  1598. tmp_smclp="$tmp_smclp:$smclp_piece"
  1599. done
  1600. IFS=$oldIFS
  1601. clp=$tmp_smclp
  1602. ;;
  1603. esac
  1604.  
  1605. ##################################################################
  1606. # Setting stdout and stderr redirection
  1607. #
  1608. if [ "$LAX_DEBUG" = "file" -o "$LAX_DEBUG" = "" ]; then
  1609. echo "lax.stderr.redirect=$lax_stderr_redirect" >> $envPropertiesFile
  1610. echo "lax.stdout.redirect=$lax_stdout_redirect" >> $envPropertiesFile
  1611. else
  1612. echo "lax.stderr.redirect=console" >> $envPropertiesFile
  1613. echo "lax.stdout.redirect=console" >> $envPropertiesFile
  1614. lax_stdout_redirect="console"
  1615. lax_stderr_redirect="console"
  1616. fi
  1617.  
  1618. lax_version="4.5"
  1619.  
  1620. validVMtypeList="$lax_nl_valid_vm_list"
  1621.  
  1622. # MMA 04.26.2000
  1623. #
  1624. # Added check for validVMtypeList not being set to any value, in
  1625. # which case we should just set the valid list to all.
  1626. #
  1627. if [ "$validVMtypeList" = "ALL" -o "$validVMtypeList" = "" ]; then
  1628. validVMtypeList=$anyVMlist
  1629. fi
  1630.  
  1631.  
  1632. #############################################################
  1633. # PICK A VALID VM
  1634. #
  1635.  
  1636. debugOut ""
  1637. debugOut "========= Finding VM ================================================="
  1638. debugOut "Valid VM types.......................... $validVMtypeList"
  1639.  
  1640. #
  1641. # If the vm gets a relative path, we must make it absolute to the Install
  1642. # Directory tm 3/3
  1643. #
  1644. if [ ! -z "${lax_nl_current_vm:-""}" ]; then
  1645. # tlb 2001-09-18 updating the LAX to support CD-ROM installations
  1646. # the variable `expr "$lax_nl_current_vm" : '\/'` will evaluate to 1 if the path starts with /
  1647. isAbsPath=`expr "$lax_nl_current_vm" : '\/'`
  1648. if [ "$isAbsPath" = "0" ]; then
  1649. # When running a CD-ROM installer lax_dir is not set, lax_dir is set by the SEA.
  1650. # We set it to the working directory if it is not set
  1651. if [ -z "$lax_dir" ]; then
  1652. lax_dir=`pwd`
  1653. abs_lax_nl_current_vm="${lax_dir}"/"${lax_nl_current_vm}"
  1654. else
  1655. abs_lax_nl_current_vm="${lax_dir}""${lax_nl_current_vm}"
  1656. fi
  1657. else
  1658. abs_lax_nl_current_vm="$lax_nl_current_vm"
  1659. fi
  1660. debugOut "Absolute LAX_VM path.................... $abs_lax_nl_current_vm"
  1661. fi
  1662.  
  1663. #--------------------------------------------------------
  1664. # getJavaVersion()
  1665. #
  1666. # $1: path to java executeable
  1667. #
  1668. # returns:
  1669. # $javaVersion
  1670. #
  1671. getJavaVersion()
  1672. {
  1673. javaExe=$1
  1674. javaVersion=` "${javaExe}" -version 2>&1 | $AWK '
  1675. $3 ~ /"[0-9]\.[0-9]\.[0-9][^"]*"$/ {
  1676. gsub ("[^0-9._]", "", $3)
  1677. print $3
  1678. }
  1679. ' `
  1680. unset javaExe
  1681. }
  1682. #
  1683. #--------------------------------------------------------
  1684.  
  1685. #################################################################################
  1686. # inspectVM()
  1687. #
  1688. # param: a pathname to a potential VM file, maybe a link
  1689. #
  1690. # returns: $inspectedVMpath the real path to the VM file
  1691. # returns: $inspectedVMtype the type of the VM
  1692. # returns: $inspectedOldVMtype ?
  1693. #
  1694. inspectVM()
  1695. {
  1696. resolveLink "$1"
  1697.  
  1698. inspectee="$resolvedLink"
  1699. inspecteeDir=`dirname "$inspectee"`
  1700. inspecteeName=`basename "$inspectee"`
  1701.  
  1702. inspectedVMpath="$inspectee"
  1703.  
  1704. #
  1705. # is it JDK1.1 , JDK1.2 or JRE1.2?
  1706. #
  1707. if [ "$inspecteeName" = "oldjava" ]; then
  1708. inspectedOldVMtype="OLDJAVA"
  1709. inspectedVMtype="OLDJAVA"
  1710. elif [ "$inspecteeName" = "java" ]; then
  1711.  
  1712. ############################################################
  1713. # Do some OS-specific quirky stuff
  1714. #
  1715. # MacOS X / Rhapsody
  1716. #
  1717. quirk_classesZip=""
  1718. if [ "$osName" = "rhapsody" ]; then
  1719. if [ "`expr "$inspecteeDIR" : ".*JavaVM.framework$"`" != "0" ]; then
  1720. quirk_classesZip="$file/Classes/classes.jar"
  1721. inspecteeDir="$inspecteeDir/Home/bin"
  1722. fi
  1723. fi
  1724. # END OS quirky stuff
  1725. ############################################################
  1726.  
  1727. #
  1728. # is it JDK1.1?
  1729. #
  1730. if [ -r "$inspecteeDir/../lib/classes.zip" -o -r "$quirk_classesZip" ]; then
  1731. inspectedOldVMtype="JDK"
  1732. inspectedVMtype="JDK_J1"
  1733. inspectedVMVersion="1.1"
  1734. else
  1735. # JDK1.2
  1736. #
  1737. # is the "java" JRE1.2 or JDK1.2?
  1738. #
  1739. if [ -r "$inspecteeDir/../lib/dt.jar" ]
  1740. then
  1741. inspectedOldVMtype="D12"
  1742. inspectedVMtype="JDK_J2"
  1743. else
  1744. inspectedOldVMtype="R12"
  1745. inspectedVMtype="JRE_J2"
  1746. fi
  1747. #
  1748. # find version
  1749. #
  1750. if [ -r "$inspecteeDir/pack200" ];
  1751. then
  1752. inspectedVMVersion="1.5"
  1753. elif [ -r "$inspecteeDir/client" -o -r "$inspecteeDir/server" -o -r "$inspecteeDir/../jre/bin/server" -o -r "$inspecteeDir/../jre/bin/server" ];
  1754. then
  1755. inspectedVMVersion="1.4"
  1756. elif [ -r "$inspecteeDir/hotspot" -o -r "$inspecteeDir/../jre/bin/hotspot" ];
  1757. then
  1758. inspectedVMVersion="1.3"
  1759. elif [ -r "$inspecteeDir/classic" ];
  1760. then
  1761. inspectedVMVersion="1.2"
  1762. fi
  1763. getJavaVersion $inspectee
  1764. if [ -n "$javaVersion" ]; then
  1765. inspectedVMVersion=$javaVersion
  1766. fi
  1767. unset javaVersion
  1768. fi
  1769. elif [ "$inspecteeName" = "jre" ]; then
  1770. inspectedOldVMtype="JRE"
  1771. inspectedVMtype="JRE_J1"
  1772. inspectedVMVersion="1.1"
  1773. else
  1774. inspectedOldVMtype="UNKNOWN"
  1775. inspectedVMtype="UNKNOWN"
  1776. fi
  1777. }
  1778. ###
  1779. ### end inspectVM()
  1780. ###
  1781. ########################################################################################
  1782.  
  1783.  
  1784. # massage valid VM list. Expand inclusive types (i.e. JRE = JRE_J1 and JRE_J2 )
  1785. tmpValidVMlist=""
  1786. for type in $validVMtypeList; do
  1787. case $type in
  1788. J1) tmpValidVMlist="$tmpValidVMlist JRE_J1 JDK_J1" ;;
  1789. J2) tmpValidVMlist="$tmpValidVMlist JRE_J2 JDK_J2" ;;
  1790. JRE) tmpValidVMlist="$tmpValidVMlist JRE_J2 R12 JRE_J1" ;;
  1791. JDK) tmpValidVMlist="$tmpValidVMlist JDK_J2 D12 JDK_J1" ;;
  1792. *) tmpValidVMlist="$tmpValidVMlist $type " ;;
  1793. esac
  1794. done
  1795. validVMtypeList="$tmpValidVMlist"
  1796. debugOut "Expanded Valid VM types................. $validVMtypeList"
  1797.  
  1798. #--------------------------------------------------------------
  1799. # strictCheck
  1800. # checks that the version passed in matches the 'strict vm
  1801. # selection pattern'
  1802. #
  1803. # $1: vm version
  1804. # $2: pattern to match
  1805. # $3: vm type list
  1806. #
  1807. # returns:
  1808. #
  1809. # exit status:
  1810. # 0 on match, 1 otherwise
  1811.  
  1812. strictCheck()
  1813. {
  1814. vmVersion=$1
  1815. pattern=$2
  1816. types=$3
  1817. eval `$AWK '
  1818. BEGIN {
  1819. if ( ARGV[1] ~ /^(JDK|JRE)_/ ) {
  1820. printf ("version=%s\ntype=%s\n", substr(ARGV[1],5), substr(ARGV[1], 1, 3) );
  1821. } else {
  1822. printf ("version=%s\ntype=%s\n",ARGV[1],"none");
  1823. }
  1824. }
  1825. ' $pattern`
  1826.  
  1827. $AWK '
  1828. function asNum(s) {
  1829. return s+0;
  1830. }
  1831. function versionToNumber(verStr) {
  1832. split(verStr, verVec, "[._+*]");
  1833. return (asNum(verVec[1]) * 1000000) + \
  1834. (asNum(verVec[2]) * 10000) + \
  1835. (asNum(verVec[3]) * 100) + \
  1836. asNum(verVec[4]);
  1837. }
  1838. function subVersionOf(version, pattern) {
  1839. pString = sprintf("%0.8d", pattern);
  1840. vString = sprintf("%0.8d", version);
  1841. sub( "0+$", "", pString );
  1842. return vString ~ "^" + pString;
  1843. }
  1844. BEGIN {
  1845. version = versionToNumber( ARGV[1] );
  1846. pattern = versionToNumber( ARGV[2] );
  1847. op = substr(ARGV[2],length(ARGV[2]) );
  1848. if (op=="+") success = version >= pattern;
  1849. else if (op=="*") success = subVersionOf(version, pattern);
  1850. else success = version == pattern;
  1851. if (success) exit(0);
  1852. exit(1);
  1853. }
  1854. ' "$vmVersion" "$version"
  1855. success=$?
  1856. if [ $success = 0 ]; then
  1857. case "none $types" in
  1858. *$type*)
  1859. debugOut "checking: \"$vmVersion\" against \"$pattern\": passed"
  1860. success=0
  1861. ;;
  1862. *)
  1863. debugOut "checking: \"$vmVersion\" against \"$pattern\": failed (wrong type)"
  1864. success=1
  1865. ;;
  1866. esac
  1867. else
  1868. debugOut "checking: \"$vmVersion\" against \"$pattern\": failed (wrong version)"
  1869. fi
  1870. return $success
  1871. }
  1872.  
  1873. #
  1874. #--------------------------------------------------------------
  1875.  
  1876. # if a VM was forced on the command line use it otherwise search
  1877. if [ "$lax_vm" = "LAX_VM" ]; then
  1878. # Using VM passed in as argument
  1879. inspectVM "$lax_vm_value"
  1880. actvmType="$inspectedVMtype"
  1881. actvm="$lax_vm_value"
  1882. debugOut "* Using VM:.........(LAX_VM)............ $actvm"
  1883. else
  1884. # 1st inspect the lax.nl.current.vm. As long as it is in the
  1885. # valid vm list it takes precedence over everything else.
  1886. laxVMisValid="false"
  1887. # is the lax current vm is specifies
  1888. if [ ! -z "$abs_lax_nl_current_vm" -a -x "$abs_lax_nl_current_vm" ]; then
  1889. # inspect it
  1890. inspectVM "$abs_lax_nl_current_vm"
  1891. eval laxVMtype="$inspectedVMtype"
  1892. eval laxOldVMType="$inspectedOldVMtype"
  1893.  
  1894. # when VM is specified using the lax.nl.current.vm property or the
  1895. # LAX_VM command-line option, just accept that VM, no validation is required
  1896. laxVMisValid="true"
  1897. fi
  1898. # if the lax current vm is valid use it
  1899. if [ "$laxVMisValid" = "true" ]; then
  1900. # dont overwrite the lax.nl.current.vm if this one works just fine
  1901. actvm="$abs_lax_nl_current_vm"
  1902. actvmType="$laxVMtype"
  1903. debugOut "* Using VM.....(lax.nl.current.vm)...... $actvm"
  1904. else
  1905. # other wise search the path
  1906. debugOut "WARNING! No valid lax.nl.current.vm available."
  1907.  
  1908. # sift through the path to look for VMs
  1909.  
  1910. # unique the PATH to limit the amount of work; see bug #6285.
  1911. debugOut "$VM_SEARCH_PATH"
  1912. uniquedPath=`echo $VM_SEARCH_PATH | tr ':' '\012'`
  1913.  
  1914. vmNumber=0;
  1915. OFS="$IFS"
  1916. IFS=":"
  1917. set x $uniquedPath; shift
  1918. IFS="$OFS"
  1919. debugOut "Searching for VMs in PATH:"
  1920. for pathDir in $*; do
  1921. debugOut "Looking in:............................. $pathDir"
  1922. # For each type of binary vm name
  1923. for binaryName in java jre oldjava; do
  1924.  
  1925. vmPath="$pathDir/$binaryName"
  1926.  
  1927. # if the binary exists, is executable and is not a directory...
  1928. if [ -x "$vmPath" -a \( ! -d "$vmPath" \) ]; then
  1929. debugOut " Found VM:............................. $vmPath"
  1930. inspectVM "$vmPath"
  1931. # set up a Bourne-style array of VM props using var1, var2, etc...
  1932. eval vmBinary$vmNumber="$inspectedVMpath"
  1933. eval vmType$vmNumber="$inspectedVMtype"
  1934. eval oldVMtype$vmNumber="$inspectedOldVMtype"
  1935. eval vmVersion$vmNumber="$inspectedVMVersion"
  1936. vmNumber=`expr ${vmNumber:-0} + 1`
  1937. debugOut " Version:............................. $inspectedVMVersion"
  1938. fi
  1939. done
  1940. done
  1941.  
  1942. #########################################
  1943. # VERIFY VMS against valid types
  1944. #
  1945. actvmType=""
  1946. vmHighNumber="$vmNumber"
  1947.  
  1948. # for each type of valid VM
  1949. for validType in $validVMtypeList; do
  1950. vmNumber="0";
  1951.  
  1952. # run through the list of VMs found
  1953. while [ "$vmNumber" -lt $vmHighNumber ]; do
  1954. eval type="$"vmType$vmNumber""
  1955. eval oldType="$"oldVMtype$vmNumber""
  1956. eval bin="$"vmBinary$vmNumber""
  1957. eval version="$"vmVersion$vmNumber""
  1958.  
  1959. # if the type of this VM is of '$type' or '$oldType'
  1960. # make it the actual vm (actvm) to use
  1961. case "${type} ${oldType}" in
  1962. *${validType}*)
  1963. actvm="$bin"
  1964. actvmType="$type"
  1965. debugOut "* Using VM:............................. $actvm"
  1966. break 2
  1967. ;;
  1968. esac
  1969. if strictCheck "$version" "$validType" "$type"; then
  1970. actvm="$bin"
  1971. actvmType="$type"
  1972. debugOut "* Using VM:............................. $actvm"
  1973. break 2
  1974. fi
  1975. vmNumber=`expr ${vmNumber:-0} + 1`
  1976. done
  1977. done
  1978. fi
  1979. fi
  1980.  
  1981. # If no VMs are found in path
  1982. if [ -z "$actvm" ]
  1983. then
  1984. echo "No Java virtual machine could be found from your PATH"
  1985. echo "environment variable. You must install a VM prior to"
  1986. echo "running this program."
  1987.  
  1988. # Mikey [5/16/2000] -- If this was SEA'd then remove the temp directory
  1989. if [ "$IS_INSTALLER" = "true" ]; then
  1990. debugOut "Removing temporary installation directory: \"$lax_user_dir\""
  1991. rm -rf "$lax_user_dir"
  1992. fi
  1993.  
  1994. cd "$olddir"
  1995. exit
  1996. fi
  1997.  
  1998. # write the current vm out to the environment properties
  1999. echo "lax.nl.current.vm=$actvm" >> $envPropertiesFile
  2000.  
  2001. # set up a variable to esilty know if we are going to run 1.1 or 1.2
  2002. # for setting up VM cmd line options later on
  2003. case "$actvmType" in
  2004. "JRE" | "JDK" | "JRE_J1" | "JDK_J1" )
  2005. actvmVersion="1.1"
  2006. ;;
  2007. "R12" | "D12" | "JDK_J2" | "JRE_J2" | "OLDJAVA")
  2008. actvmVersion="1.2"
  2009. ;;
  2010. *)
  2011. actvmVersion=""
  2012. ;;
  2013. esac
  2014.  
  2015. #
  2016. # end of finding VMs
  2017. ##########################################################################################
  2018.  
  2019. ####################################################################################
  2020. # Determining VM invocation options to use
  2021. #
  2022.  
  2023. #
  2024. # Verification
  2025. #
  2026. if [ "$actvmVersion" = "1.1" ]; then
  2027. if [ "$verify" = "off" ]; then
  2028. options="$options -noverify"
  2029. else
  2030. if [ "$verify_mode" = "remote" ]; then
  2031. options="$options -verifyremote"
  2032. elif [ "$verify_mode" = "none" ]; then
  2033. options="$options -noverify"
  2034. elif [ "$verify_mode" = "all" ]; then
  2035. options="$options -verify"
  2036. fi
  2037. fi
  2038. fi
  2039.  
  2040. verbo=${verbo:="none"}
  2041. if [ $verbo = "normal" ]; then
  2042. if [ "$actvmVersion" = "1.1" ]; then
  2043. options="$options -verbose"
  2044. elif [ "$actvmVersion" = "1.2" ]; then
  2045. options="$options -verbose:class"
  2046. fi
  2047. elif [ $verbo = "all" ]; then
  2048. if [ "$actvmVersion" = "1.1" ]; then
  2049. options="$options -verbose -verbosegc"
  2050. elif [ "$actvmVersion" = "1.2" ]; then
  2051. options="$options -verbose:class -verbose:gc"
  2052. fi
  2053. elif [ $verbo = "gc" ]; then
  2054. if [ "$actvmVersion" = "1.1" ]; then
  2055. options="$options -verbosegc"
  2056. elif [ "$actvmVersion" = "1.2" ]; then
  2057. options="$options -verbose:gc"
  2058. fi
  2059. fi
  2060.  
  2061. #
  2062. # Memory mgnt
  2063. #
  2064. gcxtnt=${gcxtnt:="none"}
  2065. if [ $gcxtnt = "min" ]
  2066. then
  2067. if [ "$actvmVersion" = "1.1" ]; then
  2068. options="$options -noclassgc"
  2069. elif [ "$actvmVersion" = "1.2" ]; then
  2070. options="$options -Xnoclassgc"
  2071. fi
  2072. fi
  2073.  
  2074. gcthrd=${gcthrd:="none"}
  2075. if [ "$actvmVersion" = "1.1" ]; then
  2076. if [ $gcthrd = "off" ]
  2077. then
  2078. options="$options -noasyncgc"
  2079. fi
  2080. fi
  2081.  
  2082.  
  2083. nsmax=${nsmax:="none"}
  2084. if [ "$nsmax" != "none" ]; then
  2085. if [ "$actvmVersion" = "1.1" ]; then
  2086. options="$options -ss$nsmax"
  2087. elif [ "$actvmVersion" = "1.2" ]; then
  2088. options="$options -Xss$nsmax"
  2089. fi
  2090. fi
  2091.  
  2092. jsmax=${jsmax:="none"}
  2093. if [ "$jsmax" != "none" ]; then
  2094. if [ "$actvmVersion" = "1.1" ]; then
  2095. options="$options -oss$jsmax"
  2096. elif [ "$actvmVersion" = "1.2" ]; then
  2097. options="$options -Xoss$jsmax"
  2098. fi
  2099. fi
  2100.  
  2101.  
  2102. jhmax=${jhmax:="none"}
  2103. if [ "$jhmax" != "none" ]; then
  2104. if [ "$actvmVersion" = "1.1" ]; then
  2105. options="$options -mx$jhmax"
  2106. elif [ "$actvmVersion" = "1.2" ]; then
  2107. options="$options -Xmx$jhmax"
  2108. fi
  2109. fi
  2110.  
  2111. jhinit=${jhinit:="none"}
  2112. if [ "$jhinit" != "none" ]; then
  2113. if [ "$actvmVersion" = "1.1" ]; then
  2114. options="$options -ms$jhinit"
  2115. elif [ "$actvmVersion" = "1.2" ]; then
  2116. options="$options -Xms$jhinit"
  2117. fi
  2118. fi
  2119.  
  2120. debug=${debug:-"off"}
  2121. if [ $debug != "off" ]; then
  2122. if [ "$actvmVersion" = "1.1" ]; then
  2123. options="$options -debug"
  2124. elif [ "$actvmVersion" = "1.2" ]; then
  2125. options="$options -Xdebug"
  2126. fi
  2127. fi
  2128.  
  2129. ###############################################################
  2130. # JIT options
  2131. # Resetting java home and JIT compiler environment variables
  2132. #
  2133. jitOnOrOff=on;
  2134. #
  2135. # turn off according to VM type
  2136. #
  2137. if [ ! -z "$lax_nl_osname_JDK_J1_java_compiler" -a "$actvmType" = "JDK_J1" ]; then
  2138. jitOnOrOff=$lax_nl_osname_JDK_J1_java_compiler
  2139. elif [ ! -z "$lax_nl_osname_JDK_J2_java_compiler" -a "$actvmType" = "JDK_J2" ]; then
  2140. jitOnOrOff=$lax_nl_osname_JDK_J2_java_compiler
  2141. elif [ ! -z "$lax_nl_osname_JRE_J1_java_compiler" -a "$actvmType" = "JRE_J1" ]; then
  2142. jitOnOrOff=$lax_nl_osname_JRE_J1_java_compiler
  2143. elif [ ! -z "$lax_nl_osname_JRE_J2_java_compiler" -a "$actvmType" = "JRE_J2" ]; then
  2144. jitOnOrOff=$lax_nl_osname_JRE_J2_java_compler
  2145. elif [ ! -z "$lax_nl_osname_J1_java_compiler" -a "$actvmType" = "J1" ]; then
  2146. jitOnOrOff=$lax_nl_osname_J1_java_compiler
  2147. elif [ ! -z "$lax_nl_osname_J2_java_compiler" -a "$actvmType" = "J2" ]; then
  2148. jitOnOrOff=$lax_nl_osname_J2_java_compiler
  2149. elif [ ! -z "$lax_nl_osname_JRE_java_compiler" -a "$actvmType" = "JRE" ]; then
  2150. jitOnOrOff=$lax_nl_osname_JRE_java_compiler
  2151. elif [ ! -z "$lax_nl_osname_JDK_java_compiler" -a "$actvmType" = "JDK" ]; then
  2152. jitOnOrOff=$lax_nl_osname_JDK_java_compiler
  2153. elif [ ! -z "$lax_nl_osname_ALL_java_compiler" ]; then
  2154. jitOnOrOff=$lax_nl_osname_ALL_java_compiler
  2155. #
  2156. elif [ ! -z "$lax_nl_unix_JDK_J1_java_compiler" -a "$actvmType" = "JDK_J1" ]; then
  2157. jitOnOrOff=$lax_nl_unix_JDK_J1_java_compiler
  2158. elif [ ! -z "$lax_nl_unix_JDK_J2_java_compiler" -a "$actvmType" = "JDK_J2" ]; then
  2159. jitOnOrOff=$lax_nl_unix_JDK_J2_java_compiler
  2160. elif [ ! -z "$lax_nl_unix_JRE_J1_java_compiler" -a "$actvmType" = "JRE_J1" ]; then
  2161. jitOnOrOff=$lax_nl_unix_JRE_J1_java_compiler
  2162. elif [ ! -z "$lax_nl_unix_JRE_J2_java_compiler" -a "$actvmType" = "JRE_J2" ]; then
  2163. jitOnOrOff=$lax_nl_unix_JRE_J2_java_compler
  2164. elif [ ! -z "$lax_nl_unix_J1_java_compiler" -a "$actvmType" = "J1" ]; then
  2165. jitOnOrOff=$lax_nl_unix_J1_java_compiler
  2166. elif [ ! -z "$lax_nl_unix_J2_java_compiler" -a "$actvmType" = "J2" ]; then
  2167. jitOnOrOff=$lax_nl_unix_J2_java_compiler
  2168. elif [ ! -z "$lax_nl_unix_JRE_java_compiler" -a "$actvmType" = "JRE" ]; then
  2169. jitOnOrOff=$lax_nl_unix_JRE_java_compiler
  2170. elif [ ! -z "$lax_nl_unix_JDK_java_compiler" -a "$actvmType" = "JDK" ]; then
  2171. jitOnOrOff=$lax_nl_unix_JDK_java_compiler
  2172. elif [ ! -z "$lax_nl_unix_ALL_java_compiler" ]; then
  2173. jitOnOrOff=$lax_nl_unix_ALL_java_compiler
  2174. #
  2175. elif [ ! -z "$lax_nl_JDK_J1_java_compiler" -a "$actvmType" = "JDK_J1" ]; then
  2176. jitOnOrOff=$lax_nl_JDK_J1_java_compiler
  2177. elif [ ! -z "$lax_nl_JDK_J2_java_compiler" -a "$actvmType" = "JDK_J2" ]; then
  2178. jitOnOrOff=$lax_nl_JDK_J2_java_compiler
  2179. elif [ ! -z "$lax_nl_JRE_J1_java_compiler" -a "$actvmType" = "JRE_J1" ]; then
  2180. jitOnOrOff=$lax_nl_JRE_J1_java_compiler
  2181. elif [ ! -z "$lax_nl_JRE_J2_java_compiler" -a "$actvmType" = "JRE_J2" ]; then
  2182. jitOnOrOff=$lax_nl_JRE_J2_java_compler
  2183. elif [ ! -z "$lax_nl_J1_java_compiler" -a "$actvmType" = "J1" ]; then
  2184. jitOnOrOff=$lax_nl_J1_java_compiler
  2185. elif [ ! -z "$lax_nl_J2_java_compiler" -a "$actvmType" = "J2" ]; then
  2186. jitOnOrOff=$lax_nl_J2_java_compiler
  2187. elif [ ! -z "$lax_nl_JRE_java_compiler" -a "$actvmType" = "JRE" ]; then
  2188. jitOnOrOff=$lax_nl_JRE_java_compiler
  2189. elif [ ! -z "$lax_nl_JDK_java_compiler" -a "$actvmType" = "JDK" ]; then
  2190. jitOnOrOff=$lax_nl_JDK_java_compiler
  2191. elif [ ! -z "$lax_nl_ALL_java_compiler" ]; then
  2192. jitOnOrOff=$lax_nl_ALL_java_compiler
  2193. #
  2194. elif [ ! -z "$lax_nl_osname_java_compiler" ]; then
  2195. jitOnOrOff=$lax_nl_osname_java_compiler
  2196. elif [ ! -z "$lax_nl_java_compiler" ]; then
  2197. jitOnOrOff=$lax_nl_java_compiler
  2198. else
  2199. jitOnOrOff=on
  2200. fi
  2201.  
  2202. # JIT is ON by default, so we only need to change its status
  2203. # the above else-if lists figures it should be OFF
  2204. if [ "$jitOnOrOff" = "off" ]; then
  2205. if [ "$actvmVersion" = "1.1" ]; then
  2206. case "$osName" in
  2207. *irix*)
  2208. jitinvoc="-nojit"
  2209. JIT_OPTIONS="-nojit"
  2210. export JIT_OPTIONS
  2211. ;;
  2212. *hp-ux*|*hpux*)
  2213. JIT_OPTIONS="-nojit"
  2214. export JIT_OPTIONS
  2215. jitinvoc="-nojit"
  2216. ;;
  2217. *solaris*|*sunos*)
  2218. jitinvoc="-Djava.compiler="
  2219. ;;
  2220. *aix*)
  2221. JAVA_COMPILER=off
  2222. export JAVA_COMPILER
  2223. ;;
  2224. *freebsd*)
  2225. jitinvoc="-Djava.compiler="
  2226. ;;
  2227. *linux*)
  2228. jitinvoc="-Djava.compiler="
  2229. ;;
  2230. *rhapsody*|*macos*)
  2231. ;;
  2232. *compaq*|*dg*|*osf*)
  2233. jitinvoc="-nojit"
  2234. ;;
  2235. *)
  2236. debugOut "Unknown OS name (\"$osName\"). Cannot set JIT Options."
  2237. ;;
  2238. esac
  2239. elif [ "$actvmVersion" = "1.2" ]; then
  2240. jitinvoc="-Djava.compiler=NONE"
  2241. else
  2242. debugOut "Unknown VM version. Cannot set JIT Options."
  2243. fi
  2244. fi
  2245.  
  2246. options="$jitinvoc $options"
  2247.  
  2248. # set this variable to something so we're guaranteed a value
  2249. linux_LD_ASSUME_KERNEL_hack=0;
  2250.  
  2251. # work around problem on RedHat Linux 7.1 IA-32
  2252. # see Bug Id 4447270 at Sun JDC bug parade
  2253. if [ `cat /etc/redhat-release 2>/dev/null | grep "7\.1" | wc -l` = "1" ];
  2254. then
  2255. if [ `uname -s` = "Linux" ];
  2256. then
  2257. if [ `uname -m` != "ia64" ];
  2258. then
  2259. case `uname -r` in
  2260. 2.[456]*)
  2261. linux_LD_ASSUME_KERNEL_hack=1
  2262. ;;
  2263. esac
  2264. fi
  2265. fi
  2266. fi
  2267.  
  2268. # LD_ASSUME_KERNEL for Native POSIX Threading Library on some Linux distros
  2269. if [ `uname` = "Linux" -a -n "`which strings 2>/dev/null`" ]; then
  2270. debugOut "checking for NPTL + JVM vulernability..."
  2271. #check libc to see if it was compiled with NPTL
  2272. nptl="`strings /lib/libc.so.6 | grep -i nptl`"
  2273. if [ "$nptl" ]; then
  2274. debugOut "NPTL detected! checking for vulnerable JVM....";
  2275.  
  2276. # I have to set this before I check the JVM version, a-cuz
  2277. # the call will hang, if it -is- vulnerable!
  2278. export LD_ASSUME_KERNEL=2.2.5
  2279.  
  2280. $actvm -version > /dev/null 2> /dev/null
  2281. if [ "$?" -eq "0" ]; then
  2282.  
  2283. eval `$actvm -version 2>&1 | $AWK '
  2284. BEGIN {
  2285. vendor="Sun"
  2286. }
  2287. /"[0-9]\.[0-9]\.[0-9][^"]*"$/ {
  2288. gsub ("[\"]", "", $3)
  2289. split ($3, ver, "[\._-]")
  2290. printf "v_major=%s\nv_minor=%s\nv_patch=%s\n",ver[1],ver[2],ver[3]
  2291. }
  2292. /IBM/ {
  2293. vendor="IBM"
  2294. }
  2295. END {
  2296. printf "v_vendor=%s\n",vendor
  2297. }
  2298. ' `
  2299.  
  2300. # unset the LD_ASSUME_KERNEL in cause we don't need it
  2301. unset LD_ASSUME_KERNEL
  2302.  
  2303. debugOut "major : ${v_major}"
  2304. debugOut "minor : ${v_minor}"
  2305. debugOut "patch : ${v_patch}"
  2306. debugOut "vendor: ${v_vendor}"
  2307.  
  2308. # check our rules for setting LD_ASSUME_KERNEL
  2309. # currently, we're only setting this for JVMS < 1.4
  2310. # we can add more rules later, if we need to.
  2311. if [ ${v_minor:-0} -lt 4 ]; then
  2312. debugOut "Vulnerable JVM detected... implementing workaround"
  2313. linux_LD_ASSUME_KERNEL_hack=1
  2314. else
  2315. debugOut "Your JVM is OK! Congratulations!"
  2316. fi
  2317. else
  2318. unset LD_ASSUME_KERNEL
  2319. fi
  2320. fi
  2321. fi
  2322.  
  2323. if [ $linux_LD_ASSUME_KERNEL_hack -eq 1 ]; then
  2324. LD_ASSUME_KERNEL=2.2.5
  2325. export LD_ASSUME_KERNEL
  2326. fi
  2327.  
  2328. ##################################################################################
  2329. # LAUNCH VM
  2330.  
  2331. # Passing in addtional stuff
  2332. options="$options $lax_nl_java_option_additional"
  2333.  
  2334.  
  2335. # Changing working directory
  2336. if [ ! "$lax_user_dir" = "" ]
  2337. then
  2338. if [ ! "$lax_user_dir" = "." ];
  2339. then
  2340. cd "$lax_user_dir"
  2341. fi
  2342. else
  2343. cd "$olddir"
  2344. fi
  2345.  
  2346. # Optional printout of all variable values for debugging purposes
  2347.  
  2348. debugOut ""
  2349. debugOut "========= Virtual Machine Options ===================================="
  2350. debugOut "LAX properties incorporated............. OK."
  2351. debugOut "classpath............................... \"$lax_class_path\""
  2352. debugOut "main class.............................. \"$lax_main_class\""
  2353. debugOut ".lax file path.......................... \"$propfname\""
  2354. debugOut "user directory.......................... \"$lax_user_dir\""
  2355. debugOut "stdout to............................... \"$lax_stdout_redirect\""
  2356. debugOut "sterr to................................ \"$lax_stderr_redirect\""
  2357. debugOut "install directory....................... \"$lax_dir\""
  2358. debugOut "JIT..................................... ${jittype:-"none"}"
  2359. debugOut "option (verify)......................... ${verify:-"none"}"
  2360. debugOut "option (verbosity)...................... ${verbo:-"none"}"
  2361. debugOut "option (garbage collection extent)...... ${gcxtnt:-"none"}"
  2362. debugOut "option (garbage collection thread)...... ${gcthrd:-"none"}"
  2363. debugOut "option (native stack max size).......... ${nsmax:-"none"}"
  2364. debugOut "option (java stack max size)............ ${jsmax:-"none"}"
  2365. debugOut "option (java heap max size)............. ${jhmax:-"none"}"
  2366. debugOut "option (java heap initial size)......... ${jhinit:-"none"}"
  2367. debugOut "option (lax.nl.java.option.additional).. ${lax_nl_java_option_additional:-"none"}"
  2368. resolveLink "$actvm"
  2369. actvm="$resolvedLink"
  2370.  
  2371. actvmBinaryName=`basename "$actvm"`
  2372. # get dirname of binary
  2373. actvmHome=`dirname "$actvm"`
  2374. # is the dir the binary is in named "bin"?
  2375. if [ "`basename "$actvmHome"`" = "bin" ]; then
  2376. # if so then the dir above bin is the java home
  2377. JAVA_HOME=`dirname "$actvmHome"`
  2378. else
  2379. JAVA_HOME=
  2380. fi
  2381.  
  2382. # Making $JAVA_HOME available to the application.
  2383. export JAVA_HOME
  2384.  
  2385. # [RW] reset the locale that what we remember it to be (see use.sh line 22)
  2386. if [ "$IS_INSTALLER" = "true" ]; then
  2387. if [ "X$OLD_LANG" = X ]
  2388. then
  2389. # no locale was defined prior to running this program
  2390. unset LANG
  2391. else
  2392. # there was a locale: revert back to it
  2393. LANG="$OLD_LANG"
  2394. fi
  2395. fi
  2396.  
  2397. ###########################################################################
  2398. # tlb 2001-09-18
  2399. # Moving the checking for the DISPLAY variable down here as there are
  2400. # options in the LAX that might override the need for checking the DISPLAY.
  2401. # Those options need loading before the check is performed.
  2402. # Also making sure we don't report an error when running on Mac OS X.
  2403.  
  2404.  
  2405. debugOut ""
  2406. debugOut "========= Display settings ==========================================="
  2407. #
  2408. # check the display
  2409. #
  2410. isRemoteDisplay="false"
  2411. if [ "$IS_INSTALLER" = "true" -a "$isConsole" = "false" -a "$isSilent" = "false" -a ! "$osName" = "darwin" ]; then
  2412. hostname=`hostname`
  2413. isRemoteDisplay="true"
  2414. for display in ${hostname}:0 ${hostname}:0.0 localhost:0 localhost:0.0 unix:0 unix:0.0 :0 :0.0
  2415. do
  2416. if [ "$DISPLAY" = "$display" ]; then
  2417. isRemoteDisplay="false";
  2418. fi
  2419. done
  2420. fi
  2421.  
  2422. xDisp="local"
  2423. if [ "$isRemoteDisplay" = "true" ]; then
  2424. xDisp="remote"
  2425. fi
  2426. if [ -z "$DISPLAY" ]; then
  2427. xDisp="not set"
  2428. fi
  2429. debugOut "X display............................... $xDisp"
  2430.  
  2431.  
  2432. if [ -z "$DISPLAY" -a "$uimode" = "gui" ]; then
  2433. debugOut "WARNING: This shell's DISPLAY variable has not been set."
  2434. debugOut "This installer is configured to run in GUI and will probably"
  2435. debugOut "fail. Try running this installer in console or silent mode,"
  2436. debugOut "or on another UNIX host which has the DISPLAY variable set,"
  2437. debugOut "if the installer unexpectedly fails."
  2438. else
  2439. if [ "$isRemoteDisplay" = "true" -a "$uimode" = "gui" ]; then
  2440. debugOut "WARNING: The name of this host ($hostname) and the setting"
  2441. debugOut "of this shell's DISPLAY ($DISPLAY) variable do not match."
  2442. debugOut "If this launcher is being displayed to a Microsoft Windows desktop"
  2443. debugOut "through X Windows the Java Virtual Machine might abort. Try running"
  2444. debugOut "this installer locally on the target system or through X Windows to"
  2445. debugOut "another UNIX host if the installer unexpectedly fails."
  2446. fi
  2447. fi
  2448.  
  2449. debugOut "UI mode................................. $uimode"
  2450.  
  2451.  
  2452. # COMMENT ME TO REMOVE OUTPUT FROM NORMAL INSTALLER EXECUTION
  2453. if [ "$IS_INSTALLER" = "true" -a "$uimode" != "silent" ]; then
  2454. echo ""
  2455. echo "Launching installer..."
  2456. echo ""
  2457. fi
  2458.  
  2459. # MMA - clear ENV to address a problem where the shell initialization
  2460. # file (.Xshrc) pointed to by ENV may overide the classpath we have just set,
  2461. # causing the app to fail. Drawback is that other environment variables set
  2462. # in the init file will not be available in the environment (they will be
  2463. # available as Java system properties, however). Comment out the two lines
  2464. # below to change this behavior.
  2465. ENV=
  2466. export ENV
  2467. # I split these up so they would be a bit clearer on the screen.
  2468.  
  2469. #debugOut ""
  2470. debugOut "========= VM Command Line ============================================"
  2471. #debugOut "CLASSPATH=$lax_class_path"
  2472. #debugOut "\"$actvm\" $options $lax_nl_java_launcher_main_class \"$propfname\" \"$envPropertiesFile\" $cmdLineArgs"
  2473. #debugOut "$command"
  2474. debugOut "options: $options"
  2475. # Here is where we actually run the app in Java:
  2476.  
  2477. CLASSPATH="$lax_class_path:$CLASSPATH"; export CLASSPATH
  2478. debugOut "CLASSPATH:$CLASSPATH"
  2479.  
  2480. if [ "`echo $actvm | grep 'jre$'`" ]; then
  2481. cpArg="-cp"
  2482. fi
  2483.  
  2484. debugOut ""
  2485. unset POSIXLY_CORRECT
  2486. if [ $DO_NOT_FORK ]
  2487. then
  2488. debugOut "========= Executing JAVA ============================================="
  2489. # this is the original, it's still here for copy/paste purposes
  2490. #eval \"$actvm\" $options $lax_nl_java_launcher_main_class \"$propfname\" \"$envPropertiesFile\" $cmdLineArgs
  2491.  
  2492. lax_class_path=\"$lax_class_path\"
  2493. if [ $cpArg ]; then
  2494. command="\"$actvm\" $options $cpArg \"$CLASSPATH\" $lax_nl_java_launcher_main_class \"$propfname\" \"$envPropertiesFile\""
  2495. else
  2496. command="\"$actvm\" $options $lax_nl_java_launcher_main_class \"$propfname\" \"$envPropertiesFile\""
  2497. fi
  2498. eval $command $cmdLineArgs
  2499. else
  2500. debugOut "========= Forking JAVA ============================================="
  2501. if [ $cpArg ]; then
  2502. exec "$actvm" $options $cpArg "$CLASSPATH" $lax_nl_java_launcher_main_class "$propfname" "$envPropertiesFile" $cmdLineArgs
  2503. else
  2504. exec "$actvm" $options $lax_nl_java_launcher_main_class "$propfname" "$envPropertiesFile" $cmdLineArgs
  2505. fi
  2506. fi
  2507. exitValue=$?
  2508. debugOut "========= JAVA Finished =============================================="
  2509. debugOut ""
  2510.  
  2511. # Change back to directory used priory to this script running.
  2512.  
  2513. cd "$olddir"
  2514.  
  2515. exit $exitValue
  2516.  
  2517. if [ -f $ZIPLOC/sea_loc ] ; then
  2518. rm -Rf $ZIPLOC
  2519. fi
  2520.  
  2521. exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement