From 3bc62c78aa5b827a0dce7121b7596c385a4d7563 Mon Sep 17 00:00:00 2001
From: lutoff <lutoff@localhost>
Date: Tue, 30 Sep 2008 08:35:56 +0000
Subject: [PATCH] fix for issue #3501 (direct Upgrade from OpenDS 1.0 to OpenDS-1.1.0-build001 fails)

---
 opends/src/quicksetup/org/opends/quicksetup/upgrader/Upgrader.java |   21 ++++++++++++++++++++-
 1 files changed, 20 insertions(+), 1 deletions(-)

diff --git a/opends/src/quicksetup/org/opends/quicksetup/upgrader/Upgrader.java b/opends/src/quicksetup/org/opends/quicksetup/upgrader/Upgrader.java
index 71f2519..f3c4bbd 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/upgrader/Upgrader.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/upgrader/Upgrader.java
@@ -357,7 +357,26 @@
     // in the staging directory.  However
     // we still want the Installation to point at the build being
     // upgraded so the install path reported in [installroot].
-    return System.getProperty("INSTALL_ROOT");
+    String installationPath =  System.getProperty("INSTALL_ROOT");
+    if (installationPath == null)
+    {
+      String path = Utils.getInstallPathFromClasspath();
+      if (path != null)
+      {
+        File f = new File(path);
+        if (f.getParentFile() != null
+            && f.getParentFile().getParentFile() != null
+            && new File(f.getParentFile().getParentFile(),
+                Installation.LOCKS_PATH_RELATIVE).exists())
+        {
+          installationPath = Utils.getPath(f.getParentFile().getParentFile());
+        } else
+        {
+          installationPath = path;
+        }
+      }
+    }
+    return installationPath;
   }
 
   /**

--
Gitblit v1.10.0