incubator-ooo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From er...@apache.org
Subject svn commit: r1167536 - /incubator/ooo/trunk/main/setup_native/scripts/javaloader.sh
Date Sat, 10 Sep 2011 15:22:54 GMT
Author: erack
Date: Sat Sep 10 15:22:53 2011
New Revision: 1167536

URL: http://svn.apache.org/viewvc?rev=1167536&view=rev
Log:
native373: #i117733# no linux jre installation on 64 bit systems

# User Ingo Schmidt <is@openoffice.org>

Modified:
    incubator/ooo/trunk/main/setup_native/scripts/javaloader.sh

Modified: incubator/ooo/trunk/main/setup_native/scripts/javaloader.sh
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/setup_native/scripts/javaloader.sh?rev=1167536&r1=1167535&r2=1167536&view=diff
==============================================================================
--- incubator/ooo/trunk/main/setup_native/scripts/javaloader.sh (original)
+++ incubator/ooo/trunk/main/setup_native/scripts/javaloader.sh Sat Sep 10 15:22:53 2011
@@ -9,6 +9,9 @@ java_runtime_sufficient="no"
 java_versions_supported="1.4 1.5 1.6"
 rpm2cpio_found="no"
 rpm_found="no"
+is_64bit_arch="no"
+arch64string="x86_64"
+arch64string2="64-bit"
 sunjavahotspot="HotSpot"
 errortext=""
 errorcode=""
@@ -381,7 +384,7 @@ check_architecture()
     fi
 }
 
-find_solaris_jre()
+find_jre_in_path()
 {
     # searching for java runtime in path
     for i in `echo $PATH | sed -e 's/^:/.:/g' -e 's/:$/:./g' -e 's/::/:.:/g' -e 's/:/ /g'`;
do
@@ -421,6 +424,36 @@ check_jre_version()
     fi
 }
 
+check_linux_jre_version()
+{
+    # check version of an installed JRE
+    javaoutput=`$java_runtime -version 2>&1 | head -1`
+
+    for i in $java_versions_supported; do
+        versionmatch=`echo $javaoutput | grep $i`
+        if [ ! -z "$versionmatch" ]; then
+            java_runtime_sufficient="yes"
+            break
+        fi
+    done
+}
+
+check_64bit_architecture()
+{
+    # check system architecture using "uname -m"
+    # unameoutput=`uname -m 2>&1`
+    # x64str=`echo $unameoutput | grep $arch64string`
+
+    # check system architecture using "file /usr/bin/file"
+    fileoutput=`file /usr/bin/file 2>&1`
+    x64str=`echo $fileoutput | grep $arch64string2`
+
+    if [ ! -z "$x64str" ]; then
+        is_64bit_arch="yes"
+        echo "64-bit Linux"
+    fi
+}
+
 # the user might want to specify java runtime on the commandline
 USAGE="Usage: $0 [ -j <java_runtime> ]"
 while getopts hj: opt; do
@@ -460,10 +493,27 @@ cd "`dirname "$0"`"
 if [ "$java_runtime_set" != "yes" ]; then
     platform=`uname -s`
     if [ "`uname -s`" = "Linux" ]; then
-        install_linux_rpm
+        check_64bit_architecture
+        if [ "$is_64bit_arch" = "no" ]; then
+            install_linux_rpm
+        else
+            find_jre_in_path
+            if [ "$java_runtime_found" = "yes" ]; then
+                check_linux_jre_version
+                if [ ! "$java_runtime_sufficient" = "yes" ]; then
+                    errortext="Error: Did not find a valid Java Runtime Environment (JRE).
Required JRE versions: $java_versions_supported"
+                    errorcode="14"
+                    do_exit
+                fi
+            else
+                errortext="Error: Did not find an installed Java Runtime Environment (JRE)."
+                errorcode="15"
+                do_exit
+            fi
+        fi
     elif [ "`uname -s`" = "SunOS" ]; then
         check_architecture
-        find_solaris_jre
+        find_jre_in_path
         if [ "$java_runtime_found" = "yes" ]; then
             check_jre_version
             if [ ! "$java_runtime_sufficient" = "yes" ]; then



Mime
View raw message