-
Notifications
You must be signed in to change notification settings - Fork 4
/
IPMIView20
executable file
·1725 lines (1578 loc) · 46.9 KB
/
IPMIView20
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/bin/sh
#################################################################################################
#
# LAXUNIX.SH - LaunchAnywhere (tm) version 7.0
#
# (c) Copyright 1999-2005 Zero G Software, Inc., all rights reserved.
#
# To run this script you will need to have the following:
# 1) a Java VM installed (however, it will handle a lack of Java nicely).
# 2) a Java-style properties file having the same name as this script
# with the suffix .lax. If this script is appended to the
# self-extractor, it will look for the properties file in the
# directory specified by $seLaxPath; otherwise, it will look in
# the same directory that this script is in.
# 3) a Java program in the file "lax.jar".
#
# The .lax property file must contain at least the following properties:
# 1) lax.class.path classpath (do not include the environment variable $CLASSPATH )
# 2) lax.nl.java.launcher.main.class (main class of LaunchAnywhere Executable)
#
#################################################################################################
#
# Since USERENV is already set in the self-extractor, if its not set we know
# this is not an installer but a separate launcher.
# USERENV is just a flag passed from use.sh.
#
IS_INSTALLER=''
[ $USERENV ] && IS_INSTALLER=true
#
# later on we might add things to the PATH, but we want to preserve the PATH
# order for which VMs are the first ones found.
#
VM_SEARCH_PATH="$PATH"
####################################################################################
# Set some constants
if [ "$1" = "LAX_VM" ]; then
lax_vm="LAX_VM"
lax_vm_value="$2"
shift 2
else
lax_vm=""
fi
anyVMlist="JDK_J2 D12 JRE_J2 R12 JDK_J1 JRE_J1 JDK JRE ALL"
####################################################################################
# Format commandline args
# To overcome the problem of quoted args (with internal spaces) to the launcher
# is that they get "unquoted" or separated into discreet args when they are put
# on the cmdline for the application. This following block makes sure the stay intact
overrideDefaultUIMode="false"
ignoreMode="false";
uimode="not set"
hasSeenI="false"
tmpArgs=""
origArgs=$@
for arg in "$@"
do
if [ "$arg" != "" ]; then
tmpArgs="$tmpArgs \"$arg\""
if [ "$arg" = "-i" -o "$arg" = "-I" ]; then
hasSeenI="true"
elif [ "$hasSeenI" = "true" ]; then
lowerArg=`echo $arg | tr "[:upper:]" "[:lower:]"`
if [ "$lowerArg" = "awt" ]; then
uimode="awt"
overrideDefaultUIMode="true"
elif [ "$lowerArg" = "swing" ]; then
uimode="swing"
overrideDefaultUIMode="true"
elif [ "$lowerArg" = "gui" ]; then
uimode="gui"
overrideDefaultUIMode="true"
elif [ "$lowerArg" = "console" ]; then
uimode="console"
overrideDefaultUIMode="true"
elif [ "$lowerArg" = "text" ]; then
uimode="console"
overrideDefaultUIMode="true"
elif [ "$lowerArg" = "silent" ]; then
uimode="silent"
overrideDefaultUIMode="true"
else
ignoreMode="true"
fi
fi
fi
done
cmdLineArgs="$tmpArgs"
thisScript="$0"
# make sure thisScript is an abs path
case $thisScript in
/*)
;;
*)
thisScript="`pwd`/$thisScript"
;;
esac
####################################################################################
#
# WHere does the LAX_DEBUG output go?
#
if [ "$LAX_DEBUG" = "file" ]; then
jx_log="`pwd`/jx.log"
rm -f "$jx_log"
touch "$jx_log"
if [ "$?" -gt "0" ]; then
jx_log_ok="false"
echo "Could not create $jx_log. Sending debug output to console."
else
jx_log_ok="true"
fi
fi
debugOut()
{
case "$LAX_DEBUG" in
"file" )
if [ "$jx_log_ok" = "true" ]; then
echo "$1" >> "$jx_log"
else
echo "$1"
fi
;;
"" )
echo "$1" >> /dev/null
;;
* )
echo "$1"
;;
esac
}
####################################################################################
#
# UNIX ENVIRONMENT configuration
#
debugOut ""
debugOut "[7m========= Analyzing UNIX Environment =================================[0m"
# Get os type , note that it is LOWER-CASED. Used here and later on
osName=`uname -s 2> /dev/null | tr "[:upper:]" "[:lower:]" 2> /dev/null`
debugOut "Setting UNIX ($osName) flavor specifics."
vmScript=".java_wrapper"
case "$osName" in
*irix*)
cpuName="unknown"
;;
*hp-ux*|*hpux*)
cpuName=`uname -m 2> /dev/null`
;;
*solaris*|*sunos*)
cpuName=`uname -p 2> /dev/null`
THREADS_FLAG=""; export THREADS_FLAG
PATH=/usr/bin:$PATH; export PATH
;;
*aix*)
cpuName="unknown"
;;
*freebsd*)
cpuName=`uname -p 2> /dev/null`
;;
*linux*)
cpuName=`uname -m 2> /dev/null`
;;
# tlb 2001-09-18 updating to support Darwin
*rhapsody*|*darwin*)
cpuName=`uname -p 2> /dev/null`
vmScript=".java_command"
;;
*compaq*|*dg*|*osf*)
cpuName="unknown"
;;
*)
cpuName="unknown"
;;
esac
if [ -x /bin/ls ]; then
lsCMD="/bin/ls"
elif [ -x /usr/bin/ls ]; then
lsCMD="/usr/bin/ls"
else
lsCMD="ls"
fi
debugOut "Importing UNIX environment into LAX properties."
####################################################################################
#
# CREATE ENV.PROPERTIES and figure out if this is being exec'd from an installer
#
# We need POSIX awk. On some systems it's called awk, on others
# nawk. It's most frequently called nawk, so start with that.
#
debugOut "Checking for POSIX awk."
AWK=nawk
( $AWK '{}' ) < /dev/null 2>&0 || AWK=awk
if [ -z "$IATEMPDIR" ]; then
TMPDIR=/tmp
else
TMPDIR=$IATEMPDIR
fi
if [ -z "$envPropertiesFile" ]
then
if [ -d $TMPDIR ]
then
envPropertiesFile=$TMPDIR/env.properties.$$
else
envPropertiesFile="$HOME/env.properties.$$"
fi
fi
#
# Convert environment variables to LAX properties. The variables
# are also named with alternate case (all upper, all lower).
#
# E.g.
# export My_Env_Var="abc
# def"
#
# is converted to:
# lax.nl.env.exact_case.My_Env_Var=abc def
# lax.nl.env.MY_ENV_VAR=abc def
# lax.nl.env.my_env_var=abc def
#
# The second gsub() is used to escape backslashes so that when the properties
# file is read by the java.util.Properties object, there is not a problem
# with incorrectly interpreted escaped unicode.
#
# This code segment is written in POSIX awk for performance reasons.
#
$AWK -v LAX_PREFIX=lax.nl.env. '
END {
for (var in ENVIRON)
{
# get variable value
value = ENVIRON[var]
# strip newlines
gsub(/\n/, " ", value)
# convert one backslash to two
gsub(/\\/, "\\\\", value)
# print as LAX property
print LAX_PREFIX "exact_case." var "=" value
print LAX_PREFIX tolower(var) "=" value
print LAX_PREFIX toupper(var) "=" value
}
}' < /dev/null > $envPropertiesFile
####################################################################################
#
# Tracing symbolic links to actual launcher location
#
resolveLink()
{
rl_linked="true"
rl_operand="$1"
rl_origDir="`dirname "$1"`"
# bypass the whole thing if this isnt a link
rl_ls=`$lsCMD -l "$rl_operand"`
case "$rl_ls" in
*"->"*)
;;
*)
resolvedLink="$rl_operand"
return
;;
esac
while [ "$rl_linked" = "true" ]; do
# if the operand is not of an abs path, get its abs path
case "$rl_operand" in
/*)
rl_origDir=`dirname "$rl_operand"`
;;
\./*)
rl_origDir=`pwd`
rl_operand="$rl_origDir/$rl_operand"
;;
*)
rl_operand="$rl_origDir/$rl_operand"
;;
esac
#
# the prevPrev hack is here because .../java often points to .java_wrapper.
# at the end of the resolution rl_operand actually points to garbage
# signifying it is done resolving the link. So prev is actually .java_wrapper.
# but we want the one just before that, its the real vm starting poiint we want
#
rl_prevOperand="$rl_operand"
rl_ls=`$lsCMD -l "$rl_operand"`
# get the output ls into a list
set x $rl_ls
# get rid of x and file info from ls -l
shift 9
#is this a link?
case "$rl_ls" in
*"->"*)
rl_linked="true"
# is a link, shift past the "->"
rl_linker=""
while [ "$1" != "->" -a $# -gt 1 ]; do
rl_linker="$rl_linker $1"
shift
done
if [ "$1" = "->" ]; then
shift
fi
;;
*)
# not a link, the rest must be the targets name
rl_linked="false"
;;
esac
# now grab what's left
rl_linkee="$*"
# debugOut "Following link to LAX $rl_linker -> $rl_linkee"
if [ "$rl_linked" = "true" -a "`basename "$rl_linkee"`" != "$vmScript" ]; then
# set to true incase the thing linked to is also a link and we can
# try again. The current think linked to now becomes the operand
rl_operand="$rl_linkee"
# if the linkee is not abs, make it abs relative to the linker
case "$rl_operand" in
/*)
;;
*)
rl_operand="$rl_origDir/$rl_operand"
;;
esac
else
# otherwise, this operand is not a link itself and we are done
rl_resolvedLink="$rl_prevOperand"
# however, do not resolve the last leg of a VMs linked scripts. this will
# disrupt their scripts. it is expecting a link to the .java* script
# let us believe it is not linked and continue on...
if [ "`basename "$rl_linkee"`" = "$vmScript" ]; then
rl_linked="false"
fi
fi
# make sure the path returned is absolute
case "$rl_operand" in
\.\/*)
rl_operand="`pwd`/$rl_operand"
;;
esac
done
# remove "/./" in paths, make it "/"
# i,e, "/a/b/./c" becomes "/a/b/c"
resolvedLink=`echo "$rl_resolvedLink" | sed 's,/\./,/,'`
}
####################################################################################
#
# FINDING THE LAX FILE
#
# If this is an installer, use $seLaxPath
#
debugOut ""
debugOut "[7m========= Analyzing LAX ==============================================[0m"
olddir=`pwd`
resolveLink "$thisScript"
absLauncherName="$resolvedLink"
cd "`dirname "$absLauncherName"`"
if [ "$IS_INSTALLER" != "" ]; then
if [ ! -z "$seLaxPath" ]; then
propfname="$seLaxPath"
else
# legacy for old self-extractors
propfname="$templaxpath"
fi
else
propfname="$absLauncherName.lax"
fi
if [ ! -r "$propfname" ]; then
debugOut "The file "$propfname" could"
debugOut "not be found, and the program cannot be run without it."
debugOut "Try reinstalling the program."
exit;
else
debugOut "LAX found............................ OK."
fi
####################################################################################
#
# READING THE LAX FILE
#
OFS="$IFS"
# run prop file through sed calls that do:
# 1. transform first '=' on a line into a control-O
# 2. transform all other ='s to control-F
# 3. transform control-Os back to =
# this is to differentiate the lhs=rhs processing from confusing the first = from other
# = that might be part of the value. Later on those =-tranformed-to-control-Fs are
# transformed back to = signs.
set x `cat "$propfname" | sed -e 's~^\([^\=]*\)\=\(.*\)~\1\\2~g' -e 's~=~~g' -e 's~~=~g' | grep '='`; shift
while test $# -gt 0; do
# line separator
case "x${1}x" in
*"="* ) BIFS=" "; ;;
* ) BIFS="" ; ;;
esac
# word separator
case "x${2}x" in
*"="* ) AIFS=""; ;;
* ) AIFS=""; ;;
esac
INPUT="$INPUT$BIFS$1$AIFS"
shift
done
while test "x$INPUT" != "x"; do
set x $INPUT; shift
X="$1"
shift
INPUT="$@"
IFS="=$AIFS"
set x $X; shift
IFS="$OFS"
lhs="${1}"
shift
rhs="$@"
# transform non lhs=rhs delimiting = signs back from ^F to =
case "$rhs" in
**)
rhs=`echo $rhs | sed 's~~=~g'`
;;
esac
# assing the values
case $lhs in
lax.class.path*)
lax_class_path="$rhs"
;;
lax.main.class*)
lax_main_class="$rhs"
;;
lax.nl.java.launcher.main.class*)
lax_nl_java_launcher_main_class="$rhs"
;;
lax.nl.current.vm*)
lax_nl_current_vm="$rhs"
;;
lax.user.dir*)
lax_user_dir="$rhs"
lax_user_dir=`echo $lax_user_dir | sed 's;^[ ]*\(.*\)[ ]*$;\1;'`
;;
lax.resource.dir*)
lax_resource_dir="$rhs"
lax_resource_dir=`echo $lax_resource_dir | sed 's;^[ ]*\(.*\)[ ]*$;\1;'`
;;
lax.stdout.redirect*)
lax_stdout_redirect="$rhs"
;;
lax.stderr.redirect*)
lax_stderr_redirect="$rhs"
;;
lax.dir*)
lax_dir="$rhs"
;;
lax.always.ask*)
lax_always_ask="$rhs"
;;
lax.application.name*)
lax_application_name="$rhs"
;;
lax.nl.message.vm.not.loaded*)
lax_nl_message_vm_loaded="$rhs"
;;
lax.nl.valid.vm.list*)
# transform an blank value to "ALL"
case "$rhs" in
"") rhs="ALL"; ;;
esac
lax_nl_valid_vm_list="$rhs"
;;
lax.nl.java.option.check.source*)
verify="$rhs"
;;
lax.nl.java.option.verify.mode*)
verify_mode="$rhs"
;;
lax.nl.java.option.verbose*)
verbo="$rhs"
;;
lax.nl.java.option.garbage.collection.extent*)
gcxtnt="$rhs"
;;
lax.nl.java.option.garbage.collection.background.thread*)
gcthrd="$rhs"
;;
lax.nl.java.option.native.stack.size.max*)
nsmax="$rhs"
;;
lax.nl.java.option.java.stack.size.max*)
jsmax="$rhs"
;;
lax.nl.java.option.java.heap.size.max*)
jhmax="$rhs"
;;
lax.nl.java.option.java.heap.size.initial*)
jhinit="$rhs"
;;
lax.nl.java.option.debugging*)
debug="$rhs"
;;
lax.nl.$osName.$cpuName.java.compiler*)
lax_nl_osname_cpuname_java_compiler="$rhs"
;;
lax.nl.$osName.java.compiler*)
lax_nl_osname_java_compiler="$rhs"
;;
lax.nl.java.compiler*)
lax_nl_java_compiler="$rhs"
;;
lax.nl.java.option.additional*)
lax_nl_java_option_additional="$rhs"
;;
######################################################
# tlb 2001-09-18
# Reading default UI mode for UNIX
lax.installer.unix.ui.default*)
lax_installer_unix_ui_default="$rhs"
;;
######################################################
# JIT overrides
lax.nl.unix.JDK_J1.java.compiler*)
lax_nl_unix_JDK_J1_java_compiler="$rhs"
;;
lax.nl.unix.JDK_J2.java.compiler*)
lax_nl_unix_JDK_J2_java_compiler="$rhs"
;;
lax.nl.unix.JRE_J1.java.compiler*)
lax_nl_unix_JRE_J1_java_compiler="$rhs"
;;
lax.nl.unix.JRE_J2.java.compiler*)
lax_nl_unix_JRE_J2_java_compiler="$rhs"
;;
lax.nl.unix.J1.java.compiler*)
lax_nl_unix_J1_java_compiler="$rhs"
;;
lax.nl.unix.J2.java.compiler*)
lax_nl_unix_J2_java_compiler="$rhs"
;;
lax.nl.unix.JRE.java.compiler*)
lax_nl_unix_JRE_java_compiler="$rhs"
;;
lax.nl.unix.JDK.java.compiler*)
lax_nl_unix_JDK_java_compiler="$rhs"
;;
lax.nl.unix.ALL.java.compiler*)
lax_nl_unix_ALL_java_compiler="$rhs"
;;
#
lax.nl.JDK_J1.java.compiler*)
lax_nl_JDK_J1_java_compiler="$rhs"
;;
lax.nl.JDK_J2.java.compiler*)
lax_nl_JDK_J2_java_compiler="$rhs"
;;
lax.nl.JRE_J1.java.compiler*)
lax_nl_JRE_J1_java_compiler="$rhs"
;;
lax.nl.JRE_J2.java.compiler*)
lax_nl_JRE_J2_java_compiler="$rhs"
;;
lax.nl.J1.java.compiler*)
lax_nl_J1_java_compiler="$rhs"
;;
lax.nl.J2.java.compiler*)
lax_nl_J2_java_compiler="$rhs"
;;
lax.nl.JRE.java.compiler*)
lax_nl_JRE_java_compiler="$rhs"
;;
lax.nl.JDK.java.compiler*)
lax_nl_JDK_java_compiler="$rhs"
;;
lax.nl.ALL.java.compiler*)
lax_nl_ALL_java_compiler="$rhs"
;;
#
lax.nl.$osName.JDK_J1.java.compiler*)
lax_nl_osname_JDK_J1_java_compiler="$rhs"
;;
lax.nl.$osName.JDK_J2.java.compiler*)
lax_nl_osname_JDK_J2_java_compiler="$rhs"
;;
lax.nl.$osName.JRE_J1.java.compiler*)
lax_nl_osname_JRE_J1_java_compiler="$rhs"
;;
lax.nl.$osName.JRE_J2.java.compiler*)
lax_nl_osname_JRE_J2_java_compiler="$rhs"
;;
lax.nl.$osName.J1.java.compiler*)
lax_nl_osname_J1_java_compiler="$rhs"
;;
lax.nl.$osName.J2.java.compiler*)
lax_nl_osname_J2_java_compiler="$rhs"
;;
lax.nl.$osName.JRE.java.compiler*)
lax_nl_osname_JRE_java_compiler="$rhs"
;;
lax.nl.$osName.JDK.java.compiler*)
lax_nl_osname_JDK_java_compiler="$rhs"
;;
lax.nl.$osName.ALL.java.compiler*)
lax_nl_osname_ALL_java_compiler="$rhs"
;;
#
# JIT overrides
######################################################
esac
done
debugOut "LAX properties read.................. OK."
if [ "${lax_class_path:-""}" = "" ]; then
debugOut "The classpath specified in the LAX properties file"
debugOut "is invalid. Try reinstalling the program."
exit;
fi
if [ "${lax_nl_java_launcher_main_class:-""}" = "" ]; then
debugOut "The main class specified in the LAX properties file"
debugOut "is invalid. Try reinstalling the program."
exit;
fi
if [ ! -z "$INSTALLER_OVERRIDE_VMLIST" ]; then
lax_nl_valid_vm_list="$INSTALLER_OVERRIDE_VMLIST"
fi
###################################################
# tlb 2001-09-18
# Making sure the default UNIX UI mode is honored
# if overrideDefaultUIMode is not set, which means no commandline
# options were entered at the commandline regarding
# ui mode, we will look to the LAX file to set a ui
# mode. If there is no such setting in the LAX,
# which would be an error, we default to GUI.
if [ "$overrideDefaultUIMode" = "false" ]; then
if [ -n "$lax_installer_unix_ui_default" -a "$ignoreMode" = "false" ]; then
if [ $lax_installer_unix_ui_default = SILENT ]; then
isSilent="true"
cmdLineArgs="$cmdLineArgs -m SILENT"
uimode="silent"
elif [ $lax_installer_unix_ui_default = CONSOLE ]; then
isConsole="true"
cmdLineArgs="$cmdLineArgs -m CONSOLE"
uimode="console"
elif [ $lax_installer_unix_ui_default = GUI ]; then
# Uncomment the following if statement and comment out the three lines after
# this comment to enable failsafe operation of installers when X is missing
# FAILSAFE
# if [ -z "$DISPLAY" ]; then
# isSilent="false"
# isConsole="true"
# cmdLineArgs="$cmdLineArgs -m CONSOLE"
# uimode="console"
# debugOut "[1mWARNING! DISPLAY variable not set. Will attempt to run installer in CONSOLE mode.[0m"
# else
# isSilent="false"
# isConsole="false"
# uimode="gui"
# fi
# comment the following three lines out when changing to FAILSAFE
isSilent="false"
isConsole="false"
uimode="gui"
fi
fi
fi
####################################################################################
#
# if user.dir != . then relative paths on the classpath will be broken. they
# are expecting the pwd to be '.' (meaning the install dir). If user.dir is
# any other directory, it will break
lax_class_path=`echo "$lax_class_path" | sed 's^;^:^g'`
absInstallDir=`dirname "$absLauncherName"`
OFS="$IFS"
IFS=":"
set x $lax_class_path; shift
IFS="$OFS"
tmp_lcp=""
while test $# -gt 0; do
case "$1" in
\/*)
if [ "$tmp_lcp" = "" ]; then
tmp_lcp="$1"
else
tmp_lcp="$tmp_lcp:$1"
fi
;;
*|*\$ENV_CLASSPATH\$*)
if [ "$tmp_lcp" = "" ]; then
tmp_lcp="${absInstallDir}/$1"
else
tmp_lcp="$tmp_lcp:${absInstallDir}/$1"
fi
;;
esac
shift
done
lax_class_path="$tmp_lcp"
# resolve $ENV_CLASSPATH$
OFS="$IFS"
IFS=":"
set x $lax_class_path; shift
IFS="$OFS"
tmp_lcp=""
while test $# -gt 0; do
case "$1" in
*\$ENV_CLASSPATH\$*)
if [ "$tmp_lcp" = "" ]; then
tmp_lcp="$CLASSPATH"
else
tmp_lcp="$tmp_lcp:$CLASSPATH"
fi
;;
*)
if [ "$tmp_lcp" = "" ]; then
tmp_lcp="$1"
else
tmp_lcp="$tmp_lcp:$1"
fi
;;
esac
shift
done
lax_class_path="$tmp_lcp"
####################################################################################
# just incase this the lax was written in DOS, be sure to make all ';' path
# separators into :'s or it will fubar the commandline
#
case "$smclp" in
*\;*)
oldIFS=$IFS
IFS=";"
for smclp_piece in $smclp; do
tmp_smclp="$tmp_smclp:$smclp_piece"
done
IFS=$oldIFS
clp=$tmp_smclp
;;
esac
##################################################################
# Setting stdout and stderr redirection
#
if [ "$LAX_DEBUG" = "file" -o "$LAX_DEBUG" = "" ]; then
echo "lax.stderr.redirect=$lax_stderr_redirect" >> $envPropertiesFile
echo "lax.stdout.redirect=$lax_stdout_redirect" >> $envPropertiesFile
else
echo "lax.stderr.redirect=console" >> $envPropertiesFile
echo "lax.stdout.redirect=console" >> $envPropertiesFile
lax_stdout_redirect="console"
lax_stderr_redirect="console"
fi
lax_version="4.5"
validVMtypeList="$lax_nl_valid_vm_list"
# MMA 04.26.2000
#
# Added check for validVMtypeList not being set to any value, in
# which case we should just set the valid list to all.
#
if [ "$validVMtypeList" = "ALL" -o "$validVMtypeList" = "" ]; then
validVMtypeList=$anyVMlist
fi
#############################################################
# PICK A VALID VM
#
debugOut ""
debugOut "[7m========= Finding VM =================================================[0m"
debugOut "[1mValid VM types.......................... $validVMtypeList[0m"
#
# If the vm gets a relative path, we must make it absolute to the Install
# Directory tm 3/3
#
if [ ! -z "${lax_nl_current_vm:-""}" ]; then
# tlb 2001-09-18 updating the LAX to support CD-ROM installations
# the variable `expr "$lax_nl_current_vm" : '\/'` will evaluate to 1 if the path starts with /
isAbsPath=`expr "$lax_nl_current_vm" : '\/'`
if [ "$isAbsPath" = "0" ]; then
# When running a CD-ROM installer lax_dir is not set, lax_dir is set by the SEA.
# We set it to the working directory if it is not set
if [ -z "$lax_dir" ]; then
lax_dir=`pwd`
abs_lax_nl_current_vm="${lax_dir}"/"${lax_nl_current_vm}"
else
abs_lax_nl_current_vm="${lax_dir}""${lax_nl_current_vm}"
fi
else
abs_lax_nl_current_vm="$lax_nl_current_vm"
fi
debugOut "Absolute LAX_VM path.................... $abs_lax_nl_current_vm"
fi
#--------------------------------------------------------
# getJavaVersion()
#
# $1: path to java executeable
#
# returns:
# $javaVersion
#
getJavaVersion()
{
javaExe=$1
javaVersion=` "${javaExe}" -version 2>&1 | $AWK '
$3 ~ /"[0-9]\.[0-9]\.[0-9][^"]*"$/ {
gsub ("[^0-9._]", "", $3)
print $3
}
' `
unset javaExe
}
#
#--------------------------------------------------------
#################################################################################
# inspectVM()
#
# param: a pathname to a potential VM file, maybe a link
#
# returns: $inspectedVMpath the real path to the VM file
# returns: $inspectedVMtype the type of the VM
# returns: $inspectedOldVMtype ?
#
inspectVM()
{
resolveLink "$1"
inspectee="$resolvedLink"
inspecteeDir=`dirname "$inspectee"`
inspecteeName=`basename "$inspectee"`
inspectedVMpath="$inspectee"
#
# is it JDK1.1 , JDK1.2 or JRE1.2?
#
if [ "$inspecteeName" = "oldjava" ]; then
inspectedOldVMtype="OLDJAVA"
inspectedVMtype="OLDJAVA"
elif [ "$inspecteeName" = "java" ]; then
############################################################
# Do some OS-specific quirky stuff
#
# MacOS X / Rhapsody
#
quirk_classesZip=""
if [ "$osName" = "rhapsody" ]; then
if [ "`expr "$inspecteeDIR" : ".*JavaVM.framework$"`" != "0" ]; then
quirk_classesZip="$file/Classes/classes.jar"
inspecteeDir="$inspecteeDir/Home/bin"
fi
fi
# END OS quirky stuff
############################################################
#
# is it JDK1.1?
#
if [ -r "$inspecteeDir/../lib/classes.zip" -o -r "$quirk_classesZip" ]; then
inspectedOldVMtype="JDK"
inspectedVMtype="JDK_J1"
inspectedVMVersion="1.1"
else
# JDK1.2
#
# is the "java" JRE1.2 or JDK1.2?
#
if [ -r "$inspecteeDir/../lib/dt.jar" ]
then
inspectedOldVMtype="D12"
inspectedVMtype="JDK_J2"
else
inspectedOldVMtype="R12"
inspectedVMtype="JRE_J2"
fi
#
# find version
#
if [ -r "$inspecteeDir/pack200" ];
then
inspectedVMVersion="1.5"
elif [ -r "$inspecteeDir/client" -o -r "$inspecteeDir/server" -o -r "$inspecteeDir/../jre/bin/server" -o -r "$inspecteeDir/../jre/bin/server" ];
then
inspectedVMVersion="1.4"
elif [ -r "$inspecteeDir/hotspot" -o -r "$inspecteeDir/../jre/bin/hotspot" ];
then
inspectedVMVersion="1.3"
elif [ -r "$inspecteeDir/classic" ];
then
inspectedVMVersion="1.2"
fi
getJavaVersion $inspectee
if [ -n "$javaVersion" ]; then
inspectedVMVersion=$javaVersion
fi
unset javaVersion
fi
elif [ "$inspecteeName" = "jre" ]; then
inspectedOldVMtype="JRE"
inspectedVMtype="JRE_J1"
inspectedVMVersion="1.1"
else
inspectedOldVMtype="UNKNOWN"
inspectedVMtype="UNKNOWN"
fi
}
###
### end inspectVM()
###
########################################################################################
# massage valid VM list. Expand inclusive types (i.e. JRE = JRE_J1 and JRE_J2 )
tmpValidVMlist=""
for type in $validVMtypeList; do
case $type in
J1) tmpValidVMlist="$tmpValidVMlist JRE_J1 JDK_J1" ;;
J2) tmpValidVMlist="$tmpValidVMlist JRE_J2 JDK_J2" ;;
JRE) tmpValidVMlist="$tmpValidVMlist JRE_J2 R12 JRE_J1" ;;
JDK) tmpValidVMlist="$tmpValidVMlist JDK_J2 D12 JDK_J1" ;;
*) tmpValidVMlist="$tmpValidVMlist $type " ;;
esac
done
validVMtypeList="$tmpValidVMlist"
debugOut "[1mExpanded Valid VM types................. $validVMtypeList[0m"
#--------------------------------------------------------------
# strictCheck
# checks that the version passed in matches the 'strict vm
# selection pattern'
#
# $1: vm version
# $2: pattern to match
# $3: vm type list
#
# returns:
#
# exit status:
# 0 on match, 1 otherwise
strictCheck()
{
vmVersion=$1
pattern=$2
types=$3
eval `$AWK '
BEGIN {
if ( ARGV[1] ~ /^(JDK|JRE)_/ ) {
printf ("version=%s\ntype=%s\n", substr(ARGV[1],5), substr(ARGV[1], 1, 3) );
} else {
printf ("version=%s\ntype=%s\n",ARGV[1],"none");
}