fix kvm agent upgrade issue: kvm agent needs to use java 7 instead of java 6 
after upgrade Reviewed-by: Sheng


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

Branch: refs/heads/4.5
Commit: 77b71e118b36b91d8fc8932248e6fddfbb55e8b4
Parents: 1fb28c2
Author: Edison Su <[email protected]>
Authored: Mon Oct 27 17:24:52 2014 -0700
Committer: Edison Su <[email protected]>
Committed: Thu Nov 6 15:30:09 2014 -0800

----------------------------------------------------------------------
 agent/distro/rhel/SYSCONFDIR/rc.d/init.d/cloud-agent.in | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/77b71e11/agent/distro/rhel/SYSCONFDIR/rc.d/init.d/cloud-agent.in
----------------------------------------------------------------------
diff --git a/agent/distro/rhel/SYSCONFDIR/rc.d/init.d/cloud-agent.in 
b/agent/distro/rhel/SYSCONFDIR/rc.d/init.d/cloud-agent.in
index d1769cc..271d45d 100644
--- a/agent/distro/rhel/SYSCONFDIR/rc.d/init.d/cloud-agent.in
+++ b/agent/distro/rhel/SYSCONFDIR/rc.d/init.d/cloud-agent.in
@@ -44,14 +44,17 @@ unset OPTIONS
 [ -r @SYSCONFDIR@/sysconfig/"$SHORTNAME" ] && source 
@SYSCONFDIR@/sysconfig/"$SHORTNAME"
 
 # The first existing directory is used for JAVA_HOME (if JAVA_HOME is not 
defined in $DEFAULT)
-JDK_DIRS="/usr/lib/jvm/jre /usr/lib/jvm/java-6-openjdk 
/usr/lib/jvm/java-6-openjdk-i386 /usr/lib/jvm/java-6-openjdk-amd64 
/usr/lib/jvm/java-6-sun /usr/lib/jvm/java-1.5.0-sun /usr/lib/j2sdk1.5-sun 
/usr/lib/j2sdk1.5-ibm"
+JDK_DIRS="/usr/lib/jvm/jre /usr/lib/jvm/java-6-openjdk 
/usr/lib/jvm/java-6-openjdk-i386 /usr/lib/jvm/java-6-openjdk-amd64 
/usr/lib/jvm/java-6-sun /usr/lib/jvm/java-1.5.0-sun /usr/lib/j2sdk1.5-sun 
/usr/lib/j2sdk1.5-ibm /usr/lib/jvm/jre-1.7.0"
 
+jhome=""
 for jdir in $JDK_DIRS; do
     if [ -r "$jdir/bin/java" -a -z "${JAVA_HOME}" ]; then
-        JAVA_HOME="$jdir"
+        jhome="$jdir"
     fi
 done
-export JAVA_HOME
+if [ ! -z $jhome ];then
+export JAVA_HOME="$jhome"
+fi
 
 SCP="@SYSTEMCLASSPATH@"
 DCP="@DEPSCLASSPATH@"

Reply via email to