📄 setup_solaris
字号:
else dbg "$ISTEMP/_bundledJRE_/$JVM_EXE does not exist. Bundled JRE is not a working JVM. Installation of bundled JRE is not successful." return fi}checkDiskSpace(){ [ "$disk_space_check_off" -eq 1 ] && { disk_space_check=0 dbg "disk space checking turned off/skipped". return } disk_space_check=2 # disk space check result; successful check sets it to 0; initializing to non-zero value cdsBlocksRequired=reset #will be assigned to a numeric value; initializing to a non-numeric value cdsAvailable=reset #will be assigned to a numeric value; initializing to a non-numeric value mkdir "$ISTEMP/emptydir" # Linux reports the default block-size in 1024 bytes units. Forcing it to report in 512 bytes units. du --block-size=$DISK_BLOCK_SIZE "$ISTEMP" 2>/dev/null 1>&2 if [ $? -eq 0 ] ; then cdsDefaultBlocksAllocated=`du --block-size=$DISK_BLOCK_SIZE "$ISTEMP/emptydir" | awk '{ if ( $1 ~ /^[0-9]/ ) print $1 ; else print 0; }' 2>/dev/null` else cdsDefaultBlocksAllocated=`du "$ISTEMP/emptydir" | awk '{ if ( $1 ~ /^[0-9]/ ) print $1 ; else print 0; }' 2>/dev/null` fi [ $ismpVV ] && dbg "default blocks allocated by the filesystem=$cdsDefaultBlocksAllocated" rm -fr "$ISTEMP/emptydir" if [ -f "$1" ] ; then dbg "checking disk space on the parition $2 for $1" [ ! -x "$1" ] && chmod 744 "$1" >/dev/null 2>&1 "$1" -t >/dev/null 2>&1 [ $? -ne 0 ] && { dbg "Bundled JRE is not binary compatible with host OS/Arch or it is corrupt. Testing bundled JRE failed." cleanupandexit 1 "Bundled JRE is not binary compatible with host OS/Arch or it is corrupt. Testing bundled JRE failed." } cdsUnZipFileSize=`"$1" -c | wc -c | awk '{ if ( $1 ~ /^[0-9]/ ) print $1 ; else print 0; }' 2>/dev/null` [ $ismpVV ] && dbg "Unziped file size = $cdsUnZipFileSize" [ "$cdsUnZipFileSize" -eq 0 ] && { dbg "Error calculating the uncompressed size of bundled JRE or it is corrupt. Installation of bundled JRE failed." cleanupandexit 1 "Error calculating the uncompressed size of bundled JRE or it is corrupt. Installation of bundled JRE failed." } cdsFilesCount=`"$1" -t | wc -l | awk '{ if ( $1 ~ /^[0-9]/ ) print $1 ; else print 0; }' 2>/dev/null` [ $ismpVV ] && dbg "Unziped file count = $cdsFilesCount" [ "$cdsFilesCount" -eq 0 ] && { dbg "Error calculating the file count of bundled JRE or it is corrupt. Installation of bundled JRE failed." cleanupandexit 1 "Error calculating the file count of bundled JRE or it is corrupt. Installation of bundled JRE failed." } cdsBlocksRequired=`echo \("$cdsUnZipFileSize" \/ \("$DISK_BLOCK_SIZE" - \("$DISK_BLOCK_SIZE" \* 1\/100\)\)\) + \("$cdsFilesCount" \* "$cdsDefaultBlocksAllocated" \) | bc` elif [ `isNumeric $1` -eq 0 ] ; then [ -n "$3" ] && dbg "checking disk space on the parition $2 for $3" cdsBlocksRequired=`echo "$1" \/ \($DISK_BLOCK_SIZE - \($DISK_BLOCK_SIZE \* 1/100\)\) + "$cdsDefaultBlocksAllocated" | bc` else dbg "Internal Disk space check error. Size of file to be copied or extracted to the host file system is reported incorrectly." return fi if [ `isNumeric $cdsBlocksRequired` -ne 0 ] ; then dbg "Error calculating required file blocks. " [ $ismpVV ] && dbg "required 512 blocks for $3 = $cdsBlocksRequired" return else dbg "$cdsBlocksRequired 512 bytes disk blocks required." fi [ -z "$FREE_BLOCKS_COLUMN" ] && FREE_BLOCKS_COLUMN=4 if [ -n "$FREE_DISK_BLOCKS" ] ; then cdsAvailable="$FREE_DISK_BLOCKS" else # gnu df by default reports the free blocks in 1K size, forcing it to report to 512 sizes df -P --block-size="$DISK_BLOCK_SIZE" "$2" 2>/dev/null 1>&2 if [ $? -eq 0 ] ; then # Linux df is POSIX complaint cdsAvailable=`df -P --block-size="$DISK_BLOCK_SIZE" "$2" | awk ' NR > 1 { print $A }' A="$FREE_BLOCKS_COLUMN" 2>/dev/null` else df -P "$2" 2>/dev/null 1>&2 # If POSIX complaint if [ $? -eq 0 ] ; then cdsAvailable=`df -P "$2" | awk ' NR > 1 { print $A }' A="$FREE_BLOCKS_COLUMN" 2>/dev/null` # Is Solaris xpg4 available elif [ -x /usr/xpg4/bin/df ] ; then cdsAvailable=`/usr/xpg4/bin/df -P "$2" | awk ' NR > 1 { print $A }' A="$FREE_BLOCKS_COLUMN" 2>/dev/null` else # if it comes this far, guess the column 4 of df as free-available blocks. This may be incorrect. cdsAvailable=`df "$2" | tr -s ' ' ',' | awk ' NR > 1 { print $A }' A="$FREE_BLOCKS_COLUMN" 2>/dev/null` fi fi fi if [ `isNumeric $cdsAvailable` -ne 0 ] ; then dbg "Disk space check error. free disk [ of 512 bytes ] blocks can not be found or incorrectly reported by df command on disk parition containing the directory $2." dbg "Please specify free disk [ of 512 bytes ] blocks on the disk partition containing the directory $2 by setting the environment variable FREE_DISK_BLOCKS" dbg "and run the installer again." [ $ismpVV ] && dbg "available 512 blocks in the partition containing the directory $2 = $cdsAvailable" return else dbg "$cdsAvailable $DISK_BLOCK_SIZE bytes disk blocks available on the partition $2" fi if [ $cdsAvailable -gt $cdsBlocksRequired ] ; then dbg "Disk space check on the parition $2 succeeded." disk_space_check=0 else if [ `expandDiskPartition $2 $cdsBlocksRequired $cdsAvailable` -ne 0 ] ; then dbg "$2 partition expanded successfully." disk_space_check=0 else dbg "Insufficient disk space in the disk parition containing the directory $2. $cdsBlocksRequired 512 bytes file blocks required. $cdsAvailable 512 bytes file blocks only is available." dbg "Free up the parition or specify a different parition to write temporary files using the command line switch -is:tempdir <tempdir>." dbg "Temporary files will be cleanedup after the installation." fi fi}executeLauncher(){ [ $ismpVV ] && dbg "running inner launcher". [ $ismpVV ] && dbg "original command line args $@" [ "$FILEINDEXCOUNT" -ne 1 ] && { dbg "Error extracting inner launcher. Failed to launch the application." return } TYPE=`awk 'END{ split(a,FIELDS, ":"); print FIELDS[1]; }' a=$FILEINDEX0 </dev/null 2>/dev/null` TYPE=`convert $TYPE` if [ "$TYPE" -eq $BIN_FILE_TYPE ] ; then SIZE=`awk 'END{ split(a,FIELDS, ":"); print FIELDS[3] }' a=$FILEINDEX0 </dev/null 2>/dev/null` OFFSET=`awk 'END{ split(a,FIELDS, ":"); print FIELDS[4] }' a=$FILEINDEX0 </dev/null 2>/dev/null` NAME=`awk 'END{ split(a,FIELDS, ":"); print FIELDS[5] }' a=$FILEINDEX0 </dev/null 2>/dev/null` SIZE=`convert $SIZE` OFFSET=`convert $OFFSET` NAME="$ISTEMP/$NAME.embedded" extractAFile fi INNER_LAUNCHER="$NAME" if [ -f "$INNER_LAUNCHER" ] ; then archiveSize=`wc -c "$INNER_LAUNCHER" | awk '{ if ( $1 ~ /^[0-9]/ ) print $1 ; else print 0; }'` if [ $archiveSize -ne $SIZE ] ; then archiveSize=`ls -l "$INNER_LAUNCHER" | awk '{ if ( $5 ~ /^[0-9]/ ) print $5 ; else print 0; }'` if [ $archiveSize -ne $SIZE ] ; then dbg "Error extracting inner launcher. Archive may be corrupt. Failed to launch the application." return fi fi else dbg "Inner launcher can not be found. Failed to launch the application." return fi MEDIA_LOCATION=`dirname $INSTALLER_PATH` runInnerLauncher=`awk 'END{ s=sprintf("%s -is:orig %s %s", c, b, a); print s; }' a="$@" b="$MEDIA_LOCATION" c="$INNER_LAUNCHER" </dev/null 2>/dev/null` chmod 744 "$INNER_LAUNCHER" dbg "running inner launcher=$runInnerLauncher" eval "exec $runInnerLauncher" exit 0}tempLocationErrMesg(){cat << END Temporary directory, $1 does not exist and can not be created. The current user may not have the necessary permission to write to the directory. Please specify another temporary directory with the option -is:tempdir. Use the -is:help option for more information. END}help(){cat << STOPUsage : `basename $0` [OPTIONS] [APPLICATION_ARGUMENTS] Where OPTIONS include: -is:javahome <dir> JRE home which points to directory containing bin/java. -is:tempdir <dir> Temporary directory to be used by the launcher. -cp:a <classpath> Append <classpath> to the launcher's classpath. -cp:p <classpath> Prepend <classpath> to the launcher's classpath. -is:log <filename> Log debug messages to <file>. -is:extract Extracts the contents of the archive. -is:nospacecheck Turns off the launcher disk space checking. -is:version Returns launcher version and exits. -is:help Prints this help message and exitsSTOP}VerifyResolvedJVM(){ dbg "Verifying resolved JVM" makeJVMFit extractJVMFiles verifedJVMFile=`cat "$ISTEMP/jvmlist" | xargs awk '/^JVM_HOME:.+/{ print FILENAME; exit }' 2>/dev/null` #Verify the resolved JVM file if [ -f "$verifedJVMFile" ] ; then JVM_HOME=`awk 'BEGIN { FS=":" } $1 == tag { i=index($0,":"); s=substr($0,i+1); print s; exit; }' tag=JVM_HOME "$verifedJVMFile" 2>/dev/null` JVM_HOME=`echo "$JVM_HOME" | sed 's/^[ ]*//;s/[ ]*$//;s/^[ ]*//;s/[ ]*$//'` [ ! -d "$JVM_HOME" ] && { dbg "JVM_HOME is not found in the jvm file $verifedJVMFile." return } JVM_EXE=`awk 'BEGIN { FS=":" } $1 == tag { i=index($0,":"); s=substr($0,i+1); print s; exit; }' tag=JVM_EXE "$verifedJVMFile" 2>/dev/null` JVM_EXE=`echo "$JVM_EXE" | sed 's/^[ ]*//;s/[ ]*$//;s/^[ ]*//;s/[ ]*$//;s/\"//g'` [ -z "$JVM_EXE" ] && { dbg "Javaexe is not found or empty in the jvm file $verifedJVMFile." return } VerifyJVM "$verifedJVMFile" "$JVM_HOME/$JVM_EXE" if [ $verify -eq 0 ] ; then RESOLVED_JVM="$verifedJVMFile" resolvedJVMVerified=0 dbg "Verification passed for $JVM_HOME/$JVM_EXE using the JVM file $verifedJVMFile." else dbg "Verification failed for $JVM_HOME/$JVM_EXE using the JVM file $verifedJVMFile." fi else dbg "resolved jvm file can not be found. Try to launch the application by searching a JVM..." fi}executeExternalInstructions(){ if [ -f "$1" ] ; then SILENT=true initialize LOG=`awk '/^LOG/ { i=index($0,"="); s=substr($0,i+1); print s; exit }' "$1" 2>/dev/null` [ -n "$LOG" ] && { touch "$ISTEMP/$LOG" if [ -f "$ISTEMP/$LOG" ] ; then LOG="$ISTEMP/$LOG" DBG=1 else LOG= fi } action=`awk '/^ACTION/ { i=index($0,"="); s=substr($0,i+1); print s; exit }' "$1" 2>/dev/null` if [ -n "$action" ] ; then if [ "$action" = "SEARCHJVM" ] ; then dbg "searching JVM" awk '/^JVMFILE[0-9]+/ { i=index($0,"="); s=substr($0,i+1); print s >> f; }' f="$ISTEMP/jvmlist" "$1" 2>/dev/null if [ -f "$ISTEMP/jvmlist" ] ; then jvmFileslc=`wc -l "$ISTEMP/jvmlist" | awk '{ print $1 }' 2>/dev/null` if [ "$jvmFileslc" -gt 0 ] ; then VERIFY_JAR=`awk '/^VERIFY_JAR/ { i=index($0,"="); s=substr($0,i+1); print s ; }' "$1" 2>/dev/null` if [ -f "$VERIFY_JAR" ] ; then cp "$VERIFY_JAR" "$ISTEMP/." if [ -f "$ISTEMP/Verify.jar" ] ; then jvmFilescc=1 while [ "$jvmFilescc" -le "$jvmFileslc" ] ; do JVM_FILE=`sed -n -e "${jvmFilescc}p" "$ISTEMP/jvmlist" 2>/dev/null` if [ -f "$JVM_FILE" ] ; then sed "s/
//;s/^[ ]*//;s/[ ]*$//" "$JVM_FILE" >> "$JVM_FILE.sed" 2>/dev/null rm -f "$JVM_FILE" mv "$JVM_FILE.sed" "$JVM_FILE" fi jvmFilescc=`expr "$jvmFilescc" + 1` done checkEnvironment if [ $sv -eq 0 ] ; then dbg "jvm found using an environment variable and verfication passed for $JVM_FILE." JVM_HOME=`awk '/^JVM_HOME/ { i=index($0,":"); s=substr($0,i+1); print s ; }' "$RESOLVED_JVM" 2>/dev/null` echo 1 echo "$JVM_HOME" echo "$RESOLVED_JVM" else jvmFilescc=1 while [ "$jvmFilescc" -le "$jvmFileslc" ] ; do JVM_FILE=`sed -n -e "${jvmFilescc}p" "$ISTEMP/jvmlist" 2>/dev/null` if [ -f "$JVM_FILE" ] ; then searchAndVerify "$JVM_FILE" if [ "$sv" -eq 0 ] ; then dbg "jvm found and verfication passed for $JVM_FILE." JVM_HOME=`awk '/^JVM_HOME/ { i=index($0,":"); s=substr($0,i+1); print s ; }' "$RESOLVED_JVM" 2>/dev/null` echo 1 echo "$JVM_HOME" echo "$RESOLVED_JVM" break fi fi jvmFilescc=`expr "$jvmFilescc" + 1` done fi else dbg "Error copying Verify.jar . JVM Verification can't be performed." fi else dbg "Verify class is missing . JVM Verification can't be performed." fi else dbg "JVM files are not specified. JVM search can't be performed." fi else dbg "JVM file list is missing. JVM search can't be performed." fi elif [ "$action" = "INSTALL_JVM" ] ; then dbg "Installing JVM" BUNDLED_JRE=`awk '/^BUNDLED_JRE/ { i=index($0,"="); s=substr($0,i+1); print s; exit }' "$1" 2>/dev/null` if [ -f "$BUNDLED_JRE" ] ; then dbg "Bundled JRE file is = $BUNDLED_JRE" DESTINATION_DIR=`awk '/^DESTINATION_DIR/ { i=index($0,"="); s=substr($0,i+1); print s; exit }' "$1" 2>/dev/null` if [ -n "$DESTINATION_DIR" ] ; then dbg "Destination directory is = $DESTINATION_DIR" touch "$DESTINATION_DIR/iswritable" 2>/dev/null 1>&2 if [ \( $? -eq 0 \) -a \( -f "$DESTINATION_DIR/iswritable" \) ] ; then dbg "Beginning to install bundled JRE." rm -f "$DESTINATION_DIR/iswritable" whereAmI=`pwd` mkdir "$DESTINATION_DIR" >/dev/null 2>&1 checkDiskSpace "$BUNDLED_JRE" "$DESTINATION_DIR" if [ "$disk_space_check" -eq 0 ] ; then cd "$DESTINATION_DIR" dbg "installing bundled JRE..." "$BUNDLED_JRE" -qq >/dev/null 2>&1 if [ $? -ne 0 ] ; then cd "$whereAmI" dbg "Error installing bundled JRE. Failed to launch the application." else cd "$whereAmI" dbg "Installing bundled JRE successful." fi chmod -R 744 "$DESTINATION_DIR" > /dev/null 2>&1 J="$DESTINATION_DIR" J=`echo "$J" | sed 's/^[ ]*//;s/[ ]*$//;s/^[ ]*//;s/[ ]*$//'` echo "JVM_HOME:$J" >> "$DESTINATION_DIR/jvm" if [ -f "$DESTINATION_DIR/jvm" ] ; then echo "$DESTINATION_DIR/jvm" else dbg "Installation of bundled JRE failed." fi else dbg "diskspace check failed.Installation of bundled JRE failed." fi else dbg "Install Destination directory for bundled JRE is non-writable. Installation of bundled JRE failed." fi else dbg "Install Destination directory for bundled JRE is missing. Installation of bundled JRE failed. " fi else dbg "Bundled JRE file $BUNDLED_JRE is missing. Installation of bundled JRE failed." fi else dbg "unknown ACTION TAG" fi else dbg "ACTION TAG is missing in the input instructions file. JVM search can't be performed." fi cleanupandexit 0 else dbg "Input instructions file missing. JVM Service operation failed." fi}handleApplicationExitStatus(){ [ "$applicationExitStatus" ] && [ \( -z "$SILENT" -a "$applicationExitStatus" -ne 0 \) ] && { pbl [ "$ismpVV" ] && applicationExitStatusMesg="The application is aborted with exit code $applicationExitStatus."cat << handleApplicationExitStatusSTOP $applicationExitStatusMesg handleApplicationExitStatusSTOP [ -f "$ISTEMP/APP_STDERR" ] && cat "$ISTEMP/APP_STDERR" }}mode(){ mode=`awk 'END { i=index(a, "-is:in"); print i }' a="$1" </dev/null 2>/dev/null` if [ "$mode" -ge 1 ] ; then main "$@" fi }_XPG=1 # to maintain backward compatibility with bourne shell on IRIX. See IRIX man pages of sh for more details.BIN_SH=xpg4 # for True64 to use POSIX compliant shell.mode "$@" setPreLaunchEnvironment(){dbg "setting up prelaunch environment"}expandDiskPartition(){echo 0}FILEINDEX0=05:00000000:000003F1:0000EC00:Verify.jar:00:00000001:00000000FILEINDEX1=01:00000001:000012D6:0000F000:wr.sun.jre.1.4.2.solaris.jvm:00:00000001:00000000FILEINDEX2=08:00000002:00000044:00010400:JVMNotFound.txt:00:00000001:00000000FILEINDEXCOUNT=3Launch(){launcherParentDir=`dirname "$0"`resolveLaunchCommand "$RESOLVED_JVM"if [ $resolve -ne 0 ]; then dbg "Launch Script can't not be resolved. Run the installer with -is:log <logfile> to view the errors."cleanupandexit 3elsepbmesg="Launching InstallShield Wizard"pbc=8pbpblpblsetPreLaunchEnvironmentJC="\""$JVM_HOME/$JVM_EXE"\" $CLASSPATH_SWITCH .:$PREPEND_CLASSPATH:$CP1:"$JVM_CLASSPATH":$CP::\"`awk 'END{ s=sprintf("%s/%s",a,b); print s}' a="$launcherParentDir" b="output.jar" <</dev/null`\":$INSTALLER_ARCHIVE:$EMBEDDED_JARS:$CP2:$CLASSPATH:$APPEND_CLASSPATH: -Dtemp.dir=\"$IS_TEMP_DIR\" -Dis.jvm.home=\"$IS_JVM_HOME\" -Dis.jvm.temp=\"$IS_JVM_TEMP\" -Dis.media.home=\"$APPLICATION_ARCHIVE\" -Dis.launcher.file=\"$IS_LAUNCHER_FILE\" -Dis.jvm.file=\"$IS_JVM_FILE\" -Dis.external.home=\"$MEDIA_DIR\" "$RUNTIME_SYSTEMPROP" $JAVA_ARGS run "$app_args" 1>$APP_STDOUT 2>$APP_STDERR"dbg LAUNCH_COMMAND="$JC"eval $JCapplicationExitStatus=$?fi}setpbmesg(){pbmesg="Initializing InstallShield Wizard"}#INSTRUCTIONS for the generic unix launcher.Instructions(){searchJVMif [ $sv -eq 0 ] ; thenLaunchfi}main "$@"############################################################################################################################################################################################PK