From 9f55c3f076ecaf3aaad201c96446cff0169c243e Mon Sep 17 00:00:00 2001
From: Violette Roche-Montane <violette.roche-montane@forgerock.com>
Date: Wed, 05 Mar 2014 16:29:48 +0000
Subject: [PATCH] Backport fix for OPENDJ-1098 Upgrading must disable old patches II

---
 opends/resource/upgrade     |    6 +++---
 opends/resource/upgrade.bat |    5 +++--
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/opends/resource/upgrade b/opends/resource/upgrade
index b8f9040..3b582e7 100644
--- a/opends/resource/upgrade
+++ b/opends/resource/upgrade
@@ -32,13 +32,13 @@
 SCRIPT_NAME="upgrade"
 export SCRIPT_NAME
 
-DIR_CLASSES="./classes"
+SCRIPT_DIR=`dirname "${0}"`
+DIR_CLASSES="${SCRIPT_DIR}/classes"
 # The upgrade is not compatible with patches. If the folder is not empty
 # we renamed it as "classes.disabled", and the upgrade process should be launched properly.
 if [ "`(ls -A ${DIR_CLASSES})`" ]; then
-    mv -f ${DIR_CLASSES} "./classes.disabled"
+    mv -f ${DIR_CLASSES} "${SCRIPT_DIR}/classes.disabled"
     mkdir ${DIR_CLASSES}
 fi
 
-SCRIPT_DIR=`dirname "${0}"`
 "${SCRIPT_DIR}/lib/_server-script.sh" "${@}"
diff --git a/opends/resource/upgrade.bat b/opends/resource/upgrade.bat
index 72e019d..6d3ea48 100644
--- a/opends/resource/upgrade.bat
+++ b/opends/resource/upgrade.bat
@@ -29,7 +29,8 @@
 set OPENDJ_INVOKE_CLASS="org.opends.server.tools.upgrade.UpgradeCli"
 set SCRIPT_NAME=upgrade
 
-set DIR_CLASSES="classes"
+for %%i in (%~sf0) do set SCRIPT_DIR=%%~dPsi
+set DIR_CLASSES="%SCRIPT_DIR%classes"
 rem The upgrade is not compatible with patches. If the folder is not empty
 rem we renamed it as "classes.disabled", and the upgrade process should be launched properly.
 IF EXIST "%DIR_CLASSES%" (
@@ -38,7 +39,7 @@
 goto end
 
 :renamePatchesFolder
-rename %DIR_CLASSES% "classes.disabled"
+move /-Y "%DIR_CLASSES%" "%SCRIPT_DIR%classes.disabled" > nul
 mkdir %DIR_CLASSES%
 
 :end

--
Gitblit v1.10.0