📄 setup_linux
字号:
} print s; }' a=`basename "$1"` </dev/null 2>/dev/null | sed "s/^\.//;s/\.$//;s/\(.*\)/${installerDir}\/\1.${2}/" }processCommandLineCP(){ if [ `awk 'END{ if (index(a,"@") == 1) print 0 ; else print 1; }' a="$1" </dev/null 2>/dev/null` -eq 0 ] ; then file=`awk 'END{ s=substr(a, 2); print s; }' a="$1" </dev/null 2>/dev/null` [ -f "$file" ] && CommandLineCP=`aggregatecp "$file"` else CommandLineCP=`awk 'END{ t=split(a,FIELDS,":"); for ( i=1; i<=t; i++) { if ( length(FIELDS[i]) > 0 ) { quotedCPItem=sprintf("\"%s\"",FIELDS[i]); s=sprintf("%s:%s",s,quotedCPItem); } } printf s; }' a="$1" </dev/null 2>/dev/null` fi echo "$CommandLineCP" | sed 's/^://'}resolveLaunchCommand(){ if [ -f "$1" ] ; then JVM_HOME=`awk 'BEGIN { FS=":" } $1 == tag { i=index($0,":"); s=substr($0,i+1); print s; exit; }' tag=JVM_HOME "$1" 2>/dev/null` JVM_HOME=`echo "$JVM_HOME" | sed 's/^[ ]*//;s/[ ]*$//;s/^[ ]*//;s/[ ]*$//'` [ ! -d "$JVM_HOME" ] && { dbg "JavaHome is not resolved correctly in the jvm file $1. Failed to launch the application." return } JVM_EXE=`awk 'BEGIN { FS=":" } $1 == tag { i=index($0,":"); s=substr($0,i+1); print s; exit; }' tag=JVM_EXE "$1" 2>/dev/null` JVM_EXE=`echo "$JVM_EXE" | sed 's/^[ ]*//;s/[ ]*$//;s/^[ ]*//;s/[ ]*$//;s/\"//g'` [ -z "$JVM_EXE" ] && { dbg "Javaexe is not resolved correctly or empty in the jvm file $1. Failed to launch the application." return } CLASSPATH_SWITCH=`awk 'BEGIN{ FS=":"} $1 == tag { print $2; exit; }' tag=CLASSPATH "$1" 2>/dev/null` CLASSPATH_SWITCH=`echo "$CLASSPATH_SWITCH" | sed 's/^[ ]*//;s/[ ]*$//;s/^[ ]*//;s/[ ]*$//;s/\"//g'` [ -z $CLASSPATH_SWITCH ] && { dbg "Classpath switch is not specified in the jvm file $1. Failed to launch the application." return } if [ -n "$CP_P" ] ; then PREPEND_CLASSPATH=`processCommandLineCP "$CP_P"` else dbg "-cp:p operand is empty" fi if [ -n "$CP_A" ] ; then APPEND_CLASSPATH=`processCommandLineCP "$CP_A"` else dbg "-cp:a operand is empty" fi cp1File=`modifyFileName "$INSTALLER_PATH" cp1` [ -f "$cp1File" ] && { CP1=`aggregatecp "$cp1File"` dbg "classpath specified in the $cp1File=$CP1" } JVM_CLASSPATH=`awk 'BEGIN { FS=":" } $1 == tag { i=index($0,":"); s=substr($0,i+1); print s; exit; }' tag=JVM_CLASSPATH "$1" 2>/dev/null` cpFile=`modifyFileName "$INSTALLER_PATH" cp` [ -f "$cpFile" ] && { CP=`aggregatecp "$cpFile"` dbg "classpath specified in the $cpFile=$CP" } if [ -z "$APPLICATION_ARCHIVE" ] ; then dbg "Installer JAR archive is not embedded." APPLICATION_ARCHIVE= elif [ "$APPLICATION_ARCHIVE" = EMBED ] ; then extractArchiveJar if [ -f "$INSTALLER_ARCHIVE" ] ; then archiveSize=`wc -c "$INSTALLER_ARCHIVE" | awk '{ if ( $1 ~ /^[0-9]/ ) print $1 ; else print 0; }' 2>/dev/null` if [ $archiveSize -ne $SIZE ] ; then archiveSize=`ls -l "$INSTALLER_ARCHIVE" | awk '{ if ( $5 ~ /^[0-9]/ ) print $5 ; else print 0; }' 2>/dev/null` if [ $archiveSize -ne $SIZE ] ; then dbg "Extracted Installer JAR archive file size incorrect. archive may be corrupt. Failed to launch the application." return else APPLICATION_ARCHIVE="$INSTALLER_ARCHIVE" fi else APPLICATION_ARCHIVE="$INSTALLER_ARCHIVE" fi else dbg "Error extracting Installer JAR archive from shell script wrapper. Failed to launch the application." return fi elif [ -n "$APP_ORIG_HOME" ] ; then if [ -f "$APP_ORIG_HOME"/"$APPLICATION_ARCHIVE" ] ; then dbg "Installer JAR archive is not embedded. Copying from $APP_ORIG_HOME/$APPLICATION_ARCHIVE" rclSize=`wc -c "$APP_ORIG_HOME/$APPLICATION_ARCHIVE" | awk '{ if ( $1 ~ /^[0-9]/ ) print $1 ; else print 0; }' 2>/dev/null` checkDiskSpace "$rclSize" "$ISTEMP" "$APP_ORIG_HOME/$APPLICATION_ARCHIVE" [ $disk_space_check -ne 0 ] && cleanupandexit 1 nospace cp "$APP_ORIG_HOME/$APPLICATION_ARCHIVE" "$ISTEMP/$APPLICATION_ARCHIVE" if [ $? -eq 0 ] ; then INSTALLER_ARCHIVE="$ISTEMP/$APPLICATION_ARCHIVE" else dbg "Error copying the Installer JAR archive from the CD media to temp location on the host machine. Failed to launch the application." return fi else dbg "Installer JAR archive is not located in the CD media location. Failed to launch the application." return fi else dbg "CD media location is not defined and Installer JAR archive can not be located. Failed to launch the application." return fi [ -n "$INSTALLER_ARCHIVE" ] && INSTALLER_ARCHIVE=`awk 'END { s=sprintf("\"%s\"",a); print s; }' a="$INSTALLER_ARCHIVE" </dev/null 2>/dev/null` extractEmbeddedJar cp2File=`modifyFileName "$INSTALLER_PATH" cp2` [ -f "$cp2File" ] && { CP2=`aggregatecp "$cp2File"` dbg "classpath specified in the $cp2File=$CP2" } spFile=`modifyFileName "$INSTALLER_PATH" sp` [ -f "$spFile" ] && { runtimespc=`wc -l "$spFile" | awk '{ print $1 }'` runtimespcc=1 while [ $runtimespcc -le $runtimespc ] ; do runtimespl=`sed -n -e "${runtimespcc}p" "$spFile" 2>/dev/null` RUNTIME_SYSTEMPROP=`awk 'END{ s=sprintf("%s -D%s ",a,b); print s; }' a="$RUNTIME_SYSTEMPROP" b="$runtimespl" </dev/null 2>/dev/null` runtimespcc=`expr $runtimespcc + 1` done dbg "java runtime system properties specified in $spFile file = $RUNTIME_SYSTEMPROP" } resolveBuildTimeJavaArgs "$1" #<jvmfile> resolveRuntimeJavaArgs "$1" #<jvmfile> if [ -f "$ISTEMP/javaargs" ] ; then awk 'L[$0]++ == 0' "$ISTEMP/javaargs" >> "$ISTEMP/javaargs.nodups" ; rm -f "$ISTEMP/javaargs" aggregateJavaArgs "$1" "$ISTEMP/javaargs.nodups" #<jvmfile> <jvmargsfile-oneperline> [ "$DBG" -ne 1 ] && rm -f "$ISTEMP/javaargs.nodups" else dbg "Warning: internal error parsing Java arguments. Launcher command may be missing Java Arguments." fi IS_JVM_FILE="$1" IS_JVM_HOME="$JVM_HOME" IS_LAUNCHER_FILE="$INSTALLER_PATH" IS_TEMP_DIR="$ISTEMP_HOME" if [ -n "$APP_ORIG_HOME" ] ; then MEDIA_DIR="$APP_ORIG_HOME" else MEDIA_DIR=`dirname "$INSTALLER_PATH"` fi [ -z "$LOG" ] && LOG=/dev/null APP_STDERR=">$ISTEMP/APP_STDERR" # make sure APP_STDERR is always assigned. [ \( -z "$SILENT" -a -n "$CONSOLE_ON" \) ] && APP_STDERR="&1" # do re-direction if necessary. if [ "$uimode" -eq 0 ] ; then APP_STDOUT="&1" else APP_STDOUT=">$LOG" # make sure APP_STDOUT is always assigned. [ \( -z "$SILENT" -a -n "$CONSOLE_ON" \) ] && APP_STDOUT="&1" # do re-direction if necessary. fi resolve=0 else dbg "resolved jvm file can not be found. Failed to launch the application." fi }installBundledJRE(){ [ $ismpVV ] && dbg "installing bundled JRE..." installJVMc=0 while [ $installJVMc -lt $FILEINDEXCOUNT ] ; do FI_KEY=`awk 'END{ s=sprintf("$FILEINDEX%s", I); print s }' I=$installJVMc </dev/null 2>/dev/null` eval FI_VALUE=$FI_KEY TYPE=`awk 'END{ split(a,FIELDS, ":"); print FIELDS[1]; }' a=$FI_VALUE </dev/null 2>/dev/null` TYPE=`convert $TYPE` if [ "$TYPE" -eq $JVM_INSTALLER_TYPE ] ; then SIZE=`awk 'END{ split(a,FIELDS, ":"); print FIELDS[3] }' a=$FI_VALUE </dev/null 2>/dev/null` OFFSET=`awk 'END{ split(a,FIELDS, ":"); print FIELDS[4] }' a=$FI_VALUE </dev/null 2>/dev/null` NAME=`awk 'END{ split(a,FIELDS, ":"); print FIELDS[5] }' a=$FI_VALUE </dev/null 2>/dev/null` SIZE=`convert $SIZE` OFFSET=`convert $OFFSET` NAME="$ISTEMP/$NAME" dbg "Extracting bundled JRE..." pbclr pbmesg="Extracting Bundled JRE" pb checkDiskSpace "$SIZE" "$ISTEMP" "$NAME" [ $disk_space_check -ne 0 ] && cleanupandexit 1 nospace extractAFile break fi installJVMc=`expr $installJVMc + 1` done if [ ! -f "$NAME" ] ; then dbg "$NAME is not found. Error extracting bundled JRE. Failed to launch the application." return else [ $ismpVV ] && dbg "extracting bundled JRE successful." fi whereAmI=`pwd` mkdir "$ISTEMP/_bundledJRE_" >/dev/null 2>&1 checkDiskSpace "$NAME" "$ISTEMP" [ $disk_space_check -ne 0 ] && cleanupandexit 1 nospace cd "$ISTEMP/_bundledJRE_" dbg "installing bundled JRE..." pbclr pbmesg="Installing Bundled JRE" pb "$NAME" -qq >/dev/null 2>&1 if [ $? -ne 0 ] ; then cd "$whereAmI" dbg "Error installing bundled JRE. Failed to launch the application." rm -f "$NAME" return else cd "$whereAmI" [ $ismpVV ] && dbg "installing bundled JRE successful." rm -f "$NAME" fi chmod -R 755 "$ISTEMP/_bundledJRE_" > /dev/null 2>&1 if [ -f "$ISTEMP/_bundledJRE_/jvm" ] ; then sed "s/
//;s/^[ ]*//;s/[ ]*$//" "$ISTEMP/_bundledJRE_/jvm" >> "$ISTEMP/_bundledJRE_/jvm.sed" 2>/dev/null mv "$ISTEMP/_bundledJRE_/jvm.sed" "$ISTEMP/_bundledJRE_/jvm" else dbg "Invalid bundled JRE. jvm file is missing. Installation of bundled JRE is not successful." return fi JVM_EXE=`awk 'BEGIN { FS=":" } /^JVM_EXE/ { print $2; exit }' "$ISTEMP/_bundledJRE_/jvm" 2>/dev/null` if [ -z "$JVM_EXE" ] ; then dbg "value of JVM_EXE is an empty string in JVM FILE=$ISTEMP/_bundledJRE_/jvm. Bundled JRE jvm file is incorrect. Installation of bundled JRE is not successful." return else [ $ismpVV ] && dbg "value of JVM_EXE=$JVM_EXE in JVM FILE=$ISTEMP/_bundledJRE_/jvm" fi JVM_EXE=`echo "$JVM_EXE" | sed 's/^[ ]*//;s/[ ]*$//;s/^[ ]*//;s/[ ]*$//;s/\"//g'` if [ -x "$ISTEMP/_bundledJRE_/$JVM_EXE" ] ; then [ $ismpVV ] && dbg "Verifying $ISTEMP/_bundledJRE_/$JVM_EXE using the JVM file $ISTEMP/_bundledJRE_/jvm" VerifyJVM "$ISTEMP/_bundledJRE_/jvm" "$ISTEMP/_bundledJRE_/$JVM_EXE" if [ $verify -eq 0 ] ; then J="$ISTEMP/_bundledJRE_" J=`echo "$J" | sed 's/^[ ]*//;s/[ ]*$//;s/^[ ]*//;s/[ ]*$//'` echo "JVM_HOME:$J" >> "$ISTEMP/_bundledJRE_/jvm" RESOLVED_JVM="$ISTEMP/_bundledJRE_/jvm" IS_JVM_TEMP=1 install_jvm=0 dbg "Verification passed for $ISTEMP/_bundledJRE_ using the JVM file $ISTEMP/_bundledJRE_/jvm." return else dbg "Verification failed for $ISTEMP/_bundledJRE_ using the JVM file $ISTEMP/_bundledJRE_/jvm" fi 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>."
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -