3 jarfilename
="JavaSetup.jar"
4 tempdir
=/var
/tmp
/install_$$
7 java_runtime_found
="no"
8 java_runtime_sufficient
="no"
9 java_versions_supported
="1.4 1.5 1.6"
12 sunjavahotspot
="HotSpot"
20 echo "Using $java_runtime"
21 echo `$java_runtime -version`
22 echo "Running installer"
24 # looking for environment variables
27 if [ "x" != "x$HOME" ]; then
32 if [ "x" != "x$LOG_MODULE_STATES" ]; then
33 log_module_states
=-DLOG_MODULE_STATES=$LOG_MODULE_STATES
37 if [ "x" != "x$GETUID_PATH" ]; then
38 getuid_path
=-DGETUID_PATH=$GETUID_PATH
41 if [ "x" != "x$jrefile" ]; then
42 jrecopy
=-DJRE_FILE=$jrefile
45 # run the installer class file
46 echo $java_runtime $home $log_module_states $getuid_path $jrecopy -jar $jarfilename
47 $java_runtime $home $log_module_states $getuid_path $jrecopy -jar $jarfilename
52 if [ "x$tempdir" != "x" -a -d "$tempdir" ]; then
60 if [ "x" != "x$errorcode" ]; then
61 exitstring
="$exitstring (exit code $errorcode)"
64 # simply echo the exitstring or open a xterm
65 # -> dependent from tty
73 errorfile
=$tempdir/error
75 cat > $errorfile << EOF
77 echo "Press return to continue ..."
83 # searching for xterm in path
86 for i
in `echo $PATH | sed -e 's/^:/.:/g' -e 's/:$/:./g' -e 's/::/:.:/g' -e 's/:/ /g'`; do
87 if [ -x "$i/$xtermname" -a ! -d "$i/$xtermname" ]; then
88 xtermname
="$i/$xtermname"
94 if [ $xtermfound = "no" -a "`uname -s`" = "SunOS" ]; then
95 if [ -x /usr
/openwin
/bin
/xterm
]; then
96 xtermname
=/usr
/openwin
/bin
/xterm
101 if [ $xtermfound = "yes" ]; then
102 $xtermname -e $errorfile
111 set_jre_for_uninstall
()
113 # if "uninstalldata" exists, this is not required
114 if [ ! -d "uninstalldata" ]; then
116 jrefile
=`find $packagepath -type f -name "jre*.rpm" -print`
117 jrefile
=`basename $jrefile`
118 if [ -z "$jrefile" ]; then
122 # check existence of jre rpm
123 if [ ! -f $packagepath/$jrefile ]; then
124 errortext
="Error: Java Runtime Environment (JRE) not found in directory: $packagepath"
133 # Linux requires usage of rpm2cpio to install JRE with user privileges
134 # 1. --relocate /usr/java=/var/tmp does not work, because not all files are
135 # relocatable. Some are always installed into /etc
136 # 2. --root only works with root privileges. With user privileges only the
137 # database is shifted, but not the files.
139 # On Linux currently rpm2cpio is required (and rpm anyhow)
143 if [ ! "$rpm2cpio_found" = "yes" ]; then
144 errortext
="Error: Did not find rpm2cpio. rpm2cpio is currently required for installations on Linux."
151 if [ ! "$rpm_found" = "yes" ]; then
152 errortext
="Error: Did not find rpm. rpm is currently required for installations on Linux."
157 # jrefile=jre-6-linux-i586.rpm
158 # javahome=usr/java/jre1.6.0
162 # using "uninstalldata" for uninstallation
163 if [ -d "uninstalldata" ]; then
164 packagepath
="uninstalldata/jre"
167 jrefile
=`find $packagepath -type f -name "jre*.rpm" -print`
168 jrefile
=`basename $jrefile`
169 if [ -z "$jrefile" ]; then
173 # check existence of jre rpm
174 if [ ! -f $packagepath/$jrefile ]; then
175 errortext
="Error: Java Runtime Environment (JRE) not found in directory: $packagepath"
180 PACKED_JARS
="lib/rt.jar lib/jsse.jar lib/charsets.jar lib/ext/localedata.jar lib/plugin.jar lib/javaws.jar lib/deploy.jar"
184 trap 'rm -rf $tempdir; exit 1' HUP INT QUIT TERM
186 tempjrefile
=$tempdir/$jrefile
187 cp $packagepath/$jrefile $tempjrefile
189 if [ ! -f "$tempjrefile" ]; then
190 errortext
="Error: Failed to copy Java Runtime Environment (JRE) temporarily."
195 # check if copy was successful
196 if [ -x /usr
/bin
/sum ]; then
198 echo "Checksumming..."
200 sumA
=`/usr/bin/sum $packagepath/$jrefile`
215 sumB
=`/usr/bin/sum $tempjrefile`
230 # echo "Checksum 1: A1: $sumA1 B1: $sumB1"
231 # echo "Checksum 2: A2: $sumA2 B2: $sumB2"
233 if [ $sumA1 -ne $sumB1 ] ||
[ $sumA2 -ne $sumB2 ]; then
234 errortext
="Error: Failed to install Java Runtime Environment (JRE) temporarily."
239 echo "Can't find /usr/bin/sum to do checksum. Continuing anyway."
242 # start to install jre
243 echo "Extracting ..."
246 rpm2cpio
$tempjrefile |
cpio -i --make-directories
247 rm -f $tempjrefile # we do not need it anymore, so conserve discspace
249 javahomeparent
=usr
/java
250 javahomedir
=`find $javahomeparent -maxdepth 1 -type d -name "jre*" -print`
251 javahomedir
=`basename $javahomedir`
252 if [ -z "$javahomedir" ]; then
253 javahomedir
="notfound"
256 javahome
=$javahomeparent/$javahomedir
258 if [ ! -d ${javahome} ]; then
259 errortext
="Error: Failed to extract the Java Runtime Environment (JRE) files."
264 UNPACK_EXE
=$javahome/bin
/unpack200
265 if [ -f $UNPACK_EXE ]; then
268 for i
in $PACKED_JARS; do
269 if [ -f $javahome/`dirname $i`/`basename $i .jar`.pack
]; then
270 # printf "Creating %s\n" $javahome/$i
271 $UNPACK_EXE $javahome/`dirname $i`/`basename $i .jar`.pack
$javahome/$i
272 if [ $?
-ne 0 ] ||
[ ! -f $javahome/$i ]; then
273 printf "ERROR: Failed to unpack JAR file:\n\n\t%s\n\n" $i
274 printf "Installation failed. Please refer to the Troubleshooting Section of\n"
275 printf "the Installation Instructions on the download page.\n"
280 # remove the old pack file
281 rm -f $javahome/`dirname $i`/`basename $i .jar`.pack
284 if [ "$packerror" = "1" ]; then
285 if [ -d $javahome ]; then
286 /bin
/rm -rf $javahome
289 errortext
="Error: Failed to extract the Java Runtime Environment (JRE) files."
295 PREFS_LOCATION
="`echo \"${javahome}\" | sed -e 's/^jdk.*/&\/jre/'`/.systemPrefs"
297 if [ ! -d "${PREFS_LOCATION}" ]; then
298 mkdir
-m 755 "${PREFS_LOCATION}"
300 if [ ! -f "${PREFS_LOCATION}/.system.lock" ]; then
301 touch "${PREFS_LOCATION}/.system.lock"
302 chmod 644 "${PREFS_LOCATION}/.system.lock"
304 if [ ! -f "${PREFS_LOCATION}/.systemRootModFile" ]; then
305 touch "${PREFS_LOCATION}/.systemRootModFile"
306 chmod 644 "${PREFS_LOCATION}/.systemRootModFile"
309 if [ x
$ARCH = "x32" ] && [ -f "$javahome/bin/java" ]; then
310 "$javahome/bin/java" -client -Xshare:dump
> /dev
/null
2>&1
313 java_runtime
=$tempdir/$javahome/bin
/java
315 # Make symbolic links to all TrueType font files installed in the system
316 # to avoid garbles for Japanese, Korean or Chinese
317 language
=`printenv LANG | cut -c 1-3`
318 if [ x
$language = "xja_" -o x
$language = "xko_" -o x
$language = "xzh_" ]; then
319 font_fallback_dir
=$javahome/lib
/fonts
/fallback
320 echo "Making symbolic links to TrueType font files into $font_fallback_dir."
321 mkdir
-p $font_fallback_dir
322 ttf_files
=`locate "*.ttf" | xargs`
323 if [ x
$ttf_files = "x" ]; then
324 ttf_files
=`find /usr/share/fonts/ -name "*ttf"`
325 if [ x
$ttf_files = "x" ]; then
326 ttf_files
=`find /usr/X11R6/lib/ -name "*ttf"`
329 ln -s $ttf_files $font_fallback_dir
338 # searching for rpm2cpio in path
339 for i
in `echo $PATH | sed -e 's/^:/.:/g' -e 's/:$/:./g' -e 's/::/:.:/g' -e 's/:/ /g'`; do
340 if [ -x "$i/rpm2cpio" -a ! -d "$i/$rpm2cpio" ]; then
349 # searching for rpm in path
350 for i
in `echo $PATH | sed -e 's/^:/.:/g' -e 's/:$/:./g' -e 's/::/:.:/g' -e 's/:/ /g'`; do
351 if [ -x "$i/rpm" -a ! -d "$i/$rpm" ]; then
360 # Check, if system and installation set fit together (x86 and sparc).
361 # If not, throw a warning.
362 # Architecture of the installation set is saved in file "installdata/xpd/setup.xpd"
363 # <architecture>sparc</architecture> or <architecture>i386</architecture>
364 # Architecture of system is determined with "uname -p"
366 setupxpdfile
="installdata/xpd/setup.xpd"
368 if [ -f $setupxpdfile ]; then
369 platform
=`uname -p` # valid values are "sparc" or "i386"
370 searchstring
="<architecture>$platform</architecture>"
371 match
=`cat $setupxpdfile | grep $searchstring`
373 if [ -z "$match" ]; then
374 # architecture does not fit, warning required
375 if [ "$platform" = "sparc" ]; then
376 echo "Warning: This is an attempt to install Solaris x86 packages on Solaris Sparc."
378 echo "Warning: This is an attempt to install Solaris Sparc packages on Solaris x86."
386 # searching for java runtime in path
387 for i
in `echo $PATH | sed -e 's/^:/.:/g' -e 's/:$/:./g' -e 's/::/:.:/g' -e 's/:/ /g'`; do
388 if [ -x "$i/$java_runtime" -a ! -d "$i/$java_runtime" ]; then
389 java_runtime
="$i/$java_runtime"
390 java_runtime_found
="yes"
398 # check version of an installed JRE
399 javaoutput
=`$java_runtime -version 2>&1 | tail ${tail_args} -1`
400 hotspot
=`echo $javaoutput | grep $sunjavahotspot`
401 if [ ! -z "$hotspot" ]; then
402 for i
in $java_versions_supported; do
403 versionmatch
=`echo $javaoutput | grep $i`
404 if [ ! -z "$versionmatch" ]; then
405 java_runtime_sufficient
="yes"
410 # check new version format, where version number is not part of line 3 (1.6)
411 if [ ! "$java_runtime_sufficient" = "yes" ]; then
412 javaoutput
=`$java_runtime -version 2>&1 | head ${tail_args} -3`
413 for i
in $java_versions_supported; do
414 versionmatch
=`echo $javaoutput | grep $i`
415 if [ ! -z "$versionmatch" ]; then
416 java_runtime_sufficient
="yes"
424 # the user might want to specify java runtime on the commandline
425 USAGE
="Usage: $0 [ -j <java_runtime> ]"
426 while getopts hj
: opt
; do
427 echo "Parameter: $opt"
429 j
) java_runtime_set
="yes";
430 java_runtime
="${OPTARG}"
431 if [ ! -f "$java_runtime" ]; then
432 errortext
="Error: Invalid java runtime $java_runtime, file does not exist."
436 if [ ! -x "$java_runtime" ]; then
437 errortext
="Error: Invalid java runtime $java_runtime, not an executable file."
441 java_runtime_found
="yes";
456 # changing into setup directory
459 # prepare jre, if not set on command line
460 if [ "$java_runtime_set" != "yes" ]; then
462 if [ "`uname -s`" = "Linux" ]; then
464 elif [ "`uname -s`" = "SunOS" ]; then
467 if [ "$java_runtime_found" = "yes" ]; then
469 if [ ! "$java_runtime_sufficient" = "yes" ]; then
470 errortext
="Error: Did not find a valid Java Runtime Environment (JRE). Required JRE versions: $java_versions_supported"
475 errortext
="Error: Did not find an installed Java Runtime Environment (JRE)."
480 errortext
="Error: Platform $platform not supported for Java Runtime Environment (JRE) installation."
486 # jre for Linux is also required, if java runtime is set (for uninstallation mode)
487 if [ "$java_runtime_set" = "yes" ]; then
489 if [ "`uname -s`" = "Linux" ]; then
490 set_jre_for_uninstall