From 78a841f1f90440f259c0416e53b8873a4b97d17e Mon Sep 17 00:00:00 2001
From: kenneth_suter <kenneth_suter@localhost>
Date: Thu, 03 May 2007 16:58:05 +0000
Subject: [PATCH] This update to the script fixes a problem where the script would try to invoke the webstart version of the tool if there were any problems with the command line invocation (incorrect arguments etc). Now the webstart version will be launched only if there are no arguments passes to the tool. Otherwise the command line version is used.
---
opends/resource/upgrade | 50 ++++++++++++++----------
opends/resource/upgrade.bat | 16 +++++--
2 files changed, 40 insertions(+), 26 deletions(-)
diff --git a/opends/resource/upgrade b/opends/resource/upgrade
index 9448181..f3631e4 100644
--- a/opends/resource/upgrade
+++ b/opends/resource/upgrade
@@ -130,23 +130,35 @@
rm -fr "${INSTANCE_ROOT}/tmp/upgrade"
fi
-# Launch the build extractor.
-# Configure the appropriate CLASSPATH.
-# BuildExtractor uses the existing install's
-# jars
-CLASSPATH=${INSTANCE_ROOT}/classes
-for JAR in ${INSTANCE_ROOT}/lib/*.jar
-do
- CLASSPATH=${CLASSPATH}:${JAR}
-done
-export CLASSPATH
-"${JAVA_BIN}" org.opends.quicksetup.upgrader.BuildExtractor "${@}"
-
-if test ${?} -eq 0
+# Test for presence of command line arguments
+if test -z "$1"
then
+
+ # If no arguments launch web start version
+ JAVAWS_VM_ARGS="-Dorg.opends.quicksetup.upgrader.Root=$INSTANCE_ROOT"
+ export JAVAWS_VM_ARGS
+ if test -z "${OPENDS_UPGRADE_JNLP}"
+ then
+ OPENDS_UPGRADE_JNLP=http://builds.opends.org/install/QuickUpgrade.jnlp
+ fi
+ "${JAVAWS_BIN}" "${OPENDS_UPGRADE_JNLP}"
+
+else
+
+ # Launch the build extractor.
+ # Configure the appropriate CLASSPATH.
+ # BuildExtractor uses the existing install's
+ # jars
+ CLASSPATH=${INSTANCE_ROOT}/classes
+ for JAR in ${INSTANCE_ROOT}/lib/*.jar
+ do
+ CLASSPATH=${CLASSPATH}:${JAR}
+ done
+ export CLASSPATH
+ "${JAVA_BIN}" org.opends.quicksetup.upgrader.BuildExtractor "${@}"
+
if [ -r "${INSTANCE_ROOT}/tmp/upgrade" ]
then
-
# Configure the appropriate CLASSPATH.
# Unlike BuildExtractor, the Upgrader uses
# the newly extracted build's jars.
@@ -164,12 +176,8 @@
rm -fr "${INSTANCE_ROOT}/tmp/upgrade"
fi
else
- JAVAWS_VM_ARGS="-Dorg.opends.quicksetup.upgrader.Root=$INSTANCE_ROOT"
- export JAVAWS_VM_ARGS
- if test -z "${OPENDS_UPGRADE_JNLP}"
- then
- OPENDS_UPGRADE_JNLP=http://builds.opends.org/install/QuickUpgrade.jnlp
- fi
- "${JAVAWS_BIN}" "${OPENDS_UPGRADE_JNLP}"
+ # Build extractor didn't work. Invoke the upgrader
+ # to report errors and usage.
+ "${JAVA_BIN}" org.opends.quicksetup.upgrader.UpgradeLauncher "${@}"
fi
fi
diff --git a/opends/resource/upgrade.bat b/opends/resource/upgrade.bat
index d29353f..f4776f3 100644
--- a/opends/resource/upgrade.bat
+++ b/opends/resource/upgrade.bat
@@ -39,7 +39,7 @@
if "%JAVA_HOME%" == "" goto noJavaHome
if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHome
set JAVA_BIN=%JAVA_HOME%\bin\java.exe
-set jAVAWS_BIN=%JAVA_HOME%\bin\javaws.exe
+set JAVAWS_BIN=%JAVA_HOME%\bin\javaws.exe
if "%*" == "" goto callWebStartUpgrade
goto callExtractor
@@ -47,7 +47,7 @@
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
-set jAVAWS_BIN=%JAVA_HOME%\bin\javaws.exe
+set JAVAWS_BIN=%JAVA_HOME%\bin\javaws.exe
if "%*" == "" goto callWebStartUpgrade
goto callExtractor
@@ -75,8 +75,7 @@
set CLASSPATH=""
FOR %%x in ("%INSTANCE_ROOT%\lib\*.jar") DO call "%INSTANCE_ROOT%\lib\setcp.bat" %%x
"%JAVA_BIN%" org.opends.quicksetup.upgrader.BuildExtractor %*
-if %ERRORLEVEL%==0 goto callUpgrader
-goto end
+goto prepUpgrader
:callWebStartUpgrade
rem set JAVAWS_VM_ARGS=-Dorg.opends.quicksetup.upgrader.Root="%INSTANCE_ROOT%"
@@ -84,9 +83,16 @@
"%JAVAWS_BIN%" "%OPENDS_UPGRADE_JNLP%"
goto end
-:callUpgrader
+:prepUpgrader
+if EXIST %INSTANCE_ROOT%\tmp\upgrade goto setClassPathToStageDir
+goto callUpgrader
+
+:setClassPathToStageDir
set CLASSPATH=""
FOR %%x in ("%INSTANCE_ROOT%\tmp\upgrade\lib\*.jar") DO call "%INSTANCE_ROOT%\lib\setcp.bat" %%x
+goto callUpgrader
+
+:callUpgrader
"%JAVA_BIN%" org.opends.quicksetup.upgrader.UpgradeLauncher %*
if EXIST %INSTANCE_ROOT%\tmp\upgrade rd %INSTANCE_ROOT%\tmp\upgrade /s /q
goto end
--
Gitblit v1.10.0