From 6c06c2c0fd1bfb5c261b910ee8092037184e70a5 Mon Sep 17 00:00:00 2001
From: kenneth_suter <kenneth_suter@localhost>
Date: Fri, 31 Aug 2007 15:43:58 +0000
Subject: [PATCH] Exposes the reversion functionality of the upgrader (issue 2169).  Originally it was intended to be exposed as a new script but in order to avoid the negativity of having a command devoted to undoing the upgrade and to avoid more scripts in the top-level directory, I've exposed the functionality as 2 new options in the existing upgrade script.  I will update the Wiki with documentation for these new options soon.

---
 opendj-sdk/opends/resource/upgrade.bat |   17 +++++++++++++++--
 1 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/opendj-sdk/opends/resource/upgrade.bat b/opendj-sdk/opends/resource/upgrade.bat
index d5dd67a..2eec34b 100644
--- a/opendj-sdk/opends/resource/upgrade.bat
+++ b/opendj-sdk/opends/resource/upgrade.bat
@@ -70,9 +70,11 @@
 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 %*
+if %errorlevel% == 99 goto upgrader
+if %errorlevel% == 98 goto reverter
 if %errorlevel% == 50 goto version
-if not %errorlevel% == 0 goto end
-goto upgrader
+if %errorlevel% == 0 goto end
+goto error
 
 :upgrader
 set CLASSPATH=""
@@ -80,8 +82,19 @@
 "%JAVA_BIN%" org.opends.quicksetup.upgrader.UpgradeLauncher %*
 goto end
 
+:reverter
+if EXIST "%INSTANCE_ROOT%\tmp\revert" rd "%INSTANCE_ROOT%\tmp\revert" /s /q
+xcopy "%INSTANCE_ROOT%\lib\*.*" "%INSTANCE_ROOT%\tmp\revert" /E /D /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 %*
+goto end
+
 :version
 rem version information was requested. Return code should be 0.
 exit /B 0
 
+:error
+exit /B 101
+
 :end

--
Gitblit v1.10.0