/tmp out of space error


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting /tmp out of space error
# 1  
Old 05-18-2007
Network /tmp out of space error

Hi ,
I am a documentum consultant and facing a problem with a shell script that launches an installer to install documentum . The problem i am facing is that , when i invoke the below script to install the software it says -

The directory /tmp does not contain enough space to extract temporary files.
Please specify a temporary directory using the -is:tempdir option. Use the -is:help option for more information.

But in fact the /tmp space has 1 Gb of space. I dont know how to read a shell script. Can someone tell me by reading this script that what is that is returning the wrong size of the /tmp directory in this script. what command is that ?

i also tried using the -is:tempdir argument and gave another directory to use as a temp space but still it gives the ame error

I am runing this on Solaris 10. I wasnt able to get any help in Documentum forums and I hope that someone here will be able to help me out.


-------------------------------------------------------------------------
#!/bin/sh
# InstallShield (R)
# (c)1996-2004, InstallShield Software Corporation
# (c)1990-1996, InstallShield Corporation
# All Rights Reserved.

#
# Note that if this file is modified, the checksum in the sanity_check() subroutine will need to be updated.
#
# To detect corruption when the installer .bin is tranferred a checksum is used. Checksumming the top portion of
# the file is sufficient to make sure it hasn't been munged by tranferring FTP ascii mode. It would be difficult
# to generate a rescursive checksum on a file where that same checksum is stored. Therefore, the "head -n 1700"
# filter is used to restrict the checksum to the top of the file.
#
# The line count of 1700 will probably *NOT* need to be updated unless the file modifications result in
# the file shrinking in size. The sanity_check() subroutine that contains the checksum string must be outside
# the region that is being checksummed.

main()
{
sh_args="$@"
VERSION=1.0.0.20028
DBG=0
while [ $# -gt 0 ] ;
do
case "$1" in
--) shift; break;;
-is:javahome) ISJAVAHOME="$2"; shift;;
-is:log) DBG=1;LOG="$2"; shift;;

-is:tempdir) ISTEMP_HOME="$2"; shift;;
-is:silent) SILENT=true; app_args="-silent"; shift;;
-isSmilierig) APP_ORIG_HOME="$2"; shift;;
-is:nospacecheck) disk_space_check_off=1; shift;;
-is:freediskblocks) FREE_DISK_BLOCKS="$2"; shift;;
-is:javaconsole) CONSOLE_ON=true;;
-cpSmilie) CP_P="$2"; shift;;
-cp:a) CP_A="$2"; shift;;
-is:extract) extractAll; exit;;
-is:in) inputFile=`echo "$2" | sed -e 's/^\"//;s/\"$//'`; executeExternalInstructions "$inputFile"; exit;;
-is:help) help; exit;;
-is:version) echo $VERSION; exit;;
*) app_args=`awk 'END{ s=sprintf("%s \"%s\"",A,B); print s;}' A="$app_args" B="$1" </dev/null`;;
esac
shift
done
initialize
findFullPath
Instructions "$sh_args"
handleApplicationExitStatus
if [ \( "$sv" -eq 0 -o "$install_jvm" -eq 0 -o "$resolvedJVMVerified" -eq 0 \) ] ; then
cleanupandexit "$applicationExitStatus"
else
cleanupandexit 1 nojvm
fi
}

programAborted()
{
cat ><< HASTOP







Program Aborted. Cleaning up........








HASTOP
}

handleAbort()
{
DBG=0
cleanupandexit 1 abort
}

noJVMFound()
{
cat << noJVMFoundSTOP







This application requires a Java Run Time Environment (JRE)
to run. Searching for one on your computer was not successful.
Please use the command line switch -is:javahome to specify
a valid JRE. For more help use the option -is:help.






noJVMFoundSTOP
}

dsCheckFailed()
{
cat << dsCheckFailedSTOP







The directory $ISTEMP
does not contain enough space to extract temporary files.
Please specify a temporary directory using the -is:tempdir
option. Use the -is:help option for more information.





dsCheckFailedSTOP
}

cleanupandexit()
{
pbl
if [ \( "$DBG" -ne 1 -a -d "$ISTEMP" \) ] ; then
rm -fr "$ISTEMP"
fi
[ -n "$2" ] && {
cls
case "$2" in
abort) programAborted;;
nojvm) noJVMFound;;
nospace) dsCheckFailed;;
esac
}
exit $1
}

dbg()
{
if [ "$DBG" -eq 1 ] ; then
if [ -n "$LOG" ] ; then
echo "$1" >> "$LOG"
fi
fi
}

pbl()
{
[ -z "$SILENT" ] && echo
}

Timer()
{
sleep 60
kill -9 $1 > /dev/null 2>&1
if [ $? -eq 0 ] ; then
echo "Killed JVM during verification step because it took too long"
fi
}

convert()
{
echo "ibase=16; $1" | bc
}

findFullPath()
{
if [ -x "./$0" ] ; then
INSTALLER_PATH="`pwd`/$0"
elif [ -x "$0" ] ; then
INSTALLER_PATH="$0"
fi
dbg "INSTALLER_PATH="$INSTALLER_PATH""
}

banner()
{
[ -z "$SILENT" ] && {
cat << BSTOP







$pbmesg........
BSTOP
}
}

pbclr()
{
[ -z "$SILENT" ] && {
awk ' END {
printf("%c",13);
printf("%s"," ");
i=length(pbmesg);
for (k=1 ; k <= i; k++ ) printf("%c",32);
}' pbmesg="$pbmesg" </dev/null
}
}

pb()
{
[ -z "$SILENT" ] && {
awk ' END {
printf("%c",13);
printf("%s"," ");
printf("%s",pbmesg);
for (k=1 ; k ><= i; k++ )
printf("%c",46);
}' pbmesg="$pbmesg" i=$pbc </dev/null
pbc=`expr $pbc % 8`
}
}

cls()
{
[ -z "$SILENT" ] && clear
}

isNumeric()
{
if [ -n "$1" ] ; then
num=`echo "$1" | sed 's/[0-9]*//g' 2>/dev/null`
case ${num} in
"") echo 0;;
*) echo 1;;
esac
else
echo 1
fi
}

extractAll()
{
findFullPath
[ -z "$ISTEMP_HOME" ] && ISTEMP_HOME=`pwd`
SILENT=true
initialize
OFFSET=0
FIXED_BLOCK_SIZE=1024
if [ ! -x "$INSTALLER_PATH" ] ; then
dbg "Can't locate the installer archive. Extraction failed."
cleanupandexit 100
fi
I=0
while [ $I -lt $FILEINDEXCOUNT ] ; do
II=`awk 'END{ s=sprintf("$FILEINDEX%s", I); print s }' I=$I </dev/null 2>/dev/null`
eval II=$II
dbg "$II"
SIZE=`awk 'END{ split(II,FIELDS, ":"); print FIELDS[3] }' II=$II </dev/null 2>/dev/null`
OFFSET=`awk 'END{ split(II,FIELDS, ":"); print FIELDS[4] }' II=$II </dev/null 2>/dev/null`
NAME=`awk 'END{ split(II,FIELDS, ":"); print FIELDS[5] }' II=$II </dev/null 2>/dev/null`
SIZE=`convert $SIZE`
OFFSET=`convert $OFFSET`
NAME="$ISTEMP/$NAME"
dbg "NAME=$NAME SIZE=$SIZE OFFSET=$OFFSET"
checkDiskSpace "$SIZE" "$ISTEMP" "$NAME"
[ $disk_space_check -ne 0 ] && {
DBG=0
cleanupandexit 1 nospace
}
extractAFile
I=`expr $I + 1`
done
echo "$I files extracted in the directory $ISTEMP"
}

OLDextractAFile()
{
[ $ismpVV ] && dbg "extracting the file $NAME of SIZE=$SIZE at OFFSET=$OFFSET"
if [ "$SIZE" -le "$FIXED_BLOCK_SIZE" ] ; then
BOFFSET=`expr $OFFSET / "$FIXED_BLOCK_SIZE"`
dd if="$INSTALLER_PATH" of="$ISTEMP/filePadded" bs="$FIXED_BLOCK_SIZE" skip="$BOFFSET" count=1 > /dev/null 2>&1
dd if="$ISTEMP/filePadded" of="$NAME" bs="$SIZE" count=1 > /dev/null 2>&1
rm -f "$ISTEMP/filePadded"
else
BOFFSET=`expr $OFFSET / "$FIXED_BLOCK_SIZE"`
BLOCKS=`expr $SIZE / "$FIXED_BLOCK_SIZE"`
BLOCKS=`expr $BLOCKS + 1`
dd if="$INSTALLER_PATH" of="$ISTEMP/filePadded" bs="$FIXED_BLOCK_SIZE" skip="$BOFFSET" count=$BLOCKS > /dev/null 2>&1
dd if="$ISTEMP/filePadded" of="$NAME" bs="$SIZE" count=1 > /dev/null 2>&1
rm -f "$ISTEMP/filePadded"
fi
}

extractJVMFiles()
{
if [ -f "$ISTEMP/jvmfit" ] ; then
c=`wc -l "$ISTEMP/jvmfit" | awk '{ print $1 }'`
I=1
while [ $I -le $c ] ; do
II=`sed -n -e "${I}p" $ISTEMP/jvmfit`
SIZE=`awk 'END{ split(II,FIELDS, ":"); print FIELDS[3] }' II=$II </dev/null 2>/dev/null`
OFFSET=`awk 'END{ split(II,FIELDS, ":"); print FIELDS[4] }' II=$II </dev/null 2>/dev/null`
NAME=`awk 'END{ split(II,FIELDS, ":"); print FIELDS[5] }' II=$II </dev/null 2>/dev/null`
SIZE=`convert $SIZE`
OFFSET=`convert $OFFSET`
NAME="$ISTEMP/$NAME"
extractAFile
if [ -f "$NAME" ] ; then
sed "s///;s/^[ ]*//;s/[ ]*$//" "$NAME" >> "$NAME.sed" 2>/dev/null
rm -f "$NAME"
mv $NAME.sed $NAME
echo "$NAME" >> "$ISTEMP/jvmlist"
fi
I=`expr $I + 1`
done
fi
[ $ismpVV ] && {
dbg "reading jvm list..." ;
if [ -f "$ISTEMP/jvmlist" ] ; then
cat "$ISTEMP/jvmlist" >> $LOG 2>/dev/null;
fi
}
}

extractVerifyJar()
{
I=0
while [ $I -lt $FILEINDEXCOUNT ] ; do
II=`awk 'END{ s=sprintf("$FILEINDEX%s", I); print s }' I=$I </dev/null 2>/dev/null`
eval II=$II
TYPE=`awk 'END{ split(II,FIELDS, ":"); print FIELDS[1]; }' II=$II </dev/null 2>/dev/null`

TYPE=`convert $TYPE`
if [ "$TYPE" -eq "$VERIFY_CLASS_TYPE" ] ; then
SIZE=`awk 'END{ split(II,FIELDS, ":"); print FIELDS[3] }' II=$II </dev/null 2>/dev/null`
OFFSET=`awk 'END{ split(II,FIELDS, ":"); print FIELDS[4] }' II=$II </dev/null 2>/dev/null`
NAME=`awk 'END{ split(II,FIELDS, ":"); print FIELDS[5] }' II=$II </dev/null 2>/dev/null`
SIZE=`convert $SIZE`
OFFSET=`convert $OFFSET`
NAME="$ISTEMP/$NAME"
extractAFile
break
fi
I=`expr $I + 1`
done
}

makeJVMFit()
{
I=0
while [ $I -lt $FILEINDEXCOUNT ] ; do
II=`awk 'END{ s=sprintf("$FILEINDEX%s", I); print s }' I=$I </dev/null 2>/dev/null`
eval II=$II
TYPE=`awk 'END{ split(II,FIELDS, ":"); print FIELDS[1]; }' II=$II </dev/null 2>/dev/null`
TYPE=`convert $TYPE`
if [ "$TYPE" -eq "$JVM_FILE_TYPE" ] ; then
echo $II >> $ISTEMP/jvmfit
fi
I=`expr $I + 1`
done
}

initialize()
{
set +o notify
trap handleAbort 2
FIXED_BLOCK_SIZE=1024
DISK_BLOCK_SIZE=512
POSIXLY_CORRECT=1; export POSIXLY_CORRECT
pbc=1
# the following file TYPE[S] are defined by ISMP builder. Any change to the TYPE number should confirm to the type number defined here.
VERIFY_CLASS_TYPE=5
APP_ARCHIVE_TYPE=6
JVM_FILE_TYPE=1
EMBED_JARS_TYPE=3
BIN_FILE_TYPE=7
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.
[ -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"
mkdir $ISTEMP >/dev/null 2>&1
if [ $? -ne 0 ] ; then
cls
tempLocationErrMesg "$ISTEMP"
cleanupandexit 1
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"`
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"
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=$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=$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`

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 cannot be checked."
fi
}

searchJVM()
{
makeJVMFit
extractJVMFiles

[ "$ISJAVAHOME" ] && {
dbg "command line switch -is:javahome is specified. Verifying the JVM with the JVM files specifed with the launcher."
verifyJavaHome
if [ $sv -eq 0 ] ; then
return
else
dbg "JVM specified with -is:javahome cannot be verified with the JVM files specified with the launcher. Environment Variables will be checked next..."
fi
}


checkEnvironment
if [ $sv -eq 0 ] ; then
return
else
dbg "No JVM can be found using the shell environment variable. Searching JVM will continue with Path Hints specified in the JVM Files..."
fi

JVM_FILE=
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
searchAndVerify "$JVM_FILE"
if [ $sv -eq 0 ] ; then
dbg "jvm found and verification passed for $JVM_FILE."
break
fi
fi
cc=`expr $cc + 1`
done
else
dbg "jvm files not specified. Searching a JVM cannot be performed."
fi
}

aggregatecp()
{
aggregatecpc=`wc -l "$1" | awk '{ print $1 }'`
aggregatecpcc=1
while [ $aggregatecpcc -le $aggregatecpc ] ; do
aggregatecpl=`sed -n -e "${aggregatecpcc}p" "$1" 2>/dev/null`
aggregatecpl=`echo "$aggregatecpl" | sed 's/\"//g' 2>/dev/null`
AGGREGATECP=`awk ' END { s=sprintf("%c%s%c",34,b,34); s=sprintf("%s:%s",a,s); printf s }' a="$AGGREGATECP" b="$aggregatecpl" </dev/null 2>/dev/null`
aggregatecpcc=`expr $aggregatecpcc + 1`
done
echo "$AGGREGATECP"
}

extractArchiveJar()
{
[ -n "$ismpVV" ] && dbg "Installer JAR archive is embedded. Extracting ..."
I=0
while [ $I -lt $FILEINDEXCOUNT ] ; do
II=`awk 'END{ s=sprintf("$FILEINDEX%s", I); print s }' I=$I </dev/null 2>/dev/null`
eval II=$II
TYPE=`awk 'END{ split(II,FIELDS, ":"); print FIELDS[1]; }' II=$II </dev/null 2>/dev/null`
TYPE=`convert $TYPE`
if [ "$TYPE" -eq "$APP_ARCHIVE_TYPE" ] ; then
SIZE=`awk 'END{ split(II,FIELDS, ":"); print FIELDS[3] }' II=$II </dev/null 2>/dev/null`
OFFSET=`awk 'END{ split(II,FIELDS, ":"); print FIELDS[4] }' II=$II </dev/null 2>/dev/null`
NAME=`awk 'END{ split(II,FIELDS, ":"); print FIELDS[5] }' II=$II </dev/null 2>/dev/null`
SIZE=`convert $SIZE`
OFFSET=`convert $OFFSET`
NAME="$ISTEMP/$NAME"
checkDiskSpace "$SIZE" "$ISTEMP" "$NAME"
[ $disk_space_check -ne 0 ] && cleanupandexit 1 nospace
pbclr
pbmesg="Extracting Installation Archive"
pb
extractAFile
INSTALLER_ARCHIVE="$NAME"
break
fi
I=`expr $I + 1`
done
}

extractEmbeddedJar()
{
embeddedJarc=0
while [ $embeddedJarc -lt $FILEINDEXCOUNT ] ; do
FI_KEY=`awk 'END{ s=sprintf("$FILEINDEX%s", I); print s }' I=$embeddedJarc </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 $EMBED_JARS_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 embedded jars in the archive."
checkDiskSpace "$SIZE" "$ISTEMP" "$NAME"
[ $disk_space_check -ne 0 ] && cleanupandexit 1 nospace
extractAFile
EMBEDDED_JARS=`awk ' END { s=sprintf("%c%s%c",34,b,34); s=sprintf("%s:%s",a,s); printf s }' a="$EMBEDDED_JARS" b="$NAME" </dev/null 2>/dev/null`
fi
embeddedJarc=`expr $embeddedJarc + 1`
done
}

parseJavaArgs()
{
awk '$0 !~ /^-/ && /.*,.*/{
if (length($0) > 1 ) {
t=split($0,FIELDS,",")
if (t == 2) print FIELDS[2];
}
}
/^-/{ printf("%s\n",$0); }' | sed 's/\\//g;s/)//;s/^[ ]*//;s/[ ]*$//;s/^\"//;s/\"$//;s/@\(.*\)@\(.*\)/\1=\2/' >> "$ISTEMP/javaargs"
}

aggregateJavaArgs()
{
#<jvmfile> <jvmargsfile-oneperline>
javaArgsc=`wc -l "$2" | awk '{ print $1 }'`
javaArgscc=1
while [ $javaArgscc -le $javaArgsc ] ; do
javaArgsl=`sed -n -e "${javaArgscc}p" "$2"`
javaArgsl=`echo "$javaArgsl" | sed 's/^[ ]*//;s/[ ]*$//'`
if [ `awk 'END { print index(a,"-") }' a="$javaArgsl" </dev/null 2>/dev/null` -ne 1 ] ; then
javaArgsResolved=`awk '{ split(A, FIELDS,"=");
if ( index($0, FIELDS[1]) == 1 ) {
i=index($0, ":") ;
if ( i > 1 ) {
s=substr($0, i+1);
if (length(FIELDS[2]) > 0) {
s=sprintf("%s%s",s, FIELDS[2]);
}
print s;
exit;
}
}
}' A="$javaArgsl" "$1"`
if [ -n "$javaArgsResolved" ] ; then
[ -n "$ismpVV" ] && dbg "Java Argument `echo "$javaArgsl" | cut -d= -f1` is resolved to $javaArgsResolved in the JVM FILE $1"
else
dbg "Java argument `echo "$javaArgsl" | cut -d= -f1` is not defined in the JVM file $1."
fi
else
javaArgsResolved="$javaArgsl"
[ -n "$ismpVV" ] && dbg "using literal Java Argument $javaArgsResolved"
fi

if [ -n "$javaArgsResolved" ] ; then
JAVA_ARGS=`awk 'END{ printf("%s %s", a, b); }' a="$javaArgsResolved" b="$JAVA_ARGS" </dev/null 2>/dev/null`
fi
javaArgscc=`expr $javaArgscc + 1`
done
}

resolveRuntimeJavaArgs()
{
[ -n "$ismpVV" ] && dbg "resolving runtime java args"
jaFile=`modifyFileName "$INSTALLER_PATH" ja`
if [ -f "$jaFile" ] ; then
cat "$jaFile" | sed 's/%IF_EXISTS%//' | parseJavaArgs
else
dbg "Run time Java arguments are not specified."
fi
}

resolveBuildTimeJavaArgs()
{
[ -n "$ismpVV" ] && dbg "resolving buildtime java args"
if [ -n "$JAVA_ARGS_UNRESOLVED" ] ; then
echo "$JAVA_ARGS_UNRESOLVED" | sed 's/%IF_EXISTS%//g;s/) */+/g;s/\(-[^ .]*\)/\1+/g' | tr '+' '\012' | sed 's/^[ ]*//;s/[ ]*$//' | parseJavaArgs
[ \( -f "$ISTEMP/javaargs" -a -n "$ismpVV" \) ] && cp "$ISTEMP/javaargs" "$ISTEMP/javaargs.buildtime"
else
dbg "Build time Java arguments are not specified."
fi
}

modifyFileName()
{
installerDir=`dirname "$1"`
installerDir=`echo "$installerDir" | sed 's/\//\\\\\//g'`
awk 'END {
t=split(a,FIELDS,".");
if ( t > 1 ) {
for (i=1; i<=t-1;i++) s=sprintf("%s.%s",s,FIELDS);
}
else {
s=a;
}
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) > 0 ) {
quotedCPItem=sprintf("%c%s%c",34,FIELDS,34);
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 "-cpSmilie 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 cannot be located. Failed to launch the application."
return
fi

[ -n "$INSTALLER_ARCHIVE" ] && INSTALLER_ARCHIVE=`awk 'END { s=sprintf("%c%s%c",34,a,34); 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 cannot 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 744 "$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 "$HOME" 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."
return
}
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."
return
}
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."
return
}
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 == 2 { 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 == 2 { print $A }' A="$FREE_BLOCKS_COLUMN" | awk '{printf "%s", $0 ; if ($2 != "") printf "\n"}' 2>/dev/null`
# Is Solaris xpg4 available
elif [ -x /usr/xpg4/bin/df ] ; then
cdsAvailable=`/usr/xpg4/bin/df -P "$2" | awk ' NR == 2 { 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" | awk '{ 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 cannot 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 cannot be found. Failed to launch the application."
return
fi
MEDIA_LOCATION=`dirname $INSTALLER_PATH`
runInnerLauncher=`awk 'END{ s=sprintf("%s -isSmilierig %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 "$runInnerLauncher"
exit 0
}

tempLocationErrMesg()
{
cat << END
Temporary directory, $1
does not exist and cannot 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 << STOP
Usage : `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.
-cpSmilie <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 exits
STOP
}

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 cannot 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
}


documentumClearJavaEnv()
{
unset JDK_HOME

unset JRE_HOME

unset JVM_HOME

unset JAVA_HOME

unset J2SE_HOME

unset J2RE_HOME

unset CLASSPATH
}

determineUsername()
{
THE_USER=$LOGNAME

if [ -x "/bin/whoami" ] ; then
THE_USER=`/bin/whoami`
fi

if [ -x "/usr/bin/whoami" ] ; then
THE_USER=`/usr/bin/whoami`
fi

if [ -x "/usr/ucb/whoami" ] ; then
THE_USER=`/usr/ucb/whoami`
fi

}

documentumFixes()
{
if [ "X$DOCUMENTUM_THIS_SCRIPT_HAS_ALREADY_RUN" = "X" ] ; then
DOCUMENTUM_THIS_SCRIPT_HAS_ALREADY_RUN="TRUE"
export DOCUMENTUM_THIS_SCRIPT_HAS_ALREADY_RUN

documentumClearJavaEnv

determineUsername

ISTEMP_HOME="/tmp/dctm_$THE_USER/install_$$"
fi
}

extractAFile()
{
[ $ismpVV ] && dbg "extracting the file $NAME of SIZE=$SIZE at OFFSET=$OFFSET"
CHUNK1=$ISTEMP/chunk1
CHUNK2=$ISTEMP/chunk2

START_BLOCK_OFFSET=`expr $OFFSET / $FIXED_BLOCK_SIZE`
BLOCK_COUNT=`expr $SIZE / $FIXED_BLOCK_SIZE`

if [ $BLOCK_COUNT -ne 0 ] ; then
dd if="$INSTALLER_PATH" of="$NAME" bs=$FIXED_BLOCK_SIZE skip=$START_BLOCK_OFFSET count=$BLOCK_COUNT > /dev/null 2>&1
fi

REMAINDER_SIZE=`expr $SIZE % $FIXED_BLOCK_SIZE`

if [ $REMAINDER_SIZE -ne 0 ] ; then
REMAINDER_BLOCK_OFFSET=`expr $OFFSET + $SIZE`

REMAINDER_BLOCK_OFFSET=`expr $REMAINDER_BLOCK_OFFSET / $FIXED_BLOCK_SIZE`
dd if="$INSTALLER_PATH" of="$CHUNK1" bs=$FIXED_BLOCK_SIZE skip=$REMAINDER_BLOCK_OFFSET count=1 > /dev/null 2>&1

dd if="$CHUNK1" of="$CHUNK2" bs=$REMAINDER_SIZE count=1 > /dev/null 2>&1

cat "$CHUNK2" >> "$NAME"
rm $CHUNK1 $CHUNK2
fi
}

sanity_check_OS() {
EXPECTED_OS="SunOS"
if [ `uname` != $EXPECTED_OS ] ; then
echo "Error: Attempting to run a $EXPECTED_OS binary on a `uname` architecture machine."
exit
fi
}

sanity_check_architecture() {
PROGRAM_NAME=`basename $0`

echo $PROGRAM_NAME | grep -qi ia64
if [ $? -eq 0 ] ; then
EXPECTED_ARCH="ia64"
else
EXPECTED_ARCH="precision"
fi

uname -m | grep -qi ia64
if [ $? -eq 0 ] ; then
ACTUAL_ARCH="ia64"
else
ACTUAL_ARCH="precision"
fi

if [ $EXPECTED_ARCH != $ACTUAL_ARCH -a \
$PROGRAM_NAME != "uninstall.bin" -a \
$PROGRAM_NAME != "uninstaller.bin" ] ; then
echo "IMPORTANT: From the filename \"$PROGRAM_NAME\", it appears that you are attempting "
echo "to run a binary for the $EXPECTED_ARCH architecture on a machine that is "
echo "$ACTUAL_ARCH architecture."
exit
fi
}

sanity_check_cksum() {
# See comment note at top of file.

CKSUM=`head -n 1700 $0 | cksum | awk '{printf "%s", $1}'`
if [ $CKSUM != "2903962195" ] ; then
echo "Error: Checksum error. Note: If using FTP, make sure file was tranferred as binary."
exit
fi
}

sanity_checks() {
sanity_check_OS
#sanity_check_architecture
sanity_check_cksum
}

if [ -w `pwd` ] ; then

if [ "X$DOCUMENTUM_THIS_SCRIPT_RUNNING_DEBUG" = "X" ] ; then
DOCUMENTUM_THIS_SCRIPT_RUNNING_DEBUG="TRUE"
export DOCUMENTUM_THIS_SCRIPT_RUNNING_DEBUG
ismpVV="TRUE"
export ismpVV
DBG=1
LOG=$0.log

exec sh -x $0 $* 2> $0-shelltrace.log
fi

fi

sanity_checks

documentumFixes

_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:0000F000:Verify.jar:00:00000001:00000000
FILEINDEX1=04:00000001:01D54D6B:0000F400:sol.bin:01:00000330:04B583E2
FILEINDEXCOUNT=2
Launch()
{
launcherParentDir=`dirname "$0"`
JAVA_ARGS_UNRESOLVED="%IF_EXISTS%("INIT_JAVA_HEAP", "@INIT_JAVA_HEAP@20m") %IF_EXISTS%("MAX_JAVA_HEAP", "@MAX_JAVA_HEAP@128m")"

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 3
else
pbmesg="Launching InstallShield Wizard"
pbc=8
pb
pbl
pbl
setPreLaunchEnvironment
JC="\"$JVM_HOME/$JVM_EXE\" $CLASSPATH_SWITCH .:$PREPEND_CLASSPATH:$CP1:"$JVM_CLASSPATH":$CP:\"serverSolSuiteSetup.jar\":\"to
mcatUnix5028Setup.jar\":\"serverSolSetup.jar\":\"dfcSolSetup.jar\":\"bofworkflow
Setup.jar\":\"bofcollaborationSetup.jar\":\"tcfSetup.jar\":`awk 'END{ s=sprintf("%c%s/%s%c",34,a,b,34); print s}' a="$launcherParentDir" b="serverSolSuiteSetup.jar" <</dev/null`:$INSTALLER_ARCHIVE:$EMBEDDED_JARS:$CP2:$CLASSPATH:$APPEND_CL
ASSPATH: -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 -home serverSolSuiteSetup.jar -G overwriteJVM=yes "$app_args" 1>$APP_STDOUT 2>$APP_STDERR"
dbg LAUNCH_COMMAND="$JC"
eval $JC
applicationExitStatus=$?
fi
}
setpbmesg()
{
pbmesg="Initializing InstallShield Wizard"
}
#INSTRUCTIONS for the generic unix launcher.
Instructions()
{
searchJVM
if [ $sv -eq 0 ] ; then
Launch
else
installBundledJRE
if [ $install_jvm -eq 0 ] ; then
Launch
fi
fi
}
# 2  
Old 05-18-2007
i just tried running the script with -is:log <log file path> and the log below says ....the problem seemd with the version of bundled jre.
------------------------------------------------------------------------

Temp directory used by shell script launcher = /tmp/dctm_root/install_1975/istem p1975138214057
Log file created by MultiPlatform installer @Fri May 18 21:40:57 CDT 2007
INSTALLER_PATH=/opt/apps/dctm/softwares/./serverSolSuiteSetup.bin
reading jvm list...
Checking the environment variables specifed in the JVM files to find the JVM...
jvm files not specified in the launcher. Environment Variables cannot be checked .
No JVM can be found using the shell environment variable. Searching JVM will co ntinue with Path Hints specified in the JVM Files...
jvm files not specified. Searching a JVM cannot be performed.
installing bundled JRE...
Extracting bundled JRE...
default blocks allocated by the filesystem=8
checking disk space on the parition /tmp/dctm_root/install_1975/istemp1975138214 057 for /tmp/dctm_root/install_1975/istemp1975138214057/sol.bin
60671 512 bytes disk blocks required.
2169808 512 bytes disk blocks available on the partition /tmp/dctm_root/install _1975/istemp1975138214057
Disk space check on the parition /tmp/dctm_root/install_1975/istemp1975138214057 succeeded.
extracting the file /tmp/dctm_root/install_1975/istemp1975138214057/sol.bin of S IZE=30756203 at OFFSET=62464
extracting bundled JRE successful.
default blocks allocated by the filesystem=8
checking disk space on the parition /tmp/dctm_root/install_1975/istemp1975138214 057 for /tmp/dctm_root/install_1975/istemp1975138214057/sol.bin
Bundled JRE is not binary compatible with host OS/Arch or it is corrupt. Testin g bundled JRE failed.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

How to use space in /tmp to increase root?

Hello All, I have solaris server running, uname -a SunOS host 5.9 Generic_112233-12 sun4u sparc SUNW,Sun-Fire-280R Filesystem Size Used Available Capacity Mounted on /dev/md/dsk/d0 9.8G 8.7G 1.0G 90% / /dev/dsk/c1t1d0s3 4.3G 7.7M 4.2G ... (17 Replies)
Discussion started by: gull05
17 Replies

2. Solaris

Solaris 10 error "-sh: /tmp/outfile: cannot create"

Hello, Each time a user log on to host, they receive below error: -sh: /tmp/outfile: cannot create Example: $ ssh host user@host's password: Last login: Fri Dec 4 08:17:28 2015 from client.ref |-----------------------------------------------------------------| -sh:... (2 Replies)
Discussion started by: feroccimx
2 Replies

3. Solaris

Process holding /tmp space, need to know the process details

Hi , In a server /tmp has almost reached 75% and i can see the File system utilization is 48Mb only , so i believe some process is using the /tmp space. I would like to know which process is using /tmp space. # df -h /tmp Filesystem size used avail capacity Mounted on swap ... (9 Replies)
Discussion started by: chidori
9 Replies

4. Shell Programming and Scripting

Calculate total space, total used space and total free space in filesystem names matching keyword

Good afternoon! Im new at scripting and Im trying to write a script to calculate total space, total used space and total free space in filesystem names matching a keyword (in this one we will use keyword virginia). Please dont be mean or harsh, like I said Im new and trying my best. Scripting... (4 Replies)
Discussion started by: bigben1220
4 Replies

5. UNIX for Advanced & Expert Users

no space error in aix

While doing cat on a large file (3 GB file) , I am getting the no space error in the shell script hugefile.sh. Eg: for i in `cat hugefile.txt` do echo "$i" done error: hugefile.sh: no space Please let me know your thoughts in handling this no space issue. (2 Replies)
Discussion started by: techmoris
2 Replies

6. AIX

i-nodes - out of disk space on /tmp

Usage: We run test build jobs that login to our AIX machines and create many small files in /tmp. After these jobs complete, they delete their temporary files that they have created. Issue: After approximately a week /tmp appears to become full. Issuing the command “df –g... (4 Replies)
Discussion started by: bblondin
4 Replies

7. Solaris

/tmp: File system full, swap space limit exceeded

Can you help. My server sunning solaris 9 on x86 platform pretty much hung for a few hours... I could not use telnet or ssh to the box - it kept refusing connection. A few hours later - I was able to log in again. The server has not rebooted but here are the first errors in the messages log... (5 Replies)
Discussion started by: frustrated1
5 Replies

8. AIX

Disk space error.

Dear All, I am working on AIX 5.2, and I have allocated 3072M disk space to /home filesystem. Now system has no free space at /home filesystem. But when I checked data on /home, I have only 900M data. Please if anybody can tell me about this difference and how this can be resolved. Thank You.... (9 Replies)
Discussion started by: system-admin
9 Replies

9. HP-UX

Error: file </tmp/srw25108193> does not exist

Hi Everybody I need help from you guys. I'm getting this message on PC where i'm running Unix User using Reflection in order to get graphically format for Oracle Report Server. What is causing this msg and how to solve it? Regards and thanks in advance. Gege *Error: file... (0 Replies)
Discussion started by: cgege
0 Replies

10. UNIX for Dummies Questions & Answers

monitoring /tmp and /var/tmp for suspicous activity

Hello, does anyone have a script that can check the contents of the /tmp directory and for example e-mail the directory content if anything other than session files are present? Maybe there are better ways to monitor suspicous /tmp and /var/tmp activity, if so I'm listening :) (1 Reply)
Discussion started by: jamesbond
1 Replies
Login or Register to Ask a Question