📄 setup_solaris
字号:
JVM_FILE_TYPE=1 EMBED_JARS_TYPE=3 BIN_FILE_TYPE=7 JVM_MESSAGE=8 JVM_INSTALLER_TYPE=4 sv=2 #sv - jvm search&verify result; successful search&verify sets to zero; initializing to non-zero resolve=2 #resolution of matched jvm file result that is required for launching the java app. successful resolution sets to zero; initializing to non-zero verify=2 # verification of a JVM result. successful verification of searched JVM sets to zero; initializing to non-zero install_jvm=2 # result of bundled JVM installation. successful installation sets to zero; initializing to non-zero resolvedJVMVerified=2 #app launcher verifies the embedded resolved JVM file and set the value to 0, if verification is successful. installer launcher does NOT use this. initializing to non-zero. IS_JVM_TEMP=0 #set to 1 upon the successful installation of bundled JVM; initializing to zero. uimode=2 # the default ui mode of the app is gui which corresponds uimode to non-zero. a console mode sets to zero. [ -z "$disk_space_check_off" ] && disk_space_check_off=0 # disk_space_check_off is not defined, switching it on by default. if [ -z "$ISTEMP_HOME" -a -d "/tmp" -a -w "/tmp" ] ; then ISTEMP_HOME="/tmp" fi [ -z "$ISTEMP_HOME" ] && ISTEMP_HOME="$HOME" if [ ! -d "$ISTEMP_HOME" ] ; then mkdir -p "$ISTEMP_HOME" >/dev/null 2>&1 if [ $? -ne 0 ] ; then cls tempLocationErrMesg "$ISTEMP_HOME" cleanupandexit 1 fi fi rand=$$`date '+%j%H%M%S'` rand=`echo "$rand" | sed 's/[a-zA-Z]//g;s/%//g'` if [ `isNumeric $rand` -ne 0 ] ; then rand=$$ fi ISTEMP="$ISTEMP_HOME/istemp$rand" if [ ! -d "$ISTEMP" ] ; then mkdir $ISTEMP >/dev/null 2>&1 if [ $? -ne 0 ] ; then cls tempLocationErrMesg "$ISTEMP" cleanupandexit 1 fi fi awk 'END{ print "Test file created by MultiPlatform installer" >> a ;}' a="$ISTEMP/writecheck" </dev/null 2>/dev/null if [ -f "$ISTEMP/writecheck" ] ; then rm -f "$ISTEMP/writecheck" else cls tempLocationErrMesg "$ISTEMP" cleanupandexit 1 fi [ -n "$ismpVV" ] && dbg "Temp directory used by shell script launcher = $ISTEMP" if [ -n "$LOG" ] ; then [ ! -d `dirname $LOG` ] && LOG=`pwd`/`basename "$LOG"` awk 'END{ s=sprintf("Log file created by MultiPlatform installer @%s",b); print s >> a ;}' a="$LOG" b="`date`"</dev/null 2>/dev/null if [ ! -f "$LOG" ] ; then LOG=/dev/null fi else LOG=/dev/null fi [ `awk 'END{ if(index(a,"-silent") > 0) {print 0; } else { print 2;} }' a="$app_args" </dev/null 2>/dev/null` -eq 0 ] && SILENT=true [ `awk 'END{ if(index(a,"-console") > 0) {print 0; } else { print 2;} }' a="$app_args" </dev/null 2>/dev/null` -eq 0 ] && uimode=0 [ -z "$SILENT" ] && setpbmesg [ -z "$pbmesg" ] && pbmesg="Initializing" cls banner}writetab(){ awk ' BEGIN { processingTag=0 } $0 == "/:" { if (beginprocessingTag == 1) beginprocessingTag=0 ; next } $0 == tag { beginprocessingTag=1; next } { if (beginprocessingTag == 1) { print $0 >> tab; next } } END { } ' tab="$2" tag="$3" "$1" }searchAndVerify(){ pbclr pbmesg="Searching JVM" dbg "--------------------------------------------------------------------------------------------" dbg "Searching a JVM using $1" if [ -f "$ISTEMP/pathHint" ] ; then rm -f "$ISTEMP/pathHint" fi JVM_EXE=`awk ' BEGIN { FS=":" } /^JVM_EXE/ { print $2; exit }' "$1" 2>/dev/null` JVM_EXE=`echo "$JVM_EXE" | sed 's/^[ ]*//;s/[ ]*$//;s/^[ ]*//;s/[ ]*$//;s/\"//g'` if [ -z "$JVM_EXE" ] ; then [ $ismpVV ] && dbg "value of JVM_EXE is an empty string in JVM FILE="$JVM_FILE". Trying next JVM File." return else [ $ismpVV ] && dbg "value of JVM_EXE=$JVM_EXE in JVM FILE=$JVM_FILE" fi writetab "$1" "$ISTEMP/pathHint" "PATH_HINT:" if [ -f "$ISTEMP/pathHint" ] ; then [ $ismpVV ] && { dbg "using path hints in the JVM file $1"; } pathHintc=`wc -l "$ISTEMP/pathHint" | awk '{ print $1 }'` pathHintcc=1 while [ $pathHintcc -le $pathHintc ] ; do pbc=`expr $pbc + 1` pb PathHint=`sed -n -e "${pathHintcc}p;s/^[ ]*//;s/[ ]*$//" "$ISTEMP/pathHint"` pathSep=`echo $PathHint | grep "^/" | wc -l` IS_RELATIVE=0 if [ $pathSep -eq 0 ] ; then if [ -z "$APP_ORIG_HOME" ] ; then PathHint="`dirname $INSTALLER_PATH`/$PathHint" else PathHint="$APP_ORIG_HOME/$PathHint" fi IS_RELATIVE=1 fi if [ -f "$1.fr" ] ; then rm -f "$1.fr" fi [ $ismpVV ] && dbg "using the pathHint=$PathHint." if [ -d "$PathHint" ] ; then for x in $PathHint ; do if [ -x "$x/$JVM_EXE" ] ; then echo "$x/$JVM_EXE" >> "$1.fr.shellxpansion" fi if [ -x "$x/jre/$JVM_EXE" ] ; then echo "$x/jre/$JVM_EXE" >> "$1.fr.shellxpansion" fi done [ $ismpVV ] && { dbg "reading find result from shell expansion..." ; cat "$1.fr.shellxpansion" >> $LOG 2>/dev/null; } fi find $PathHint/$JVM_EXE > "$1.fr.findcommand" 2>/dev/null if [ $? -eq 0 ] ; then if [ -f "$1.fr.findcommand" ] ; then [ $ismpVV ] && { dbg "reading find result from find command..." ; cat "$1.fr.findcommand" >> $LOG 2>/dev/null; } frc=`wc -l "$1.fr.findcommand" | awk '{ print $1 }'` frcc=1 while [ $frcc -le $frc ] ; do frl=`sed -n -e "${frcc}p" "$1.fr.findcommand"` grep "$frl" "$1.fr.shellxpansion" 1>/dev/null 2>&1 if [ $? -ne 0 ] ; then echo "$frl" >> "$1.fr.shellxpansion" fi frcc=`expr $frcc + 1` done fi fi if [ -f "$1.fr.findcommand" ] ; then rm -f "$1.fr.findcommand" fi if [ -f "$1.fr.shellxpansion" ] ; then mv "$1.fr.shellxpansion" "$1.fr" rm -f "$1.fr.shellxpansion" fi if [ -f "$1.fr" ] ; then [ $ismpVV ] && { dbg "reading find result after merging..." ; cat "$1.fr" >> $LOG 2>/dev/null; } frc=`wc -l "$1.fr" | awk '{ print $1 }'` frcc=1 while [ $frcc -le $frc ] ; do frl=`sed -n -e "${frcc}p" "$1.fr"` jvm_exe=`echo $JVM_EXE | sed 's/\//\\\\\//g'` VerifyJVM "$1" "$frl" if [ $verify -eq 0 ] ; then J=`echo "$frl" | sed "s/${jvm_exe}//"` J=`echo "$J" | sed 's/^[ ]*//;s/[ ]*$//;s/^[ ]*//;s/[ ]*$//'` echo "JVM_HOME:$J" >> "$1" RESOLVED_JVM="$1" if [ $IS_RELATIVE -eq 1 ] ; then IS_JVM_TEMP=1 DESTINATION_DIR=$MEDIA_DIR fi sv=0 dbg "Verification passed for $frl using the JVM file $1." rm -f "$1.fr" return else dbg "Verification failed for $frl using the JVM file $1." fi frcc=`expr $frcc + 1` done else [ $ismpVV ] && { dbg "find result is empty for the pathhint=$PathHint"; } fi pathHintcc=`expr $pathHintcc + 1` done else dbg "path hint is not specified in the JVM file $1" fi}VerifyJVM(){ pbclr pbmesg="Verifying JVM" pb [ ! -f "$ISTEMP/Verify.jar" ] && extractVerifyJar awk ' BEGIN { begin=0; i=1 } $0 == "/:" { if (begin == 1) begin=0 ; next; } $0 == tag { begin=1; next; } { if (begin== 1) { item[i]=$0; i++; next; } } END { for (k=1; k < i; k++) print item[k] >> tab; } ' tab="$ISTEMP/sp" tag="JVM_PROPERTIES:" "$1" 2>/dev/null if [ -f "$ISTEMP/sp" ] ; then spc=`wc -l "$ISTEMP/sp" | awk '{ print $1 }'` spcc=1 systemprops= while [ $spcc -le $spc ] ; do spl=`sed -n -e "${spcc}p" "$ISTEMP/sp"` spl=`echo "$spl" | sed 's/\"//g'` systemprops=`awk 'END { i=index(spl,"="); s=substr(spl,1,i-1); ss=sprintf("%s %s", sp, s); print ss; } ' spl="$spl" sp="$systemprops" </dev/null 2>/dev/null` spcc=`expr $spcc + 1` done jvm_classpath= cp_switch=`awk 'BEGIN{ FS=":"} $1 == tag { print $2; exit; }' tag=CLASSPATH $1` cp_switch=`echo "$cp_switch" | sed 's/\"//g'` jvm_classpath=`awk 'BEGIN { FS=":" } $1 == tag { i=index($0,":"); s=substr($0,i+1); print s; exit; }' tag=JVM_CLASSPATH $1` if [ -z "$jvm_classpath" ] ; then dbg "Verifying... $2 $cp_switch $ISTEMP/Verify.jar Verify $systemprops" eval "\"$2\"" $cp_switch "$ISTEMP/Verify.jar" Verify $systemprops 1>"$ISTEMP/jvmout" 2>/dev/null& bgpid=$! Timer $bgpid& wait $bgpid 1>/dev/null 2>&1 else jb=`awk 'BEGIN { FS=":" } $1 == tag { i=index($0,":"); s=substr($0,i+1); print s; exit; }' tag=JVM_EXE $1 2>/dev/null` jb=`echo "$jb" | sed 's/^[ ]*//;s/[ ]*$//;s/^[ ]*//;s/[ ]*$//'` jb=`echo "$jb" | sed 's/\//\\\\\//g'` JVM_HOME=`echo "$2" | sed "s/${jb}//"` eval jvm_classpath="$jvm_classpath" dbg "Verifying... $2 $cp_switch $jvm_classpath:$ISTEMP/Verify.jar Verify $systemprops" eval "\"$2\"" $cp_switch "$jvm_classpath":"$ISTEMP/Verify.jar" Verify $systemprops 1>"$ISTEMP/jvmout" 2>/dev/null& bgpid=$! Timer $bgpid& wait $bgpid 1>/dev/null 2>&1 JVM_HOME= fi if [ -f "$ISTEMP/jvmout" ] ; then spc=`wc -l "$ISTEMP/sp" | awk '{ print $1 }'` spcc=1 systemprops= while [ $spcc -le $spc ] ; do spl=`sed -n -e "${spcc}p" "$ISTEMP/sp"` spl=`echo $spl | sed 's/\"//g'` jvmfilevalue=`awk 'END { i=index(spl,"="); s=substr(spl,i+1); print s } ' spl="$spl" sp="$systemprops" </dev/null 2>/dev/null` jvmoutc=`expr $spcc + 1` jvmout=`sed -n -e "${jvmoutc}p" "$ISTEMP/jvmout"` verify=`awk ' END { exactMatch=1 verify=2 len = length(jvmfilevalue) for (k = len ; k >len-3 ; k--) { char=substr(jvmfilevalue, k, 1); s = sprintf("%s%s", s,char); } if (length(s) == length("...")) { if ( index(s, "...") == 1) { exactMatch=0 } } if (exactMatch == 1) { if ( (length(jvmfilevalue) == length(jvmout)) && (index(jvmfilevalue, jvmout) == 1) ) verify=0 } else { jvmfilevalue_prefix=substr(jvmfilevalue, 1, len-3) if (index(jvmout,jvmfilevalue_prefix) == 1 ) verify=0 } if (length(ismpVV) > 0) { printf("jvm system property specified in jvm file=%s\n",jvmfilevalue) >> ilog printf("jvm system property from running Verify diagnostics on the JVM=%s\n",jvmout) >> ilog if (verify == 0) { if (exactMatch == 1) { print "exact match of system property succeeded" >> ilog } else { print "non-exact match of system property succeeded" >> ilog } } else { if (exactMatch == 1) { print "exact match of system property failed" >> ilog } else { print "non-exact match of system property failed" >> ilog } } } print verify } ' jvmout="$jvmout" jvmfilevalue="$jvmfilevalue" ismpVV="$ismpVV" ilog="$LOG" </dev/null 2>/dev/null` if [ $verify -ne 0 ] ; then break fi spcc=`expr $spcc + 1` done else dbg "$ISTEMP/jvmout does not exist. JVM Verification process may have failed." fi else dbg "system properties are not specified in "$1"" fi rm -f "$ISTEMP/sp" rm -f "$ISTEMP/jvmout"}searchParitions(){ for i in $1 ; do find ${i} -type d \ \( -name '*[jJ][dD][kK]*' \ -o -name '*[jJ][rR][eE]*' \ -o -name '*[jJ][aA][vV][aA]*' \ -o -name '*[jJ]2[rR][eE]*' \ -o -name '*[jJ]2[sS][eE]*' \ \) >> "$ISTEMP/searchParitionsResult" 2>/dev/null done}writesptab(){ sed 's/^[ ]*//;s/[ ]*$//' "$1" >> "$1.tmp" 2>/dev/null mv "$1.tmp" "$1" awk ' BEGIN { begin=0; i=1} $0 == "/:" { if (begin == 1) begin=0 ; next; } $0 == tag { begin=1; next; } { if (begin== 1) { item[i]=$0; i++; next; } } END { for (k=1; k < i; k++) { s=sprintf("%s%s;",s,item[k]); } s=sprintf("%s%s",s,JF); print s >> tab } ' JF="$1" tab="$ISTEMP/sp" tag="JVM_PROPERTIES:" "$1" 2>/dev/null}verifyJavaHome(){ if [ -f "$ISTEMP/jvmlist" ] ; then jvmlc=`wc -l "$ISTEMP/jvmlist" | awk '{ print $1 }'` cc=1 while [ $cc -le $jvmlc ] ; do JVM_FILE=`sed -n -e "${cc}p" "$ISTEMP/jvmlist" 2>/dev/null` if [ -f "$JVM_FILE" ] ; then JVM_EXE=`awk ' BEGIN { FS=":" } /^JVM_EXE/ { print $2; exit }' "$JVM_FILE"` JVM_EXE=`echo "$JVM_EXE" | sed 's/^[ ]*//;s/[ ]*$//;s/^[ ]*//;s/[ ]*$//;s/\"//g'` if [ -z "$JVM_EXE" ] ; then [ $ismpVV ] && dbg "value of JVM_EXE is an empty string in JVM FILE="$JVM_FILE". Trying next JVM File" continue else [ $ismpVV ] && dbg "value of JVM_EXE=$JVM_EXE in JVM FILE="$JVM_FILE"" fi if [ -x "$ISJAVAHOME/$JVM_EXE" ] ; then [ $ismpVV ] && dbg "Verifying $ISJAVAHOME using the JVM file $JVM_FILE" VerifyJVM "$JVM_FILE" "$ISJAVAHOME/$JVM_EXE" if [ $verify -eq 0 ] ; then J="$ISJAVAHOME" J=`echo "$J" | sed 's/^[ ]*//;s/[ ]*$//;s/^[ ]*//;s/[ ]*$//'` echo "JVM_HOME:$J" >> "$JVM_FILE" RESOLVED_JVM="$JVM_FILE" sv=0 dbg "Verification passed for $ISJAVAHOME using the JVM file $JVM_FILE." return else dbg "Verification failed for $ISJAVAHOME using the JVM file $JVM_FILE" fi fi fi cc=`expr $cc + 1` done else [ $ismpVV ] && dbg "jvm files not specified. Verification cannot be performed for JVM specfied using $ISJAVAHOME" fi}checkEnvironment() { dbg "Checking the environment variables specifed in the JVM files to find the JVM..." if [ -f "$ISTEMP/jvmlist" ] ; then checkEnvlc=`wc -l "$ISTEMP/jvmlist" | awk '{ print $1 }'` checkEnvcc=1 while [ $checkEnvcc -le $checkEnvlc ] ; do checkEnvJvmFile=`sed -n -e "${checkEnvcc}p" "$ISTEMP/jvmlist" 2>/dev/null` for pathVariable in `echo $PATH|sed 's/:/ /g'` do if [ -x "$pathVariable/java" ] ; then VerifyJVM "$checkEnvJvmFile" "$pathVariable/java" if [ $verify -eq 0 ] ; then pathVariable=`echo $pathVariable | sed 's/\/bin//g'` echo "JVM_HOME:$pathVariable" >> "$checkEnvJvmFile" RESOLVED_JVM="$checkEnvJvmFile" sv=0 dbg "Verification passed for $pathVariable/$checkEnvJvmExe using the JVM file $checkEnvJvmFile." return fi fi done checkEnvJvmExe=`awk ' BEGIN { FS=":" } /^JVM_EXE/ { print $2; exit }' "$checkEnvJvmFile" 2>/dev/null` checkEnvJvmExe=`echo "$checkEnvJvmExe" | sed 's/^[ ]*//;s/[ ]*$//'` if [ -z "$checkEnvJvmExe" ] ; then [ $ismpVV ] && dbg "value of JVM_EXE is an empty string in JVM FILE="$checkEnvJvmFile". Trying next JVM File." checkEnvcc=`expr $checkEnvcc + 1` continue else [ $ismpVV ] && dbg "value of JVM_EXE=$JVM_EXE in JVM FILE=$checkEnvJvmFile" fi if [ -f "$ISTEMP/platformHint" ] ; then rm -f "$ISTEMP/platformHint" fi writetab "$checkEnvJvmFile" "$ISTEMP/platformHint" "PLATFORM_HINT:" if [ -f "$ISTEMP/platformHint" ] ; then [ $ismpVV ] && dbg "using platform hints or environment variables in the JVM file $checkEnvJvmFile" platformHintlc=`wc -l "$ISTEMP/platformHint" | awk '{ print $1 }'` platformHintcc=1 while [ $platformHintcc -le $platformHintlc ] ; do platformHintLine=`sed -n -e "${platformHintcc}p;s/^[ ]*//;s/[ ]*$//" "$ISTEMP/platformHint" | sed 's/\(.*\)/$\1/'` eval platformHintEvaled=$platformHintLine if [ -n "$platformHintEvaled" ] ; then if [ -x "$platformHintEvaled/$checkEnvJvmExe" ] ; then dbg "A jvm found at $platformHintEvaled/$checkEnvJvmExe" VerifyJVM "$checkEnvJvmFile" "$platformHintEvaled/$checkEnvJvmExe" if [ $verify -eq 0 ] ; then platformHintEvaled=`echo "$platformHintEvaled" | sed 's/^[ ]*//;s/[ ]*$//;s/^[ ]*//;s/[ ]*$//'` echo "JVM_HOME:$platformHintEvaled" >> "$checkEnvJvmFile" RESOLVED_JVM="$checkEnvJvmFile" sv=0 dbg "Verification passed for $platformHintEvaled/$checkEnvJvmExe using the JVM file $checkEnvJvmFile." return else dbg "Verification failed for $platformHintEvaled/$checkEnvJvmExe using the JVM file $checkEnvJvmFile." fi fi else dbg "$platformHintLine is not defined in the shell environment specifed in the JVM FILE `basename $checkEnvJvmFile`" fi platformHintcc=`expr $platformHintcc + 1` done else dbg "platform hints or environment variables are not specified in the JVM file $checkEnvJvmFile" fi checkEnvcc=`expr $checkEnvcc + 1` done else [ $ismpVV ] && dbg "jvm files not specified in the launcher. Environment Variables can not be checked." fi}searchJVM(){ makeJVMFit extractJVMFiles
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -