cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject git commit: updated refs/heads/4.4 to ecfe5b5
Date Mon, 08 Sep 2014 08:44:15 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/4.4 ad601425d -> ecfe5b541


CLOUDSTACK-6926: removed hard coded jdk dirs and setting java home using readlink and dirname

(cherry picked from commit c468228fe807c621decc5919dadae9bcbb38c753)

Conflicts:
	packaging/debian/init/cloud-usage


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/ecfe5b54
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/ecfe5b54
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/ecfe5b54

Branch: refs/heads/4.4
Commit: ecfe5b5417355eed90d1f3591a1c2349f58b9bf4
Parents: ad60142
Author: Rajani Karuturi <rajanikaruturi@gmail.com>
Authored: Wed Jun 18 15:36:32 2014 +0530
Committer: Daan Hoogland <daan@onecht.net>
Committed: Mon Sep 8 10:43:59 2014 +0200

----------------------------------------------------------------------
 packaging/centos63/cloud-usage.rc | 32 ++++++++++++++++++++++++--------
 packaging/debian/init/cloud-usage | 11 -----------
 2 files changed, 24 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ecfe5b54/packaging/centos63/cloud-usage.rc
----------------------------------------------------------------------
diff --git a/packaging/centos63/cloud-usage.rc b/packaging/centos63/cloud-usage.rc
index 6c113cb..a03df5b 100755
--- a/packaging/centos63/cloud-usage.rc
+++ b/packaging/centos63/cloud-usage.rc
@@ -46,15 +46,31 @@ USER=cloud
 unset OPTIONS
 [ -r /etc/sysconfig/default/"$SHORTNAME" ] && source /etc/sysconfig/default/"$SHORTNAME"
 
-# The first existing directory is used for JAVA_HOME (if JAVA_HOME is not defined in $DEFAULT)
-JDK_DIRS="/usr/lib/jvm/java-7-openjdk /usr/lib/jvm/java-7-openjdk-i386 /usr/lib/jvm/java-7-openjdk-amd64
/usr/lib/jvm/java-7-sun /usr/lib/jvm/jre-1.7.0 /usr/lib/j2sdk1.5-sun /usr/lib/jre-openjdk"
+setJavaHome() {
+  # use $JAVA_HOME if defined
+  if [ -n "$JAVA_HOME" ] ; then
+    return
+  fi
+
+  # try javac first
+  java=$(which javac 2>/dev/null || :)
+
+  # try java if javac is not found
+  if [ -z "$java" ] ; then
+    java=$(which java 2>/dev/null || :)
+  fi
+
+  if [ -n "$java" ] ; then
+    JAVA_HOME=$(dirname $(dirname $(readlink -e $java)))
+    export JAVA_HOME
+    return
+  fi
+
+  # didnt find java home. exiting with error
+  exit 1
+}
 
-for jdir in $JDK_DIRS; do
-    if [ -r "$jdir/bin/java" -a -z "${JAVA_HOME}" ]; then
-        JAVA_HOME="$jdir"
-    fi
-done
-export JAVA_HOME
+setJavaHome
 
 SCP=""
 DCP=""

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ecfe5b54/packaging/debian/init/cloud-usage
----------------------------------------------------------------------
diff --git a/packaging/debian/init/cloud-usage b/packaging/debian/init/cloud-usage
index fcede4f..9b27864 100755
--- a/packaging/debian/init/cloud-usage
+++ b/packaging/debian/init/cloud-usage
@@ -62,17 +62,6 @@ setJavaHome() {
     return
   fi
 
-  # If everything has failed, try hardcoded paths
-  # The first existing directory is used for JAVA_HOME (if JAVA_HOME is not defined in $DEFAULT)
-  JDK_DIRS="/usr/lib/jvm/java-7-openjdk-amd64 /usr/lib/jvm/java-7-openjdk-i386 /usr/lib/jvm/java-7-oracle
/usr/lib/jvm/java-7-openjdk /usr/lib/jvm/java-7-sun"
-  for jdir in $JDK_DIRS; do
-    if [ -r "$jdir/bin/java" -a -z "${JAVA_HOME}" ]; then
-      JAVA_HOME="$jdir"
-      export JAVA_HOME
-      return
-    fi
-  done
-
   # didnt find java home. exiting with error
   exit 1
 }


Mime
View raw message