From 8ee2559efd80ab966eef9cfcef0aeb98b9885fc2 Mon Sep 17 00:00:00 2001
From: Ludovic Poitou <ludovic.poitou@forgerock.com>
Date: Fri, 20 Nov 2015 16:54:45 +0000
Subject: [PATCH] OPENDJ-2431, OPENDJ-2442, OPENDJ-2448: Fix various license checking / approval with split install - instance. Now the license is read if present from the install (read-only) and the approval is written in the instance (and the directory created if needed). Note that upgrade will require to re-approve the license.

---
 opendj-server-legacy/resource/upgrade.bat |   21 +++++++++++++++++----
 1 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/opendj-server-legacy/resource/upgrade.bat b/opendj-server-legacy/resource/upgrade.bat
index 6d3ea48..4f8fc28 100644
--- a/opendj-server-legacy/resource/upgrade.bat
+++ b/opendj-server-legacy/resource/upgrade.bat
@@ -22,7 +22,7 @@
 rem CDDL HEADER END
 rem
 rem
-rem      Copyright 2013-2014 ForgeRock AS
+rem      Copyright 2013-2015 ForgeRock AS
 
 setlocal
 
@@ -30,16 +30,29 @@
 set SCRIPT_NAME=upgrade
 
 for %%i in (%~sf0) do set SCRIPT_DIR=%%~dPsi
-set DIR_CLASSES="%SCRIPT_DIR%classes"
+set INSTALL_ROOT=%DIR_HOME%
+set INSTANCE_DIR=
+if exist "%INSTALL_ROOT%\instance.loc" (
+  set /p INSTANCE_DIR=<%INSTALL_ROOT%\instance.loc
+) else (
+set INSTANCE_DIR=.
+)
+set CUR_DIR=%CD%
+cd /d %INSTALL_ROOT%
+cd /d %INSTANCE_DIR%
+set INSTANCE_ROOT=%CD%
+cd /d %CUR_DIR%
+
+set DIR_CLASSES="%INSTANCE_ROOT%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%" (
-  for /F %%i in ('dir /b %DIR_CLASSES%\*.*') do goto renamePatchesFolder 
+  for /F %%i in ('dir /b %DIR_CLASSES%\*.*') do goto renamePatchesFolder
 )
 goto end
 
 :renamePatchesFolder
-move /-Y "%DIR_CLASSES%" "%SCRIPT_DIR%classes.disabled" > nul
+move /-Y "%DIR_CLASSES%" "%INSTANCE_ROOT%classes.disabled" > nul
 mkdir %DIR_CLASSES%
 
 :end

--
Gitblit v1.10.0