From 7926b4fde36b76848d123186eeea60a075984c44 Mon Sep 17 00:00:00 2001
From: neil_a_wilson <neil_a_wilson@localhost>
Date: Mon, 11 Dec 2006 03:15:28 +0000
Subject: [PATCH] Update the Java Web Start, GUI, and CLI setup modes to write a shell script or batch file that can be used to set JAVA_HOME.  Update all of the tools and administrative scripts provided with OpenDS so that they will use this to set JAVA_HOME unless it's already set in the user's environment.

---
 opends/resource/bin/_server-script.sh |   47 +++++++++++++++++++++++++++--------------------
 1 files changed, 27 insertions(+), 20 deletions(-)

diff --git a/opends/resource/bin/_server-script.sh b/opends/resource/bin/_server-script.sh
index 0629d88..8c42d8e 100755
--- a/opends/resource/bin/_server-script.sh
+++ b/opends/resource/bin/_server-script.sh
@@ -35,22 +35,44 @@
 fi
 
 
+# Capture the current working directory so that we can change to it later.
+# Then capture the location of this script and the Directory Server instance
+# root so that we can use them to create appropriate paths.
+WORKING_DIR=`pwd`
+
+cd `dirname "${0}"`
+SCRIPT_DIR=`pwd`
+
+cd ..
+INSTANCE_ROOT=`pwd`
+export INSTANCE_ROOT
+
+cd "${WORKING_DIR}"
+
+
 # See if JAVA_HOME is set.  If not, then see if there is a java executable in
 # the path and try to figure it out.
 if test -z "${JAVA_BIN}"
 then
   if test -z "${JAVA_HOME}"
   then
-    JAVA_BIN=`which java 2> /dev/null`
-    if test ${?} -eq 0
+    if test -f "${INSTANCE_ROOT}/bin/set-java-home"
     then
+      . "${INSTANCE_ROOT}/bin/set-java-home"
+      JAVA_BIN="${JAVA_HOME}/bin/java"
       export JAVA_BIN
     else
-      echo "Please set JAVA_HOME to the root of a Java 5.0 installation."
-      exit 1
+      JAVA_BIN=`which java 2> /dev/null`
+      if test ${?} -eq 0
+      then
+        export JAVA_BIN
+      else
+        echo "Please set JAVA_HOME to the root of a Java 5.0 installation."
+        exit 1
+      fi
     fi
   else
-    JAVA_BIN=${JAVA_HOME}/bin/java
+    JAVA_BIN="${JAVA_HOME}/bin/java"
     export JAVA_BIN
   fi
 fi
@@ -69,21 +91,6 @@
        LD_PRELOAD LD_PRELOAD_32 LD_PRELOAD_34
 
 
-# Capture the current working directory so that we can change to it later.
-# Then capture the location of this script and the Directory Server instance
-# root so that we can use them to create appropriate paths.
-WORKING_DIR=`pwd`
-
-cd `dirname "${0}"`
-SCRIPT_DIR=`pwd`
-
-cd ..
-INSTANCE_ROOT=`pwd`
-export INSTANCE_ROOT
-
-cd "${WORKING_DIR}"
-
-
 # Configure the appropriate CLASSPATH.
 CLASSPATH=${INSTANCE_ROOT}/classes
 for JAR in ${INSTANCE_ROOT}/lib/*.jar

--
Gitblit v1.10.0