From fd123dfd23f241e312dfa5e6430dc52cf4a0a98d Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Fri, 28 Sep 2007 19:50:40 +0000
Subject: [PATCH] Fix for issue 2035 (Use OpenDS specific environment variables to determine the JVM to be used.)
---
opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/Installer.java | 8
opendj-sdk/opends/resource/bin/_server-script.bat | 38 +
opendj-sdk/opends/resource/bin/stop-ds | 50 +-
opendj-sdk/opends/resource/uninstall.bat | 42 +
opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/offline/OfflineInstaller.java | 2
opendj-sdk/opends/resource/bin/start-ds | 62 ++-
opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/BuildInformation.java | 7
opendj-sdk/opends/resource/bin/status-panel.bat | 52 ++
opendj-sdk/opends/resource/setup.bat | 61 ++-
opendj-sdk/opends/resource/bin/_client-script.bat | 38 +
opendj-sdk/opends/src/server/org/opends/server/tools/CreateRCScript.java | 11
opendj-sdk/opends/resource/upgrade | 85 ++--
opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/util/ExternalTools.java | 8
opendj-sdk/opends/src/server/org/opends/server/util/SetupUtils.java | 23
opendj-sdk/opends/resource/bin/stop-ds.bat | 51 +-
opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/ui/QuickSetup.java | 8
opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/util/ServerController.java | 13
opendj-sdk/opends/resource/upgrade.bat | 46 +-
opendj-sdk/opends/resource/setup | 79 ++--
opendj-sdk/opends/src/guitools/org/opends/guitools/statuspanel/StatusPanelController.java | 14
opendj-sdk/opends/resource/bin/start-ds.bat | 59 ++-
opendj-sdk/opends/resource/bin/_server-script.sh | 40 +
opendj-sdk/opends/resource/bin/_client-script.sh | 41 +
opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/webstart/WebStartInstaller.java | 2
opendj-sdk/opends/resource/uninstall | 118 +++++++
25 files changed, 612 insertions(+), 346 deletions(-)
diff --git a/opendj-sdk/opends/resource/bin/_client-script.bat b/opendj-sdk/opends/resource/bin/_client-script.bat
index 5dc4b9b..eb1b413 100644
--- a/opendj-sdk/opends/resource/bin/_client-script.bat
+++ b/opendj-sdk/opends/resource/bin/_client-script.bat
@@ -33,31 +33,43 @@
set INSTANCE_ROOT=%DIR_HOME%
if "%OPENDS_INVOKE_CLASS%" == "" goto noInvokeClass
-goto checkJavaBin
+goto checkOpenDSJavaBin
:noInvokeClass
echo Error: OPENDS_INVOKE_CLASS environment variable is not set.
pause
goto end
-:checkJavaBin
-if "%JAVA_BIN%" == "" goto noJavaBin
+:checkOpenDSJavaBin
+if "%OPENDS_JAVA_BIN%" == "" goto checkOpenDSJavaHome
goto setClassPath
-:noJavaBin
+:checkOpenDSJavaHome
+if "%OPENDS_JAVA_HOME%" == "" goto checkOpenDSJavaHomeFile
+if not exist "%OPENDS_JAVA_HOME%\bin\java.exe" goto checkOpenDSJavaHomeFile
+set OPENDS_JAVA_BIN=%OPENDS_JAVA_HOME%\bin\java.exe
+goto setClassPath
+
+:checkOpenDSJavaHomeFile
+if not exist "%DIR_HOME%\lib\set-java-home.bat" goto checkJavaBin
+call "%DIR_HOME%\lib\set-java-home.bat"
+if not exist "%OPENDS_JAVA_HOME%\bin\java.exe" goto checkJavaBin
+set OPENDS_JAVA_BIN=%OPENDS_JAVA_HOME%\bin\java.exe
+goto setClassPath
+
+:checkJavaBin
+if "%JAVA_BIN%" == "" goto checkJavaHome
+set OPENDS_JAVA_BIN=%JAVA_BIN%
+goto setClassPath
+
+:checkJavaHome
if "%JAVA_HOME%" == "" goto noJavaHome
if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHome
-set JAVA_BIN=%JAVA_HOME%\bin\java.exe
+set OPENDS_JAVA_BIN=%JAVA_HOME%\bin\java.exe
goto setClassPath
:noJavaHome
-if not exist "%DIR_HOME%\lib\set-java-home.bat" goto noSetJavaHome
-call "%DIR_HOME%\lib\set-java-home.bat"
-set JAVA_BIN=%JAVA_HOME%\bin\java.exe
-goto setClassPath
-
-:noSetJavaHome
-echo Error: JAVA_HOME environment variable is not set.
+echo Error: OPENDS_JAVA_HOME environment variable is not set.
echo Please set it to a valid Java 5 (or later) installation.
pause
goto end
@@ -67,7 +79,7 @@
set PATH=%SystemRoot%
-"%JAVA_BIN%" %JAVA_ARGS% %SCRIPT_NAME_ARG% %OPENDS_INVOKE_CLASS% %*
+"%OPENDS_JAVA_BIN%" %JAVA_ARGS% %SCRIPT_NAME_ARG% %OPENDS_INVOKE_CLASS% %*
:end
diff --git a/opendj-sdk/opends/resource/bin/_client-script.sh b/opendj-sdk/opends/resource/bin/_client-script.sh
index a972b26..7ac2885 100755
--- a/opendj-sdk/opends/resource/bin/_client-script.sh
+++ b/opendj-sdk/opends/resource/bin/_client-script.sh
@@ -50,34 +50,45 @@
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}"
+# See if the environment variables are set. If not, then see if there is a java
+# executable in the path and try to figure it out.
+if test -z "${OPENDS_JAVA_BIN}"
then
- if test -z "${JAVA_HOME}"
+ if test -z "${OPENDS_JAVA_HOME}"
then
if test -f "${INSTANCE_ROOT}/lib/set-java-home"
then
. "${INSTANCE_ROOT}/lib/set-java-home"
- JAVA_BIN="${JAVA_HOME}/bin/java"
- export JAVA_BIN
+ OPENDS_JAVA_BIN="${OPENDS_JAVA_HOME}/bin/java"
+ export OPENDS_JAVA_BIN
else
- JAVA_BIN=`which java 2> /dev/null`
- if test ${?} -eq 0
+ if test -z "${JAVA_BIN}"
then
- export JAVA_BIN
+ if test -z "${JAVA_HOME}"
+ then
+ OPENDS_JAVA_BIN=`which java 2> /dev/null`
+ if test ${?} -eq 0
+ then
+ export OPENDS_JAVA_BIN
+ else
+ echo "Please set OPENDS_JAVA_HOME to the root of a Java 5 (or later) installation."
+ exit 1
+ fi
+ else
+ OPENDS_JAVA_BIN="${JAVA_HOME}/bin/java"
+ export OPENDS_JAVA_BIN
+ fi
else
- echo "Please set JAVA_HOME to the root of a Java 5 (or later) installation."
- exit 1
+ OPENDS_JAVA_BIN="${JAVA_BIN}"
+ export OPENDS_JAVA_BIN
fi
fi
else
- JAVA_BIN="${JAVA_HOME}/bin/java"
- export JAVA_BIN
+ OPENDS_JAVA_BIN="${OPENDS_JAVA_HOME}/bin/java"
+ export OPENDS_JAVA_BIN
fi
fi
-
# Explicitly set the PATH, LD_LIBRARY_PATH, LD_PRELOAD, and other important
# system environment variables for security and compatibility reasons.
PATH=/bin:/usr/bin
@@ -100,4 +111,4 @@
export CLASSPATH
# Launch the appropriate server utility.
-"${JAVA_BIN}" ${JAVA_ARGS} ${SCRIPT_NAME_ARG} "${OPENDS_INVOKE_CLASS}" "${@}"
+"${OPENDS_JAVA_BIN}" ${JAVA_ARGS} ${SCRIPT_NAME_ARG} "${OPENDS_INVOKE_CLASS}" "${@}"
diff --git a/opendj-sdk/opends/resource/bin/_server-script.bat b/opendj-sdk/opends/resource/bin/_server-script.bat
index eded04d..2c40404 100644
--- a/opendj-sdk/opends/resource/bin/_server-script.bat
+++ b/opendj-sdk/opends/resource/bin/_server-script.bat
@@ -33,31 +33,43 @@
set INSTANCE_ROOT=%DIR_HOME%
if "%OPENDS_INVOKE_CLASS%" == "" goto noInvokeClass
-goto checkJavaBin
+goto checkOpenDSJavaBin
:noInvokeClass
echo Error: OPENDS_INVOKE_CLASS environment variable is not set.
pause
goto end
-:checkJavaBin
-if "%JAVA_BIN%" == "" goto noJavaBin
+:checkOpenDSJavaBin
+if "%OPENDS_JAVA_BIN%" == "" goto checkOpenDSJavaHome
goto setClassPath
-:noJavaBin
+:checkOpenDSJavaHome
+if "%OPENDS_JAVA_HOME%" == "" goto checkOpenDSJavaHomeFile
+if not exist "%OPENDS_JAVA_HOME%\bin\java.exe" goto checkOpenDSJavaHomeFile
+set OPENDS_JAVA_BIN=%OPENDS_JAVA_HOME%\bin\java.exe
+goto setClassPath
+
+:checkOpenDSJavaHomeFile
+if not exist "%DIR_HOME%\lib\set-java-home.bat" goto checkJavaBin
+call "%DIR_HOME%\lib\set-java-home.bat"
+if not exist "%OPENDS_JAVA_HOME%\bin\java.exe" goto checkJavaBin
+set OPENDS_JAVA_BIN=%OPENDS_JAVA_HOME%\bin\java.exe
+goto setClassPath
+
+:checkJavaBin
+if "%JAVA_BIN%" == "" goto checkJavaHome
+set OPENDS_JAVA_BIN=%JAVA_BIN%
+goto setClassPath
+
+:checkJavaHome
if "%JAVA_HOME%" == "" goto noJavaHome
if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHome
-set JAVA_BIN=%JAVA_HOME%\bin\java.exe
+set OPENDS_JAVA_BIN=%JAVA_HOME%\bin\java.exe
goto setClassPath
:noJavaHome
-if not exist "%DIR_HOME%\lib\set-java-home.bat" goto noSetJavaHome
-call "%DIR_HOME%\lib\set-java-home.bat"
-set JAVA_BIN=%JAVA_HOME%\bin\java.exe
-goto setClassPath
-
-:noSetJavaHome
-echo Error: JAVA_HOME environment variable is not set.
+echo Error: OPENDS_JAVA_HOME environment variable is not set.
echo Please set it to a valid Java 5 (or later) installation.
pause
goto end
@@ -67,7 +79,7 @@
set PATH=%SystemRoot%
-"%JAVA_BIN%" %JAVA_ARGS% %SCRIPT_NAME_ARG% %OPENDS_INVOKE_CLASS% --configClass org.opends.server.extensions.ConfigFileHandler --configFile "%DIR_HOME%\config\config.ldif" %*
+"%OPENDS_JAVA_BIN%" %JAVA_ARGS% %SCRIPT_NAME_ARG% %OPENDS_INVOKE_CLASS% --configClass org.opends.server.extensions.ConfigFileHandler --configFile "%DIR_HOME%\config\config.ldif" %*
:end
diff --git a/opendj-sdk/opends/resource/bin/_server-script.sh b/opendj-sdk/opends/resource/bin/_server-script.sh
index 203fbb9..830070a 100755
--- a/opendj-sdk/opends/resource/bin/_server-script.sh
+++ b/opendj-sdk/opends/resource/bin/_server-script.sh
@@ -50,30 +50,42 @@
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}"
+# See if the environment variables are set. If not, then see if there is a java
+# executable in the path and try to figure it out.
+if test -z "${OPENDS_JAVA_BIN}"
then
- if test -z "${JAVA_HOME}"
+ if test -z "${OPENDS_JAVA_HOME}"
then
if test -f "${INSTANCE_ROOT}/lib/set-java-home"
then
. "${INSTANCE_ROOT}/lib/set-java-home"
- JAVA_BIN="${JAVA_HOME}/bin/java"
- export JAVA_BIN
+ OPENDS_JAVA_BIN="${OPENDS_JAVA_HOME}/bin/java"
+ export OPENDS_JAVA_BIN
else
- JAVA_BIN=`which java 2> /dev/null`
- if test ${?} -eq 0
+ if test -z "${JAVA_BIN}"
then
- export JAVA_BIN
+ if test -z "${JAVA_HOME}"
+ then
+ OPENDS_JAVA_BIN=`which java 2> /dev/null`
+ if test ${?} -eq 0
+ then
+ export OPENDS_JAVA_BIN
+ else
+ echo "Please set OPENDS_JAVA_HOME to the root of a Java 5 (or later) installation."
+ exit 1
+ fi
+ else
+ OPENDS_JAVA_BIN="${JAVA_HOME}/bin/java"
+ export OPENDS_JAVA_BIN
+ fi
else
- echo "Please set JAVA_HOME to the root of a Java 5 (or later) installation."
- exit 1
+ OPENDS_JAVA_BIN="${JAVA_BIN}"
+ export OPENDS_JAVA_BIN
fi
fi
else
- JAVA_BIN="${JAVA_HOME}/bin/java"
- export JAVA_BIN
+ OPENDS_JAVA_BIN="${OPENDS_JAVA_HOME}/bin/java"
+ export OPENDS_JAVA_BIN
fi
fi
@@ -100,6 +112,6 @@
export CLASSPATH
# Launch the appropriate server utility.
-"${JAVA_BIN}" ${JAVA_ARGS} ${SCRIPT_NAME_ARG} "${OPENDS_INVOKE_CLASS}" \
+"${OPENDS_JAVA_BIN}" ${JAVA_ARGS} ${SCRIPT_NAME_ARG} "${OPENDS_INVOKE_CLASS}" \
--configClass org.opends.server.extensions.ConfigFileHandler \
--configFile "${INSTANCE_ROOT}/config/config.ldif" "${@}"
diff --git a/opendj-sdk/opends/resource/bin/start-ds b/opendj-sdk/opends/resource/bin/start-ds
index 33bfe29..983f4fc 100755
--- a/opendj-sdk/opends/resource/bin/start-ds
+++ b/opendj-sdk/opends/resource/bin/start-ds
@@ -41,32 +41,42 @@
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}"
+# See if the environment variables are set. If not, then see if there is a java
+# executable in the path and try to figure it out.
+if test -z "${OPENDS_JAVA_BIN}"
then
- if test -z "${JAVA_HOME}"
+ if test -z "${OPENDS_JAVA_HOME}"
then
if test -f "${INSTANCE_ROOT}/lib/set-java-home"
then
. "${INSTANCE_ROOT}/lib/set-java-home"
- JAVA_BIN="${JAVA_HOME}/bin/java"
- export JAVA_BIN
+ OPENDS_JAVA_BIN="${OPENDS_JAVA_HOME}/bin/java"
+ export OPENDS_JAVA_BIN
else
- JAVA_BIN=`which java 2> /dev/null`
- if test ${?} -eq 0
+ if test -z "${JAVA_BIN}"
then
- export JAVA_BIN
+ if test -z "${JAVA_HOME}"
+ then
+ OPENDS_JAVA_BIN=`which java 2> /dev/null`
+ if test ${?} -eq 0
+ then
+ export OPENDS_JAVA_BIN
+ else
+ echo "Please set OPENDS_JAVA_HOME to the root of a Java 5 (or later) installation."
+ exit 1
+ fi
+ else
+ OPENDS_JAVA_BIN="${JAVA_HOME}/bin/java"
+ export OPENDS_JAVA_BIN
+ fi
else
- echo "ERROR: No Java installation could be found. Please set"
- echo " JAVA_HOME to the root of a Java 5.0 or higher"
- echo " installation."
- exit 1
+ OPENDS_JAVA_BIN="${JAVA_BIN}"
+ export OPENDS_JAVA_BIN
fi
fi
else
- JAVA_BIN="${JAVA_HOME}/bin/java"
- export JAVA_BIN
+ OPENDS_JAVA_BIN="${OPENDS_JAVA_HOME}/bin/java"
+ export OPENDS_JAVA_BIN
fi
fi
@@ -108,21 +118,21 @@
# Test that the provided JDK is 1.5 compatible.
if test -z "${JAVA_ARGS}"
then
- "${JAVA_BIN}" org.opends.server.tools.InstallDS -t 2> /dev/null
+ "${OPENDS_JAVA_BIN}" org.opends.server.tools.InstallDS -t 2> /dev/null
if test ${?} -ne 0
then
echo "ERROR: The detected Java version could not be used. Please ensure"
- echo " that JAVA_HOME is set to the root of a valid Java 5.0 or"
+ echo " that OPENDS_JAVA_HOME is set to the root of a valid Java 5.0 or"
echo " higher installation."
exit 1
fi
else
- "${JAVA_BIN}" ${JAVA_ARGS} org.opends.server.tools.InstallDS -t 2> /dev/null
+ "${OPENDS_JAVA_BIN}" ${JAVA_ARGS} org.opends.server.tools.InstallDS -t 2> /dev/null
if test ${?} -ne 0
then
echo "ERROR: The detected Java version could not be used with the"
- echo " set of arguments. Please ensure that JAVA_HOME is set to"
- echo " the root of a valid Java 5.0 or higher installation, and"
+ echo " set of arguments. Please ensure that OPENDS_JAVA_HOME is"
+ echo " set to the root of a valid Java 5.0 or higher installation, and"
echo " make sure that JAVA_ARGS contains a valid set of arguments"
echo " for that JVM."
exit 1
@@ -135,7 +145,7 @@
# means that the server is already running and we shouldn't try to start it.
# An exit code of anything else means that we're not trying to start the server
# and we can just exit with that exit code.
-${JAVA_BIN} ${SCRIPT_NAME_ARG} org.opends.server.core.DirectoryServer \
+${OPENDS_JAVA_BIN} ${SCRIPT_NAME_ARG} org.opends.server.core.DirectoryServer \
--configClass org.opends.server.extensions.ConfigFileHandler \
--configFile "${CONFIG_FILE}" --checkStartability "${@}"
EC=${?}
@@ -145,24 +155,24 @@
# run detach
#
touch "${STARTING_FILE}"
- nohup "${JAVA_BIN}" ${JAVA_ARGS} ${SCRIPT_NAME_ARG} \
+ nohup "${OPENDS_JAVA_BIN}" ${JAVA_ARGS} ${SCRIPT_NAME_ARG} \
org.opends.server.core.DirectoryServer \
--configClass org.opends.server.extensions.ConfigFileHandler \
--configFile "${CONFIG_FILE}" "${@}" > "${LOG_FILE}" 2>&1 &
echo $! > "${PID_FILE}"
if test ${EC} -eq 99
then
- "${JAVA_BIN}" -Xms8M -Xmx8M org.opends.server.tools.WaitForFileDelete \
+ "${OPENDS_JAVA_BIN}" -Xms8M -Xmx8M org.opends.server.tools.WaitForFileDelete \
--targetFile "${STARTING_FILE}" --logFile "${LOG_FILE}"
else
- "${JAVA_BIN}" -Xms8M -Xmx8M org.opends.server.tools.WaitForFileDelete \
+ "${OPENDS_JAVA_BIN}" -Xms8M -Xmx8M org.opends.server.tools.WaitForFileDelete \
--targetFile "${STARTING_FILE}"
fi
EC=${?}
if test ${EC} -eq 0
then
# An exit code of 98 means that the server is already running.
- ${JAVA_BIN} ${SCRIPT_NAME_ARG} org.opends.server.core.DirectoryServer \
+ ${OPENDS_JAVA_BIN} ${SCRIPT_NAME_ARG} org.opends.server.core.DirectoryServer \
--configClass org.opends.server.extensions.ConfigFileHandler \
--configFile "${CONFIG_FILE}" --checkStartability > /dev/null 2>&1
EC=${?}
@@ -183,7 +193,7 @@
#
echo $$ > "${PID_FILE}"
rm -f "${LOG_FILE}"
- exec "${JAVA_BIN}" ${JAVA_ARGS} ${SCRIPT_NAME_ARG} \
+ exec "${OPENDS_JAVA_BIN}" ${JAVA_ARGS} ${SCRIPT_NAME_ARG} \
org.opends.server.core.DirectoryServer \
--configClass org.opends.server.extensions.ConfigFileHandler \
--configFile "${CONFIG_FILE}" "${@}"
diff --git a/opendj-sdk/opends/resource/bin/start-ds.bat b/opendj-sdk/opends/resource/bin/start-ds.bat
index 0a06135..538f28a 100644
--- a/opendj-sdk/opends/resource/bin/start-ds.bat
+++ b/opendj-sdk/opends/resource/bin/start-ds.bat
@@ -36,33 +36,44 @@
echo %SCRIPT%: invoked >> %LOG%
-:checkJavaBin
-if "%JAVA_BIN%" == "" goto noJavaBin
+:checkOpenDSJavaBin
+if "%OPENDS_JAVA_BIN%" == "" goto checkOpenDSJavaHome
goto setClassPath
-:noJavaBin
+:checkOpenDSJavaHome
+if "%OPENDS_JAVA_HOME%" == "" goto checkOpenDSJavaHomeFile
+if not exist "%OPENDS_JAVA_HOME%\bin\java.exe" goto checkOpenDSJavaHomeFile
+set OPENDS_JAVA_BIN=%OPENDS_JAVA_HOME%\bin\java.exe
+goto setClassPath
+
+:checkOpenDSJavaHomeFile
+if not exist "%DIR_HOME%\lib\set-java-home.bat" goto checkJavaBin
+call "%DIR_HOME%\lib\set-java-home.bat"
+if not exist "%OPENDS_JAVA_HOME%\bin\java.exe" goto checkJavaBin
+set OPENDS_JAVA_BIN=%OPENDS_JAVA_HOME%\bin\java.exe
+goto setClassPath
+
+:checkJavaBin
+if "%JAVA_BIN%" == "" goto checkJavaHome
+set OPENDS_JAVA_BIN=%JAVA_BIN%
+goto setClassPath
+
+:checkJavaHome
if "%JAVA_HOME%" == "" goto noJavaHome
if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHome
-set JAVA_BIN=%JAVA_HOME%\bin\java.exe
+set OPENDS_JAVA_BIN=%JAVA_HOME%\bin\java.exe
goto setClassPath
:noJavaHome
-if not exist "%DIR_HOME%\lib\set-java-home.bat" goto noSetJavaHome
-call "%DIR_HOME%\lib\set-java-home.bat"
-set JAVA_BIN=%JAVA_HOME%\bin\java.exe
-goto setClassPath
-
-:noSetJavaHome
-echo %SCRIPT%: JAVA_HOME environment variable is not set. >> %LOG%
-echo Error: JAVA_HOME environment variable is not set.
+echo Error: OPENDS_JAVA_HOME environment variable is not set.
echo Please set it to a valid Java 5 (or later) installation.
pause
goto end
:noValidJavaHome
-echo %SCRIPT%: The detected Java version could notf be used. JAVA_HOME=[%JAVA_HOME%] >> %LOG%
+echo %SCRIPT%: The detected Java version could not be used. OPENDS_JAVA_HOME=[%OPENDS_JAVA_HOME%] >> %LOG%
echo ERROR: The detected Java version could not be used. Please set
-echo JAVA_HOME to to a valid Java 5 (or later) installation.
+echo OPENDS_JAVA_HOME to to a valid Java 5 (or later) installation.
pause
goto end
@@ -78,10 +89,10 @@
set SCRIPT_NAME_ARG=-Dorg.opends.server.scriptName=start-ds
rem Test that the provided JDK is 1.5 compatible.
-"%JAVA_BIN%" org.opends.server.tools.InstallDS -t > NUL 2>&1
+"%OPENDS_JAVA_BIN%" org.opends.server.tools.InstallDS -t > NUL 2>&1
if not %errorlevel% == 0 goto noValidJavaHome
-"%JAVA_BIN%" -Xms8M -Xmx8M org.opends.server.core.DirectoryServer --configClass org.opends.server.extensions.ConfigFileHandler --configFile "%DIR_HOME%\config\config.ldif" --checkStartability %*
+"%OPENDS_JAVA_BIN%" -Xms8M -Xmx8M org.opends.server.core.DirectoryServer --configClass org.opends.server.extensions.ConfigFileHandler --configFile "%DIR_HOME%\config\config.ldif" --checkStartability %*
if %errorlevel% == 98 goto serverAlreadyStarted
if %errorlevel% == 99 goto runDetach
@@ -98,7 +109,7 @@
echo %SCRIPT%: Run no detach >> %LOG%
if not exist "%DIR_HOME%\logs\server.out" echo. > "%DIR_HOME%\logs\server.out"
if not exist "%DIR_HOME%\logs\server.starting" echo. > "%DIR_HOME%\logs\server.starting"
-"%JAVA_BIN%" %JAVA_ARGS% org.opends.server.core.DirectoryServer --configClass org.opends.server.extensions.ConfigFileHandler --configFile "%DIR_HOME%\config\config.ldif" %*
+"%OPENDS_JAVA_BIN%" %JAVA_ARGS% org.opends.server.core.DirectoryServer --configClass org.opends.server.extensions.ConfigFileHandler --configFile "%DIR_HOME%\config\config.ldif" %*
goto end
@@ -106,9 +117,9 @@
echo %SCRIPT%: Run detach >> %LOG%
if not exist "%DIR_HOME%\logs\server.out" echo. > "%DIR_HOME%\logs\server.out"
if not exist "%DIR_HOME%\logs\server.starting" echo. > "%DIR_HOME%\logs\server.starting"
-"%DIR_HOME%\lib\winlauncher.exe" start "%DIR_HOME%" "%JAVA_BIN%" %JAVA_ARGS% org.opends.server.core.DirectoryServer --configClass org.opends.server.extensions.ConfigFileHandler --configFile "%DIR_HOME%\config\config.ldif" %*
+"%DIR_HOME%\lib\winlauncher.exe" start "%DIR_HOME%" "%OPENDS_JAVA_BIN%" %JAVA_ARGS% org.opends.server.core.DirectoryServer --configClass org.opends.server.extensions.ConfigFileHandler --configFile "%DIR_HOME%\config\config.ldif" %*
echo %SCRIPT%: Waiting for "%DIR_HOME%\logs\server.out" to be deleted >> %LOG%
-"%JAVA_BIN%" -Xms8M -Xmx8M org.opends.server.tools.WaitForFileDelete --targetFile "%DIR_HOME%\logs\server.starting" --logFile "%DIR_HOME%\logs\server.out"
+"%OPENDS_JAVA_BIN%" -Xms8M -Xmx8M org.opends.server.tools.WaitForFileDelete --targetFile "%DIR_HOME%\logs\server.starting" --logFile "%DIR_HOME%\logs\server.out"
goto checkStarted
:runDetachCalledByWinService
@@ -118,24 +129,24 @@
if not exist "%DIR_HOME%\logs\server.starting" echo. > "%DIR_HOME%\logs\server.starting"
echo. > "%DIR_HOME%\logs\server.startingservice"
echo. > "%DIR_HOME%\logs\winservice.out"
-"%DIR_HOME%\lib\winlauncher.exe" start "%DIR_HOME%" "%JAVA_BIN%" -Xrs %JAVA_ARGS% org.opends.server.core.DirectoryServer --configClass org.opends.server.extensions.ConfigFileHandler --configFile "%DIR_HOME%\config\config.ldif" %*
+"%DIR_HOME%\lib\winlauncher.exe" start "%DIR_HOME%" "%OPENDS_JAVA_BIN%" -Xrs %JAVA_ARGS% org.opends.server.core.DirectoryServer --configClass org.opends.server.extensions.ConfigFileHandler --configFile "%DIR_HOME%\config\config.ldif" %*
echo %SCRIPT%: Waiting for "%DIR_HOME%\logs\server.out" to be deleted >> %LOG%
-"%JAVA_BIN%" -Xms8M -Xmx8M org.opends.server.tools.WaitForFileDelete --targetFile "%DIR_HOME%\logs\server.starting" --logFile "%DIR_HOME%\logs\server.out" --outputFile "%DIR_HOME%\logs\winservice.out"
+"%OPENDS_JAVA_BIN%" -Xms8M -Xmx8M org.opends.server.tools.WaitForFileDelete --targetFile "%DIR_HOME%\logs\server.starting" --logFile "%DIR_HOME%\logs\server.out" --outputFile "%DIR_HOME%\logs\winservice.out"
erase "%DIR_HOME%\logs\server.startingservice"
goto checkStarted
:runAsService
echo %SCRIPT%: Run as service >> %LOG%
-"%JAVA_BIN%" -Xms8M -Xmx8M org.opends.server.tools.StartWindowsService
+"%OPENDS_JAVA_BIN%" -Xms8M -Xmx8M org.opends.server.tools.StartWindowsService
echo %SCRIPT%: Waiting for "%DIR_HOME%\logs\server.startingservice" to be deleted >> %LOG%
-"%JAVA_BIN%" -Xms8M -Xmx8M org.opends.server.tools.WaitForFileDelete --targetFile "%DIR_HOME%\logs\server.startingservice"
+"%OPENDS_JAVA_BIN%" -Xms8M -Xmx8M org.opends.server.tools.WaitForFileDelete --targetFile "%DIR_HOME%\logs\server.startingservice"
rem Type the contents the winwervice.out file and delete it.
if exist "%DIR_HOME%\logs\winservice.out" type "%DIR_HOME%\logs\winservice.out"
if exist "%DIR_HOME%\logs\winservice.out" erase "%DIR_HOME%\logs\winservice.out"
goto end
:checkStarted
-"%JAVA_BIN%" -Xms8M -Xmx8M org.opends.server.core.DirectoryServer --configClass org.opends.server.extensions.ConfigFileHandler --configFile "%DIR_HOME%\config\config.ldif" --checkStartability > NUL 2>&1
+"%OPENDS_JAVA_BIN%" -Xms8M -Xmx8M org.opends.server.core.DirectoryServer --configClass org.opends.server.extensions.ConfigFileHandler --configFile "%DIR_HOME%\config\config.ldif" --checkStartability > NUL 2>&1
if %errorlevel% == 98 goto serverStarted
goto serverNotStarted
diff --git a/opendj-sdk/opends/resource/bin/status-panel.bat b/opendj-sdk/opends/resource/bin/status-panel.bat
index 834db2d..738ea93 100644
--- a/opendj-sdk/opends/resource/bin/status-panel.bat
+++ b/opendj-sdk/opends/resource/bin/status-panel.bat
@@ -30,25 +30,37 @@
set INSTANCE_ROOT=%DIR_HOME%
-:checkJavaBin
-if "%JAVA_BIN%" == "" goto noJavaBin
+:checkOpenDSJavaBin
+if "%OPENDS_JAVA_BIN%" == "" goto checkOpenDSJavaHome
goto setClassPath
-:noJavaBin
+:checkOpenDSJavaHome
+if "%OPENDS_JAVA_HOME%" == "" goto checkOpenDSJavaHomeFile
+if not exist "%OPENDS_JAVA_HOME%\bin\java.exe" goto checkOpenDSJavaHomeFile
+set OPENDS_JAVA_BIN=%OPENDS_JAVA_HOME%\bin\java.exe
+goto setClassPath
+
+:checkOpenDSJavaHomeFile
+if not exist "%DIR_HOME%\lib\set-java-home.bat" goto checkJavaBin
+call "%DIR_HOME%\lib\set-java-home.bat"
+if not exist "%OPENDS_JAVA_HOME%\bin\java.exe" goto checkJavaBin
+set OPENDS_JAVA_BIN=%OPENDS_JAVA_HOME%\bin\java.exe
+goto setClassPath
+
+:checkJavaBin
+if "%JAVA_BIN%" == "" goto checkJavaHome
+set OPENDS_JAVA_BIN=%JAVA_BIN%
+goto setClassPath
+
+:checkJavaHome
if "%JAVA_HOME%" == "" goto noJavaHome
if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHome
-set JAVA_BIN=%JAVA_HOME%\bin\java.exe
+set OPENDS_JAVA_BIN=%JAVA_HOME%\bin\java.exe
goto setClassPath
:noJavaHome
-if not exist "%DIR_HOME%\lib\set-java-home.bat" goto noSetJavaHome
-call "%DIR_HOME%\lib\set-java-home.bat"
-set JAVA_BIN=%JAVA_HOME%\bin\java.exe
-goto setClassPath
-
-:noSetJavaHome
-echo Error: JAVA_HOME environment variable is not set.
-echo Please set it to a valid Java 5 installation.
+echo Error: OPENDS_JAVA_HOME environment variable is not set.
+echo Please set it to a valid Java 5 (or later) installation.
pause
goto end
@@ -57,8 +69,22 @@
set PATH=%SystemRoot%
-"%DIR_HOME%\lib\winlauncher.exe" launch "%JAVA_BIN%" %JAVA_ARGS% org.opends.guitools.statuspanel.StatusPanelLauncher %*
+if "%~1" == "" goto callLaunch
+goto callJava
+
+:callLaunch
+"%DIR_HOME%\lib\winlauncher.exe" launch "%OPENDS_JAVA_BIN%" %JAVA_ARGS% org.opends.guitools.statuspanel.StatusPanelLauncher
goto end
+:callJava
+"%OPENDS_JAVA_BIN%" %JAVA_ARGS% org.opends.guitools.statuspanel.StatusPanelLauncher %*
+
+rem return part
+if %errorlevel% == 50 goto version
+goto end
+
+:version
+rem version information was requested. Return code should be 0.
+exit /B 0
:end
diff --git a/opendj-sdk/opends/resource/bin/stop-ds b/opendj-sdk/opends/resource/bin/stop-ds
index 02ee4df..b16faa8 100755
--- a/opendj-sdk/opends/resource/bin/stop-ds
+++ b/opendj-sdk/opends/resource/bin/stop-ds
@@ -50,30 +50,42 @@
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}"
+# See if the environment variables are set. If not, then see if there is a java
+# executable in the path and try to figure it out.
+if test -z "${OPENDS_JAVA_BIN}"
then
- if test -z "${JAVA_HOME}"
+ if test -z "${OPENDS_JAVA_HOME}"
then
if test -f "${INSTANCE_ROOT}/lib/set-java-home"
then
. "${INSTANCE_ROOT}/lib/set-java-home"
- JAVA_BIN="${JAVA_HOME}/bin/java"
- export JAVA_BIN
+ OPENDS_JAVA_BIN="${OPENDS_JAVA_HOME}/bin/java"
+ export OPENDS_JAVA_BIN
else
- JAVA_BIN=`which java 2> /dev/null`
- if test ${?} -eq 0
+ if test -z "${JAVA_BIN}"
then
- export JAVA_BIN
+ if test -z "${JAVA_HOME}"
+ then
+ OPENDS_JAVA_BIN=`which java 2> /dev/null`
+ if test ${?} -eq 0
+ then
+ export OPENDS_JAVA_BIN
+ else
+ echo "Please set OPENDS_JAVA_HOME to the root of a Java 5 (or later) installation."
+ exit 1
+ fi
+ else
+ OPENDS_JAVA_BIN="${JAVA_HOME}/bin/java"
+ export OPENDS_JAVA_BIN
+ fi
else
- echo "Please set JAVA_HOME to the root of a Java 5.0 installation."
- exit 1
+ OPENDS_JAVA_BIN="${JAVA_BIN}"
+ export OPENDS_JAVA_BIN
fi
fi
else
- JAVA_BIN="${JAVA_HOME}/bin/java"
- export JAVA_BIN
+ OPENDS_JAVA_BIN="${OPENDS_JAVA_HOME}/bin/java"
+ export OPENDS_JAVA_BIN
fi
fi
@@ -107,7 +119,7 @@
# Test that the provided JDK is 1.5 compatible.
if test -z "${JAVA_ARGS}"
then
- "${JAVA_BIN}" org.opends.server.tools.InstallDS -t 2> /dev/null
+ "${OPENDS_JAVA_BIN}" org.opends.server.tools.InstallDS -t 2> /dev/null
if test ${?} -ne 0
then
echo "ERROR: The detected Java version could not be used. Please set "
@@ -115,16 +127,16 @@
exit 1
fi
else
- "${JAVA_BIN}" ${JAVA_ARGS} org.opends.server.tools.InstallDS -t 2> /dev/null
+ "${OPENDS_JAVA_BIN}" ${JAVA_ARGS} org.opends.server.tools.InstallDS -t 2> /dev/null
if test ${?} -ne 0
then
echo "ERROR: The detected Java version could not be used with the specified"
- echo "Java arguments. Please set JAVA_HOME to the root of a Java 5.0 installation."
+ echo "Java arguments. Please set OPENDS_JAVA_HOME to the root of a Java 5.0 installation."
exit 1
fi
fi
-"${JAVA_BIN}" ${JAVA_ARGS} ${SCRIPT_NAME_ARG} \
+"${OPENDS_JAVA_BIN}" ${JAVA_ARGS} ${SCRIPT_NAME_ARG} \
org.opends.server.tools.StopDS --checkStoppability "${@}"
EC=${?}
@@ -189,7 +201,7 @@
EXIT_CODE=${?}
if test ${EXIT_CODE} -eq 0
then
- "${JAVA_BIN}" -Xms8M -Xmx8M org.opends.server.tools.WaitForFileDelete \
+ "${OPENDS_JAVA_BIN}" -Xms8M -Xmx8M org.opends.server.tools.WaitForFileDelete \
--targetFile "${INSTANCE_ROOT}/logs/server.pid" \
--logFile "${INSTANCE_ROOT}/logs/errors"
EXIT_CODE=${?}
@@ -244,5 +256,5 @@
fi
# If we've gotten here, then we should try to stop the server over LDAP.
-"${JAVA_BIN}" ${JAVA_ARGS} ${SCRIPT_NAME_ARG} \
+"${OPENDS_JAVA_BIN}" ${JAVA_ARGS} ${SCRIPT_NAME_ARG} \
org.opends.server.tools.StopDS "${@}"
diff --git a/opendj-sdk/opends/resource/bin/stop-ds.bat b/opendj-sdk/opends/resource/bin/stop-ds.bat
index 905539a..558c100 100644
--- a/opendj-sdk/opends/resource/bin/stop-ds.bat
+++ b/opendj-sdk/opends/resource/bin/stop-ds.bat
@@ -42,33 +42,44 @@
rem echo %SCRIPT%: your-message-here >> %LOG%
echo %SCRIPT%: invoked >> %LOG%
-:checkJavaBin
-if "%JAVA_BIN%" == "" goto noJavaBin
+:checkOpenDSJavaBin
+if "%OPENDS_JAVA_BIN%" == "" goto checkOpenDSJavaHome
goto setClassPath
-:noJavaBin
+:checkOpenDSJavaHome
+if "%OPENDS_JAVA_HOME%" == "" goto checkOpenDSJavaHomeFile
+if not exist "%OPENDS_JAVA_HOME%\bin\java.exe" goto checkOpenDSJavaHomeFile
+set OPENDS_JAVA_BIN=%OPENDS_JAVA_HOME%\bin\java.exe
+goto setClassPath
+
+:checkOpenDSJavaHomeFile
+if not exist "%DIR_HOME%\lib\set-java-home.bat" goto checkJavaBin
+call "%DIR_HOME%\lib\set-java-home.bat"
+if not exist "%OPENDS_JAVA_HOME%\bin\java.exe" goto checkJavaBin
+set OPENDS_JAVA_BIN=%OPENDS_JAVA_HOME%\bin\java.exe
+goto setClassPath
+
+:checkJavaBin
+if "%JAVA_BIN%" == "" goto checkJavaHome
+set OPENDS_JAVA_BIN=%JAVA_BIN%
+goto setClassPath
+
+:checkJavaHome
if "%JAVA_HOME%" == "" goto noJavaHome
if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHome
-set JAVA_BIN=%JAVA_HOME%\bin\java.exe
+set OPENDS_JAVA_BIN=%JAVA_HOME%\bin\java.exe
goto setClassPath
:noJavaHome
-if not exist "%DIR_HOME%\lib\set-java-home.bat" goto noSetJavaHome
-call "%DIR_HOME%\lib\set-java-home.bat"
-set JAVA_BIN=%JAVA_HOME%\bin\java.exe
-goto setClassPath
-
-:noSetJavaHome
-echo Error: JAVA_HOME environment variable is not set.
+echo Error: OPENDS_JAVA_HOME environment variable is not set.
echo Please set it to a valid Java 5 (or later) installation.
-echo %SCRIPT%: JAVA_HOME environment variable is not set. >> %LOG%
pause
goto end
:noValidJavaHome
-echo %SCRIPT%: The detected Java version could not be used. JAVA_HOME=[%JAVA_HOME%] >> %LOG%
+echo %SCRIPT%: The detected Java version could not be used. OPENDS_JAVA_HOME=[%OPENDS_JAVA_HOME%] >> %LOG%
echo ERROR: The detected Java version could not be used. Please set
-echo JAVA_HOME to to a valid Java 5 (or later) installation.
+echo OPENDS_JAVA_HOME to to a valid Java 5 (or later) installation.
pause
goto end
@@ -78,10 +89,10 @@
echo %SCRIPT%: CLASSPATH=%CLASSPATH% >> %LOG%
rem Test that the provided JDK is 1.5 compatible.
-"%JAVA_BIN%" org.opends.server.tools.InstallDS -t > NUL 2>&1
+"%OPENDS_JAVA_BIN%" org.opends.server.tools.InstallDS -t > NUL 2>&1
if not %errorlevel% == 0 goto noValidJavaHome
-"%JAVA_BIN%" -Xms8M -Xmx8M %SCRIPT_NAME_ARG% org.opends.server.tools.StopDS --checkStoppability %*
+"%OPENDS_JAVA_BIN%" -Xms8M -Xmx8M %SCRIPT_NAME_ARG% org.opends.server.tools.StopDS --checkStoppability %*
if %errorlevel% == 98 goto serverAlreadyStopped
if %errorlevel% == 99 goto startUsingSystemCall
@@ -121,16 +132,16 @@
:stopAsWindowsService
echo %SCRIPT%: stop as windows service >> %LOG%
-"%JAVA_BIN%" -Xms8M -Xmx8M org.opends.server.tools.StopWindowsService
+"%OPENDS_JAVA_BIN%" -Xms8M -Xmx8M org.opends.server.tools.StopWindowsService
goto end
:restartAsWindowsService
echo %SCRIPT%: restart as windows service, stopping >> %LOG%
-"%JAVA_BIN%" -Xms8M -Xmx8M org.opends.server.tools.StopWindowsService
+"%OPENDS_JAVA_BIN%" -Xms8M -Xmx8M org.opends.server.tools.StopWindowsService
if not %errorlevel% == 0 goto end
echo %SCRIPT%: restart as windows service, starting >> %LOG%
-"%JAVA_BIN%" -Xms8M -Xmx8M org.opends.server.tools.StartWindowsService
-"%JAVA_BIN%" -Xms8M -Xmx8M org.opends.server.tools.WaitForFileDelete --targetFile "%DIR_HOME%\logs\server.startingservice"
+"%OPENDS_JAVA_BIN%" -Xms8M -Xmx8M org.opends.server.tools.StartWindowsService
+"%OPENDS_JAVA_BIN%" -Xms8M -Xmx8M org.opends.server.tools.WaitForFileDelete --targetFile "%DIR_HOME%\logs\server.startingservice"
rem Type the contents the winwervice.out file and delete it.
if exist "%DIR_HOME%\logs\winservice.out" type "%DIR_HOME%\logs\winservice.out"
if exist "%DIR_HOME%\logs\winservice.out" erase "%DIR_HOME%\logs\winservice.out"
diff --git a/opendj-sdk/opends/resource/setup b/opendj-sdk/opends/resource/setup
index 2210297..1109c86 100755
--- a/opendj-sdk/opends/resource/setup
+++ b/opendj-sdk/opends/resource/setup
@@ -26,30 +26,55 @@
# Portions Copyright 2006-2007 Sun Microsystems, Inc.
-# 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}"
+# 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`
+
+INSTANCE_ROOT=${SCRIPT_DIR}
+export INSTANCE_ROOT
+
+cd "${WORKING_DIR}"
+
+# See if the environment variables are set. If not, then see if there is a java
+# executable in the path and try to figure it out.
+if test -z "${OPENDS_JAVA_BIN}"
then
- if test -z "${JAVA_HOME}"
+ if test -z "${OPENDS_JAVA_HOME}"
then
if test -f "${INSTANCE_ROOT}/lib/set-java-home"
then
- . "${INSTANCE_ROOT}/bin/set-java-home"
- JAVA_BIN="${JAVA_HOME}/bin/java"
- export JAVA_BIN
+ . "${INSTANCE_ROOT}/lib/set-java-home"
+ OPENDS_JAVA_BIN="${OPENDS_JAVA_HOME}/bin/java"
+ export OPENDS_JAVA_BIN
else
- JAVA_BIN=`which java 2> /dev/null`
- if test ${?} -eq 0
+ if test -z "${JAVA_BIN}"
then
- export JAVA_BIN
+ if test -z "${JAVA_HOME}"
+ then
+ OPENDS_JAVA_BIN=`which java 2> /dev/null`
+ if test ${?} -eq 0
+ then
+ export OPENDS_JAVA_BIN
+ else
+ echo "Please set OPENDS_JAVA_HOME to the root of a Java 5 (or later) installation."
+ exit 1
+ fi
+ else
+ OPENDS_JAVA_BIN="${JAVA_HOME}/bin/java"
+ export OPENDS_JAVA_BIN
+ fi
else
- echo "Please set JAVA_HOME to the root of a Java 5 (or later) installation."
- exit 1
+ OPENDS_JAVA_BIN="${JAVA_BIN}"
+ export OPENDS_JAVA_BIN
fi
fi
else
- JAVA_BIN="${JAVA_HOME}/bin/java"
- export JAVA_BIN
+ OPENDS_JAVA_BIN="${OPENDS_JAVA_HOME}/bin/java"
+ export OPENDS_JAVA_BIN
fi
fi
@@ -67,20 +92,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`
-
-INSTANCE_ROOT=${SCRIPT_DIR}
-export INSTANCE_ROOT
-
-cd "${WORKING_DIR}"
-
-
# Configure the appropriate CLASSPATH.
CLASSPATH=${INSTANCE_ROOT}/classes
for JAR in ${INSTANCE_ROOT}/lib/*.jar
@@ -93,32 +104,32 @@
# Determine whether the detected Java environment is acceptable for use.
if test -z "${JAVA_ARGS}"
then
- "${JAVA_BIN}" -client org.opends.server.tools.InstallDS -t 2> /dev/null
+ "${OPENDS_JAVA_BIN}" -client org.opends.server.tools.InstallDS -t 2> /dev/null
if test ${?} -eq 0
then
JAVA_ARGS="-client"
else
- "${JAVA_BIN}" org.opends.server.tools.InstallDS -t 2> /dev/null
+ "${OPENDS_JAVA_BIN}" org.opends.server.tools.InstallDS -t 2> /dev/null
if test ${?} -ne 0
then
echo "ERROR: The detected Java version could not be used. Please set "
- echo " JAVA_HOME to the root of a Java 5 (or later) installation."
+ echo " OPENDS_JAVA_HOME to the root of a Java 5 (or later) installation."
exit 1
fi
fi
else
- "${JAVA_BIN}" ${JAVA_ARGS} org.opends.server.tools.InstallDS -t 2> /dev/null
+ "${OPENDS_JAVA_BIN}" ${JAVA_ARGS} org.opends.server.tools.InstallDS -t 2> /dev/null
if test ${?} -ne 0
then
echo "ERROR: The detected Java version could not be used. Please set "
- echo " JAVA_HOME to the root of a Java 5 (or later) installation."
+ echo " OPENDS_JAVA_HOME to the root of a Java 5 (or later) installation."
exit 1
fi
fi
# Launch the setup process.
-"${JAVA_BIN}" -Dorg.opends.server.scriptName=setup org.opends.quicksetup.installer.SetupLauncher "${@}"
+"${OPENDS_JAVA_BIN}" -Dorg.opends.server.scriptName=setup org.opends.quicksetup.installer.SetupLauncher "${@}"
# return part
RETURN_CODE=$?
diff --git a/opendj-sdk/opends/resource/setup.bat b/opendj-sdk/opends/resource/setup.bat
index 27a6ee5..b9d6e2a 100644
--- a/opendj-sdk/opends/resource/setup.bat
+++ b/opendj-sdk/opends/resource/setup.bat
@@ -39,38 +39,49 @@
set INSTANCE_ROOT=%DIR_HOME%
-:checkJavaBin
-if "%JAVA_BIN%" == "" goto noJavaBin
+:checkOpenDSJavaBin
+if "%OPENDS_JAVA_BIN%" == "" goto checkOpenDSJavaHome
goto setClassPath
+:checkOpenDSJavaHome
+if "%OPENDS_JAVA_HOME%" == "" goto checkOpenDSJavaHomeFile
+if not exist "%OPENDS_JAVA_HOME%\bin\java.exe" goto checkOpenDSJavaHomeFile
+set OPENDS_JAVA_BIN=%OPENDS_JAVA_HOME%\bin\java.exe
+goto setClassPath
+
+:checkOpenDSJavaHomeFile
+if not exist "%DIR_HOME%\lib\set-java-home.bat" goto checkJavaBin
+call "%DIR_HOME%\lib\set-java-home.bat"
+if not exist "%OPENDS_JAVA_HOME%\bin\java.exe" goto checkJavaBin
+set OPENDS_JAVA_BIN=%OPENDS_JAVA_HOME%\bin\java.exe
+goto setClassPath
+
+:checkJavaBin
+if "%JAVA_BIN%" == "" goto checkJavaHome
+set OPENDS_JAVA_BIN=%JAVA_BIN%
+goto setClassPath
+
+:checkJavaHome
+if "%JAVA_HOME%" == "" goto noJavaHome
+if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHome
+set OPENDS_JAVA_BIN=%JAVA_HOME%\bin\java.exe
+goto setClassPath
+
+:noJavaHome
+echo Error: OPENDS_JAVA_HOME environment variable is not set.
+echo Please set it to a valid Java 5 (or later) installation.
+pause
+goto end
+
:invalidPath
echo Error: The current path contains a %% character. OpenDS cannot
echo be installed on a path containing this character.
pause
goto end
-
-:noJavaBin
-if "%JAVA_HOME%" == "" goto noJavaHome
-if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHome
-set JAVA_BIN=%JAVA_HOME%\bin\java.exe
-goto setClassPath
-
-:noJavaHome
-if not exist "%DIR_HOME%\lib\set-java-home.bat" goto noSetJavaHome
-call "%DIR_HOME%\lib\set-java-home.bat"
-set JAVA_BIN=%JAVA_HOME%\bin\java.exe
-goto setClassPath
-
-:noSetJavaHome
-echo Error: JAVA_HOME environment variable is not set.
-echo Please set it to a valid Java 5 (or later) installation.
-pause
-goto end
-
:noValidJavaHome
echo ERROR: The detected Java version could not be used. Please set
-echo JAVA_HOME to to a valid Java 5 (or later) installation.
+echo OPENDS_JAVA_HOME to to a valid Java 5 (or later) installation.
pause
goto end
@@ -81,18 +92,18 @@
set PATH=%SystemRoot%
rem Test that the provided JDK is 1.5 compatible.
-"%JAVA_BIN%" org.opends.server.tools.InstallDS -t > NUL 2>&1
+"%OPENDS_JAVA_BIN%" org.opends.server.tools.InstallDS -t > NUL 2>&1
if not %errorlevel% == 0 goto noValidJavaHome
if "%~1" == "" goto callLaunch
goto callJava
:callLaunch
-"%DIR_HOME%\lib\winlauncher.exe" launch "%JAVA_BIN%" %JAVA_ARGS% org.opends.quicksetup.installer.SetupLauncher
+"%DIR_HOME%\lib\winlauncher.exe" launch "%OPENDS_JAVA_BIN%" %JAVA_ARGS% org.opends.quicksetup.installer.SetupLauncher
goto end
:callJava
-"%JAVA_BIN%" %JAVA_ARGS% org.opends.quicksetup.installer.SetupLauncher %*
+"%OPENDS_JAVA_BIN%" %JAVA_ARGS% org.opends.quicksetup.installer.SetupLauncher %*
rem return part
if %errorlevel% == 50 goto version
diff --git a/opendj-sdk/opends/resource/uninstall b/opendj-sdk/opends/resource/uninstall
index 4ad1205..44e6abc 100644
--- a/opendj-sdk/opends/resource/uninstall
+++ b/opendj-sdk/opends/resource/uninstall
@@ -27,11 +27,117 @@
# This script may be used to uninstall the server.
-OPENDS_INVOKE_CLASS="org.opends.guitools.uninstaller.UninstallLauncher"
-export OPENDS_INVOKE_CLASS
-SCRIPT_NAME_ARG="-Dorg.opends.server.scriptName=uninstall"
-export SCRIPT_NAME_ARG
+# Explicitly set the PATH, LD_LIBRARY_PATH, LD_PRELOAD, and other important
+# system environment variables for security and compatibility reasons.
+PATH=/bin:/usr/bin
+LD_LIBRARY_PATH=
+LD_LIBRARY_PATH_32=
+LD_LIBRARY_PATH_64=
+LD_PRELOAD=
+LD_PRELOAD_32=
+LD_PRELOAD_64=
+export PATH LD_LIBRARY_PATH LD_LIBRARY_PATH_32 LD_LIBRARY_PATH_64 \
+ LD_PRELOAD LD_PRELOAD_32 LD_PRELOAD_34
-SCRIPT_DIR=`dirname "${0}"`
-"${SCRIPT_DIR}/lib/_client-script.sh" "${@}"
\ No newline at end of file
+
+# 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`
+
+INSTANCE_ROOT=${SCRIPT_DIR}
+export INSTANCE_ROOT
+
+cd "${WORKING_DIR}"
+
+# See if the environment variables are set. If not, then see if there is a java
+# executable in the path and try to figure it out.
+if test -z "${OPENDS_JAVA_BIN}"
+then
+ if test -z "${OPENDS_JAVA_HOME}"
+ then
+ if test -f "${INSTANCE_ROOT}/lib/set-java-home"
+ then
+ . "${INSTANCE_ROOT}/lib/set-java-home"
+ OPENDS_JAVA_BIN="${OPENDS_JAVA_HOME}/bin/java"
+ export OPENDS_JAVA_BIN
+ else
+ if test -z "${JAVA_BIN}"
+ then
+ if test -z "${JAVA_HOME}"
+ then
+ OPENDS_JAVA_BIN=`which java 2> /dev/null`
+ if test ${?} -eq 0
+ then
+ export OPENDS_JAVA_BIN
+ else
+ echo "Please set OPENDS_JAVA_HOME to the root of a Java 5 (or later) installation."
+ exit 1
+ fi
+ else
+ OPENDS_JAVA_BIN="${JAVA_HOME}/bin/java"
+ export OPENDS_JAVA_BIN
+ fi
+ else
+ OPENDS_JAVA_BIN="${JAVA_BIN}"
+ export OPENDS_JAVA_BIN
+ fi
+ fi
+ else
+ OPENDS_JAVA_BIN="${OPENDS_JAVA_HOME}/bin/java"
+ export OPENDS_JAVA_BIN
+ fi
+fi
+
+
+# Configure the appropriate CLASSPATH.
+CLASSPATH=${INSTANCE_ROOT}/classes
+for JAR in ${INSTANCE_ROOT}/lib/*.jar
+do
+ CLASSPATH=${CLASSPATH}:${JAR}
+done
+export CLASSPATH
+
+
+# Determine whether the detected Java environment is acceptable for use.
+if test -z "${JAVA_ARGS}"
+then
+ "${OPENDS_JAVA_BIN}" -client org.opends.server.tools.InstallDS -t 2> /dev/null
+ if test ${?} -eq 0
+ then
+ JAVA_ARGS="-client"
+ else
+ "${OPENDS_JAVA_BIN}" org.opends.server.tools.InstallDS -t 2> /dev/null
+ if test ${?} -ne 0
+ then
+ echo "ERROR: The detected Java version could not be used. Please set "
+ echo " OPENDS_JAVA_HOME to the root of a Java 5 (or later) installation."
+ exit 1
+ fi
+ fi
+else
+ "${OPENDS_JAVA_BIN}" ${JAVA_ARGS} org.opends.server.tools.InstallDS -t 2> /dev/null
+ if test ${?} -ne 0
+ then
+ echo "ERROR: The detected Java version could not be used. Please set "
+ echo " OPENDS_JAVA_HOME to the root of a Java 5 (or later) installation."
+ exit 1
+ fi
+fi
+
+# Launch the uninstall process.
+"${OPENDS_JAVA_BIN}" -Dorg.opends.server.scriptName=uninstall org.opends.guitools.uninstaller.UninstallLauncher "${@}"
+
+# return part
+RETURN_CODE=$?
+if test ${RETURN_CODE} -eq 50
+then
+ # Version info was on requested
+ exit 0
+else
+ exit ${RETURN_CODE}
+fi
diff --git a/opendj-sdk/opends/resource/uninstall.bat b/opendj-sdk/opends/resource/uninstall.bat
index c1c53e5..7e55c54 100644
--- a/opendj-sdk/opends/resource/uninstall.bat
+++ b/opendj-sdk/opends/resource/uninstall.bat
@@ -30,31 +30,43 @@
set INSTANCE_ROOT=%DIR_HOME%
-:checkJavaBin
-if "%JAVA_BIN%" == "" goto noJavaBin
+:checkOpenDSJavaBin
+if "%OPENDS_JAVA_BIN%" == "" goto checkOpenDSJavaHome
goto setClassPath
-:noJavaBin
+:checkOpenDSJavaHome
+if "%OPENDS_JAVA_HOME%" == "" goto checkOpenDSJavaHomeFile
+if not exist "%OPENDS_JAVA_HOME%\bin\java.exe" goto checkOpenDSJavaHomeFile
+set OPENDS_JAVA_BIN=%OPENDS_JAVA_HOME%\bin\java.exe
+goto setClassPath
+
+:checkOpenDSJavaHomeFile
+if not exist "%DIR_HOME%\lib\set-java-home.bat" goto checkJavaBin
+call "%DIR_HOME%\lib\set-java-home.bat"
+if not exist "%OPENDS_JAVA_HOME%\bin\java.exe" goto checkJavaBin
+set OPENDS_JAVA_BIN=%OPENDS_JAVA_HOME%\bin\java.exe
+goto setClassPath
+
+:checkJavaBin
+if "%JAVA_BIN%" == "" goto checkJavaHome
+set OPENDS_JAVA_BIN=%JAVA_BIN%
+goto setClassPath
+
+:checkJavaHome
if "%JAVA_HOME%" == "" goto noJavaHome
if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHome
-set JAVA_BIN=%JAVA_HOME%\bin\java.exe
+set OPENDS_JAVA_BIN=%JAVA_HOME%\bin\java.exe
goto setClassPath
:noJavaHome
-if not exist "%DIR_HOME%\lib\set-java-home.bat" goto noSetJavaHome
-call "%DIR_HOME%\lib\set-java-home.bat"
-set JAVA_BIN=%JAVA_HOME%\bin\java.exe
-goto setClassPath
-
-:noSetJavaHome
-echo Error: JAVA_HOME environment variable is not set.
+echo Error: OPENDS_JAVA_HOME environment variable is not set.
echo Please set it to a valid Java 5 (or later) installation.
pause
goto end
:noValidJavaHome
echo ERROR: The detected Java version could not be used. Please set
-echo JAVA_HOME to to a valid Java 5 (or later) installation.
+echo OPENDS_JAVA_HOME to to a valid Java 5 (or later) installation.
pause
goto end
@@ -65,19 +77,19 @@
set PATH=%SystemRoot%
rem Test that the provided JDK is 1.5 compatible.
-"%JAVA_BIN%" org.opends.server.tools.InstallDS -t > NUL 2>&1
+"%OPENDS_JAVA_BIN%" org.opends.server.tools.InstallDS -t > NUL 2>&1
if not %errorlevel% == 0 goto noValidJavaHome
if "%~1" == "" goto callLaunch
goto callJava
:callLaunch
-"%DIR_HOME%\lib\winlauncher.exe" launch "%JAVA_BIN%" %JAVA_ARGS% org.opends.guitools.uninstaller.UninstallLauncher
+"%DIR_HOME%\lib\winlauncher.exe" launch "%OPENDS_JAVA_BIN%" %JAVA_ARGS% org.opends.guitools.uninstaller.UninstallLauncher
goto end
:callJava
set SCRIPT_NAME_ARG="-Dorg.opends.server.scriptName=uninstall"
-"%JAVA_BIN%" %JAVA_ARGS% org.opends.guitools.uninstaller.UninstallLauncher %*
+"%OPENDS_JAVA_BIN%" %JAVA_ARGS% org.opends.guitools.uninstaller.UninstallLauncher %*
rem return part
if %errorlevel% == 50 goto version
diff --git a/opendj-sdk/opends/resource/upgrade b/opendj-sdk/opends/resource/upgrade
index a0d072f..fc3333c 100644
--- a/opendj-sdk/opends/resource/upgrade
+++ b/opendj-sdk/opends/resource/upgrade
@@ -25,36 +25,6 @@
#
# Portions Copyright 2006-2007 Sun Microsystems, Inc.
-
-# 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
- if test -f "${INSTANCE_ROOT}/lib/set-java-home"
- then
- . "${INSTANCE_ROOT}/lib/set-java-home"
- JAVA_BIN="${JAVA_HOME}/bin/java"
- export JAVA_BIN
- else
- 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 (or later) installation."
- exit 1
- fi
- fi
- else
- JAVA_BIN="${JAVA_HOME}/bin/java"
- export JAVA_BIN
- export JAVA_WS
- fi
-fi
-
-
# Explicitly set the PATH, LD_LIBRARY_PATH, LD_PRELOAD, and other important
# system environment variables for security and compatibility reasons.
PATH=/bin:/usr/bin
@@ -81,6 +51,45 @@
cd "${WORKING_DIR}"
+# See if the environment variables are set. If not, then see if there is a java
+# executable in the path and try to figure it out.
+if test -z "${OPENDS_JAVA_BIN}"
+then
+ if test -z "${OPENDS_JAVA_HOME}"
+ then
+ if test -f "${INSTANCE_ROOT}/lib/set-java-home"
+ then
+ . "${INSTANCE_ROOT}/lib/set-java-home"
+ OPENDS_JAVA_BIN="${OPENDS_JAVA_HOME}/bin/java"
+ export OPENDS_JAVA_BIN
+ else
+ if test -z "${JAVA_BIN}"
+ then
+ if test -z "${JAVA_HOME}"
+ then
+ OPENDS_JAVA_BIN=`which java 2> /dev/null`
+ if test ${?} -eq 0
+ then
+ export OPENDS_JAVA_BIN
+ else
+ echo "Please set OPENDS_JAVA_HOME to the root of a Java 5 (or later) installation."
+ exit 1
+ fi
+ else
+ OPENDS_JAVA_BIN="${JAVA_HOME}/bin/java"
+ export OPENDS_JAVA_BIN
+ fi
+ else
+ OPENDS_JAVA_BIN="${JAVA_BIN}"
+ export OPENDS_JAVA_BIN
+ fi
+ fi
+ else
+ OPENDS_JAVA_BIN="${OPENDS_JAVA_HOME}/bin/java"
+ export OPENDS_JAVA_BIN
+ fi
+fi
+
# Configure the appropriate CLASSPATH to test.
for JAR in ${INSTANCE_ROOT}/tmp/upgrade/lib/*.jar
@@ -97,25 +106,25 @@
# Determine whether the detected Java environment is acceptable for use.
if test -z "${JAVA_ARGS}"
then
- "${JAVA_BIN}" -client org.opends.server.tools.InstallDS -t 2> /dev/null
+ "${OPENDS_JAVA_BIN}" -client org.opends.server.tools.InstallDS -t 2> /dev/null
if test ${?} -eq 0
then
JAVA_ARGS="-client"
else
- "${JAVA_BIN}" org.opends.server.tools.InstallDS -t 2> /dev/null
+ "${OPENDS_JAVA_BIN}" org.opends.server.tools.InstallDS -t 2> /dev/null
if test ${?} -ne 0
then
echo "ERROR: The detected Java version could not be used. Please set "
- echo " JAVA_HOME to the root of a Java 5 (or later) installation."
+ echo " OPENDS_JAVA_HOME to the root of a Java 5 (or later) installation."
exit 1
fi
fi
else
- "${JAVA_BIN}" ${JAVA_ARGS} org.opends.server.tools.InstallDS -t 2> /dev/null
+ "${OPENDS_JAVA_BIN}" ${JAVA_ARGS} org.opends.server.tools.InstallDS -t 2> /dev/null
if test ${?} -ne 0
then
echo "ERROR: The detected Java version could not be used. Please set "
- echo " JAVA_HOME to the root of a Java 5.0 installation."
+ echo " OPENDS_JAVA_HOME to the root of a Java 5.0 installation."
exit 1
fi
fi
@@ -142,7 +151,7 @@
# operation is a reversion. An exit code of 50 means that the usage
# statement was printed and there is nothing else to do
-"${JAVA_BIN}" org.opends.quicksetup.upgrader.BuildExtractor "${@}"
+"${OPENDS_JAVA_BIN}" org.opends.quicksetup.upgrader.BuildExtractor "${@}"
RETURN_CODE=$?
if test ${RETURN_CODE} -eq 99
then
@@ -155,7 +164,7 @@
CLASSPATH=${JAR}:${CLASSPATH}
done
# Launch the upgrade process.
- "${JAVA_BIN}" org.opends.quicksetup.upgrader.UpgradeLauncher "${@}"
+ "${OPENDS_JAVA_BIN}" org.opends.quicksetup.upgrader.UpgradeLauncher "${@}"
elif test ${RETURN_CODE} -eq 98
then
# Copy jars to a temporary place from which to run the reverter
@@ -173,7 +182,7 @@
CLASSPATH=${JAR}:${CLASSPATH}
done
# Launch the upgrade process.
- "${JAVA_BIN}" org.opends.quicksetup.upgrader.ReversionLauncher "${@}"
+ "${OPENDS_JAVA_BIN}" org.opends.quicksetup.upgrader.ReversionLauncher "${@}"
fi
elif test ${RETURN_CODE} -eq 50
then
diff --git a/opendj-sdk/opends/resource/upgrade.bat b/opendj-sdk/opends/resource/upgrade.bat
index a585001..a427698 100644
--- a/opendj-sdk/opends/resource/upgrade.bat
+++ b/opendj-sdk/opends/resource/upgrade.bat
@@ -32,7 +32,7 @@
:checkNewVersion
if exist "upgrade.bat.NEW" goto newVersion
-goto checkJavaBin
+goto checkOpenDSJavaBin
:newVersion
echo A new version of this script was made available by the last upgrade
@@ -40,38 +40,50 @@
echo to 'upgrade.bat' before continuing.
goto end
-:checkJavaBin
-if "%JAVA_BIN%" == "" goto noJavaBin
+:checkOpenDSJavaBin
+if "%OPENDS_JAVA_BIN%" == "" goto checkOpenDSJavaHome
goto callExtractor
-:noJavaBin
+:checkOpenDSJavaHome
+if "%OPENDS_JAVA_HOME%" == "" goto checkOpenDSJavaHomeFile
+if not exist "%OPENDS_JAVA_HOME%\bin\java.exe" goto checkOpenDSJavaHomeFile
+set OPENDS_JAVA_BIN=%OPENDS_JAVA_HOME%\bin\java.exe
+goto callExtractor
+
+:checkOpenDSJavaHomeFile
+if not exist "%DIR_HOME%\lib\set-java-home.bat" goto checkJavaBin
+call "%DIR_HOME%\lib\set-java-home.bat"
+if not exist "%OPENDS_JAVA_HOME%\bin\java.exe" goto checkJavaBin
+set OPENDS_JAVA_BIN=%OPENDS_JAVA_HOME%\bin\java.exe
+goto callExtractor
+
+:checkJavaBin
+if "%JAVA_BIN%" == "" goto checkJavaHome
+set OPENDS_JAVA_BIN=%JAVA_BIN%
+goto callExtractor
+
+:checkJavaHome
if "%JAVA_HOME%" == "" goto noJavaHome
if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHome
-set JAVA_BIN=%JAVA_HOME%\bin\java.exe
+set OPENDS_JAVA_BIN=%JAVA_HOME%\bin\java.exe
goto callExtractor
:noJavaHome
-if not exist "%INSTANCE_ROOT%\lib\set-java-home.bat" goto noSetJavaHome
-call "%INSTANCE_ROOT%\lib\set-java-home.bat"
-set JAVA_BIN=%JAVA_HOME%\bin\java.exe
-goto callExtractor
-
-:noSetJavaHome
-echo Error: JAVA_HOME environment variable is not set.
+echo Error: OPENDS_JAVA_HOME environment variable is not set.
echo Please set it to a valid Java 5 (or later) installation.
pause
goto end
:noValidJavaHome
echo ERROR: The detected Java version could not be used. Please set
-echo JAVA_HOME to to a valid Java 5 (or later) installation.
+echo OPENDS_JAVA_HOME to to a valid Java 5 (or later) installation.
pause
goto end
set PATH=%SystemRoot%
rem Test that the provided JDK is 1.5 compatible.
-"%JAVA_BIN%" org.opends.server.tools.InstallDS -t > NUL 2>&1
+"%OPENDS_JAVA_BIN%" org.opends.server.tools.InstallDS -t > NUL 2>&1
if not %errorlevel% == 0 goto noValidJavaHome
:callExtractor
@@ -79,7 +91,7 @@
set CLASSPATH=""
FOR %%x in ("%INSTANCE_ROOT%\lib\*.jar") DO call "%INSTANCE_ROOT%\lib\setcp.bat" %%x
set CLASSPATH=%DIR_HOME%\classes;%CLASSPATH%
-"%JAVA_BIN%" org.opends.quicksetup.upgrader.BuildExtractor %*
+"%OPENDS_JAVA_BIN%" org.opends.quicksetup.upgrader.BuildExtractor %*
if %errorlevel% == 99 goto upgrader
if %errorlevel% == 98 goto reverter
if %errorlevel% == 50 goto version
@@ -89,7 +101,7 @@
:upgrader
set CLASSPATH=""
FOR %%x in ("%INSTANCE_ROOT%\tmp\upgrade\lib\*.jar") DO call "%INSTANCE_ROOT%\lib\setcp.bat" %%x
-"%JAVA_BIN%" org.opends.quicksetup.upgrader.UpgradeLauncher %*
+"%OPENDS_JAVA_BIN%" org.opends.quicksetup.upgrader.UpgradeLauncher %*
goto end
:reverter
@@ -97,7 +109,7 @@
xcopy "%INSTANCE_ROOT%\lib\*.*" "%INSTANCE_ROOT%\tmp\revert\lib\" /E /Q /Y
set CLASSPATH=""
FOR %%x in ("%INSTANCE_ROOT%\tmp\revert\lib\*.jar") DO call "%INSTANCE_ROOT%\lib\setcp.bat" %%x
-"%JAVA_BIN%" org.opends.quicksetup.upgrader.ReversionLauncher %*
+"%OPENDS_JAVA_BIN%" org.opends.quicksetup.upgrader.ReversionLauncher %*
goto end
:version
diff --git a/opendj-sdk/opends/src/guitools/org/opends/guitools/statuspanel/StatusPanelController.java b/opendj-sdk/opends/src/guitools/org/opends/guitools/statuspanel/StatusPanelController.java
index 88a60a0..5dccc3d 100644
--- a/opendj-sdk/opends/src/guitools/org/opends/guitools/statuspanel/StatusPanelController.java
+++ b/opendj-sdk/opends/src/guitools/org/opends/guitools/statuspanel/StatusPanelController.java
@@ -38,6 +38,7 @@
import javax.swing.SwingUtilities;
import org.opends.server.core.DirectoryServer;
+import org.opends.server.util.SetupUtils;
import org.opends.admin.ads.util.ApplicationTrustManager;
import org.opends.guitools.statuspanel.event.ServerStatusChangeEvent;
@@ -565,12 +566,7 @@
argList.toArray(args);
ProcessBuilder pb = new ProcessBuilder(args);
Map<String, String> env = pb.environment();
- env.put("JAVA_HOME", System.getProperty("java.home"));
- /* Remove JAVA_BIN to be sure that we use the JVM running the installer
- * JVM to start the server.
- */
- env.remove("JAVA_BIN");
-
+ env.put(SetupUtils.OPENDS_JAVA_HOME, System.getProperty("java.home"));
try
{
Process process = pb.start();
@@ -683,11 +679,7 @@
argList.toArray(args);
ProcessBuilder pb = new ProcessBuilder(args);
Map<String, String> env = pb.environment();
- env.put("JAVA_HOME", System.getProperty("java.home"));
- /* Remove JAVA_BIN to be sure that we use the JVM running the uninstaller
- * JVM to stop the server.
- */
- env.remove("JAVA_BIN");
+ env.put(SetupUtils.OPENDS_JAVA_HOME, System.getProperty("java.home"));
try
{
diff --git a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/BuildInformation.java b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/BuildInformation.java
index 6cb72b5..fda36d4 100644
--- a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/BuildInformation.java
+++ b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/BuildInformation.java
@@ -31,6 +31,7 @@
import org.opends.quicksetup.util.Utils;
import org.opends.server.util.DynamicConstants;
+import org.opends.server.util.SetupUtils;
import java.util.HashMap;
import java.util.List;
@@ -95,11 +96,7 @@
InputStream is = null;
try {
Map<String, String> env = pb.environment();
- env.put("JAVA_HOME", System.getProperty("java.home"));
- /* Remove JAVA_BIN to be sure that we use the JVM running the
- * uninstaller JVM to run the command.
- */
- env.remove("JAVA_BIN");
+ env.put(SetupUtils.OPENDS_JAVA_HOME, System.getProperty("java.home"));
Process process = pb.start();
is = process.getInputStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(is));
diff --git a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/Installer.java b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/Installer.java
index e51b652..573daab 100644
--- a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/Installer.java
+++ b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/Installer.java
@@ -1654,17 +1654,17 @@
/**
* Writes the java home that we are using for the setup in a file.
- * This way we can use this java home even if the user has not set JAVA_HOME
- * when running the different scripts.
+ * This way we can use this java home even if the user has not set
+ * OPENDS_JAVA_HOME when running the different scripts.
*
*/
- protected void writeJavaHome()
+ protected void writeOpenDSJavaHome()
{
try
{
// This isn't likely to happen, and it's not a serious problem even if
// it does.
- SetupUtils.writeSetJavaHome(getInstallationPath());
+ SetupUtils.writeSetOpenDSJavaHome(getInstallationPath());
} catch (Exception e) {}
}
diff --git a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/offline/OfflineInstaller.java b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/offline/OfflineInstaller.java
index 342920b..068754f 100644
--- a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/offline/OfflineInstaller.java
+++ b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/offline/OfflineInstaller.java
@@ -105,7 +105,7 @@
checkAbort();
- writeJavaHome();
+ writeOpenDSJavaHome();
if (Utils.isWindows() && getUserData().getEnableWindowsService())
{
diff --git a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/webstart/WebStartInstaller.java b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/webstart/WebStartInstaller.java
index 903fa45..6de3e2c 100644
--- a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/webstart/WebStartInstaller.java
+++ b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/webstart/WebStartInstaller.java
@@ -142,7 +142,7 @@
// Write java home before calling Installation class. The installation
// class does a call to start-ds to get information about the build.
- writeJavaHome();
+ writeOpenDSJavaHome();
setInstallation(new Installation(getUserData().getServerLocation()));
checkAbort();
diff --git a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/ui/QuickSetup.java b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/ui/QuickSetup.java
index 6bd64a8..25eda74 100644
--- a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/ui/QuickSetup.java
+++ b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/ui/QuickSetup.java
@@ -35,6 +35,8 @@
import org.opends.quicksetup.util.ProgressMessageFormatter;
import org.opends.quicksetup.util.HtmlProgressMessageFormatter;
import org.opends.quicksetup.util.BackgroundTask;
+import org.opends.server.util.SetupUtils;
+
import static org.opends.quicksetup.util.Utils.*;
import org.opends.messages.MessageBuilder;
import org.opends.messages.Message;
@@ -403,11 +405,7 @@
pb = new ProcessBuilder(cmd);
}
Map<String, String> env = pb.environment();
- env.put("JAVA_HOME", System.getProperty("java.home"));
- /* Remove JAVA_BIN to be sure that we use the JVM running the
- * uninstaller JVM to stop the server.
- */
- env.remove("JAVA_BIN");
+ env.put(SetupUtils.OPENDS_JAVA_HOME, System.getProperty("java.home"));
Process process = pb.start();
/**
* Wait for 3 seconds. Assume that if the process has not exited
diff --git a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/util/ExternalTools.java b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/util/ExternalTools.java
index 1eb0f7d..9d220d2 100644
--- a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/util/ExternalTools.java
+++ b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/util/ExternalTools.java
@@ -29,6 +29,7 @@
import org.opends.messages.Message;
import org.opends.quicksetup.Installation;
+import org.opends.server.util.SetupUtils;
import java.util.logging.Logger;
import java.util.logging.Level;
@@ -113,11 +114,8 @@
ProcessBuilder pb = new ProcessBuilder(args);
Map<String, String> env = pb.environment();
- env.put("JAVA_HOME", System.getProperty("java.home"));
- /* Remove JAVA_BIN to be sure that we use the JVM running the
- * uninstaller JVM to run the command.
- */
- env.remove("JAVA_BIN");
+ env.put(SetupUtils.OPENDS_JAVA_HOME, System.getProperty("java.home"));
+
Process p = pb.start();
BufferedReader out =
diff --git a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/util/ServerController.java b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/util/ServerController.java
index 820a906..f3d4c99 100644
--- a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/util/ServerController.java
+++ b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/util/ServerController.java
@@ -34,6 +34,7 @@
import org.opends.quicksetup.*;
import static org.opends.quicksetup.util.Utils.*;
import org.opends.quicksetup.installer.InstallerHelper;
+import org.opends.server.util.SetupUtils;
import javax.naming.NamingException;
import java.util.ArrayList;
@@ -128,11 +129,7 @@
argList.toArray(args);
ProcessBuilder pb = new ProcessBuilder(args);
Map<String, String> env = pb.environment();
- env.put("JAVA_HOME", System.getProperty("java.home"));
- /* Remove JAVA_BIN to be sure that we use the JVM running the uninstaller
- * JVM to stop the server.
- */
- env.remove("JAVA_BIN");
+ env.put(SetupUtils.OPENDS_JAVA_HOME, System.getProperty("java.home"));
try {
Process process = pb.start();
@@ -294,11 +291,7 @@
ProcessBuilder pb = new ProcessBuilder(args);
pb.directory(installation.getBinariesDirectory());
Map<String, String> env = pb.environment();
- env.put("JAVA_HOME", System.getProperty("java.home"));
- /* Remove JAVA_BIN to be sure that we use the JVM running the installer
- * JVM to start the server.
- */
- env.remove("JAVA_BIN");
+ env.put(SetupUtils.OPENDS_JAVA_HOME, System.getProperty("java.home"));
// Upgrader's classpath contains jars located in the temporary
// directory that we don't want locked by the directory server
diff --git a/opendj-sdk/opends/src/server/org/opends/server/tools/CreateRCScript.java b/opendj-sdk/opends/src/server/org/opends/server/tools/CreateRCScript.java
index b1689cf..40a1789 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/tools/CreateRCScript.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/tools/CreateRCScript.java
@@ -39,6 +39,7 @@
import org.opends.server.types.NullOutputStream;
import org.opends.server.types.OperatingSystem;
import org.opends.server.util.EmbeddedUtils;
+import org.opends.server.util.SetupUtils;
import org.opends.server.util.args.ArgumentParser;
import org.opends.server.util.args.ArgumentException;
import org.opends.server.util.args.BooleanArgument;
@@ -212,7 +213,11 @@
}
else
{
- javaHomeDir = System.getenv("JAVA_HOME");
+ javaHomeDir = System.getenv(SetupUtils.OPENDS_JAVA_HOME);
+ if (javaHomeDir == null)
+ {
+ javaHomeDir = System.getenv("JAVA_HOME");
+ }
if (javaHomeDir == null)
{
javaHomeDir = System.getProperty("java.home");
@@ -250,8 +255,8 @@
w.println();
w.println("# Specify the path to the Java installation to use");
- w.println("JAVA_HOME=\"" + javaHomeDir + "\"");
- w.println("export JAVA_HOME");
+ w.println("OPENDS_JAVA_HOME=\"" + javaHomeDir + "\"");
+ w.println("export OPENDS_JAVA_HOME");
w.println();
if (javaArgs.isPresent())
diff --git a/opendj-sdk/opends/src/server/org/opends/server/util/SetupUtils.java b/opendj-sdk/opends/src/server/org/opends/server/util/SetupUtils.java
index 1bbe5ac..8351fb5 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/util/SetupUtils.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/util/SetupUtils.java
@@ -57,6 +57,11 @@
public static final String IS_WEBSTART = "org.opends.quicksetup.iswebstart";
/**
+ * Specific environment variable used by the scripts to find java.
+ */
+ public static final String OPENDS_JAVA_HOME = "OPENDS_JAVA_HOME";
+
+ /**
* Java property used to know which are the jar files that must be downloaded
* lazily. The current code in WebStartDownloader that uses this property
* assumes that the URL are separated with an space.
@@ -221,10 +226,10 @@
/**
* Write a set-java-home file appropriate for the underlying platform that may
- * be used to set the JAVA_HOME environment variable in a form suitable for
- * the underlying operating system. If a JAVA_HOME environment variable is
- * currently set, then its value will be used. Otherwise, it will be
- * dynamically determined from the JVM properties.
+ * be used to set the OPENDS_JAVA_HOME environment variable in a form suitable
+ * for the underlying operating system. If a OPENDS_JAVA_HOME environment
+ * variable is currently set, then its value will be used. Otherwise, it will
+ * be dynamically determined from the JVM properties.
* <BR><BR>
* Note that if the target file that would be written already exists, then
* this method will exit without doing anything and leaving the existing file
@@ -239,10 +244,10 @@
* @throws IOException If a problem occurs while creating or writing to the
* specified file.
*/
- public static File writeSetJavaHome(String serverRoot)
+ public static File writeSetOpenDSJavaHome(String serverRoot)
throws IOException
{
- String javaHome = System.getenv("JAVA_HOME");
+ String javaHome = System.getenv("OPENDS_JAVA_HOME");
if ((javaHome == null) || (javaHome.length() == 0))
{
javaHome = System.getProperty("java.home");
@@ -262,7 +267,7 @@
BufferedWriter writer =
new BufferedWriter(new FileWriter(setJavaHomeFile));
- writer.write("set JAVA_HOME=" + javaHome);
+ writer.write("set OPENDS_JAVA_HOME=" + javaHome);
writer.newLine();
writer.close();
}
@@ -279,9 +284,9 @@
writer.write("#!/bin/sh");
writer.newLine();
writer.newLine();
- writer.write("JAVA_HOME=" + javaHome);
+ writer.write("OPENDS_JAVA_HOME=" + javaHome);
writer.newLine();
- writer.write("export JAVA_HOME");
+ writer.write("export OPENDS_JAVA_HOME");
writer.newLine();
writer.close();
}
--
Gitblit v1.10.0