From 7926b4fde36b76848d123186eeea60a075984c44 Mon Sep 17 00:00:00 2001
From: neil_a_wilson <neil_a_wilson@localhost>
Date: Mon, 11 Dec 2006 03:15:28 +0000
Subject: [PATCH] Update the Java Web Start, GUI, and CLI setup modes to write a shell script or batch file that can be used to set JAVA_HOME. Update all of the tools and administrative scripts provided with OpenDS so that they will use this to set JAVA_HOME unless it's already set in the user's environment.
---
opends/src/server/org/opends/server/tools/InstallDS.java | 32 +++++++++++++++++++++-----------
1 files changed, 21 insertions(+), 11 deletions(-)
diff --git a/opends/src/server/org/opends/server/tools/InstallDS.java b/opends/src/server/org/opends/server/tools/InstallDS.java
index 9358d71..a61fdab 100644
--- a/opends/src/server/org/opends/server/tools/InstallDS.java
+++ b/opends/src/server/org/opends/server/tools/InstallDS.java
@@ -41,7 +41,7 @@
import org.opends.server.types.DN;
import org.opends.server.types.ExistingFileBehavior;
import org.opends.server.types.LDIFExportConfig;
-import org.opends.server.util.CreateTemplate;
+import org.opends.server.util.SetupUtils;
import org.opends.server.util.LDIFWriter;
import org.opends.server.util.PasswordReader;
import org.opends.server.util.args.ArgumentException;
@@ -81,7 +81,7 @@
/**
* Indicates whether we think we're running on a Windows system.
*/
- private static boolean isWindows = false;
+ private static final boolean isWindows = SetupUtils.isWindows();
@@ -156,14 +156,6 @@
*/
public static int installMain(String[] args)
{
- // Determine whether we think we're running on Windows.
- String osName = System.getProperty("os.name");
- if ((osName != null) && (osName.toLowerCase().indexOf("windows") >= 0))
- {
- isWindows = true;
- }
-
-
// Construct the product version string and the setup filename.
versionString = DirectoryServer.getVersionString();
@@ -784,7 +776,7 @@
{
try
{
- File templateFile = CreateTemplate.createTemplateFile(
+ File templateFile = SetupUtils.createTemplateFile(
baseDNs.getFirst().toString(), numUsers);
if (ldifFiles == null)
{
@@ -861,6 +853,24 @@
}
+ // Try to write a file that can be used to set the JAVA_HOME environment
+ // variable for the administrative scripts and client tools provided with
+ // the server. If this fails, then it's not a big deal.
+ try
+ {
+ String serverRoot = System.getenv("INSTANCE_ROOT");
+ if ((serverRoot == null) || (serverRoot.length() == 0))
+ {
+ File f = new File(configFileName);
+ serverRoot = f.getParentFile().getParentFile().getAbsolutePath();
+ }
+
+ // This isn't likely to happen, and it's not a serious problem even if it
+ // does.
+ SetupUtils.writeSetJavaHome(serverRoot);
+ } catch (Exception e) {}
+
+
// If we've gotten here, then everything seems to have gone smoothly.
if (! silentInstall.isPresent())
{
--
Gitblit v1.10.0