From 4631ff335aac195f694131e5882a640975bacadc Mon Sep 17 00:00:00 2001
From: lutoff <lutoff@localhost>
Date: Wed, 29 Apr 2009 07:38:46 +0000
Subject: [PATCH] Fix for issue #3944 : upgrade tool should support the click-through license Fix for issue #3945 : Need to way to determine if a license had already been accepted
---
opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/upgrader/Upgrader.java | 62 +++++++++++++++++++++++++++++++
1 files changed, 62 insertions(+), 0 deletions(-)
diff --git a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/upgrader/Upgrader.java b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/upgrader/Upgrader.java
index dfa5665..9464040 100644
--- a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/upgrader/Upgrader.java
+++ b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/upgrader/Upgrader.java
@@ -28,6 +28,8 @@
package org.opends.quicksetup.upgrader;
import org.opends.quicksetup.CliApplication;
+
+import org.opends.quicksetup.LicenseFile;
import static org.opends.quicksetup.Installation.*;
import static org.opends.messages.QuickSetupMessages.*;
@@ -72,12 +74,14 @@
import org.opends.server.tools.JavaPropertiesTool;
import java.awt.event.WindowEvent;
+import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileFilter;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
+import java.io.InputStreamReader;
import java.net.InetSocketAddress;
import java.net.MalformedURLException;
import java.net.Proxy;
@@ -814,6 +818,64 @@
checkAbort();
+ // Check license
+ if (!LicenseFile.isAlreadyApproved())
+ {
+ String installRootFromSystem = System.getProperty("INSTALL_ROOT");
+ System.setProperty("INSTALL_ROOT", installRootFromSystem
+ + File.separator + "tmp" + File.separator + "upgrade");
+ if (LicenseFile.exists())
+ {
+ String licenseString = LicenseFile.getText();
+ System.out.println(licenseString);
+ if (getUserData().isInteractive())
+ {
+ // If the user asks for no-prompt. We just display the license text.
+ // User doesn't asks for no-prompt. We just display the license text
+ // and force to accept it.
+ String yes = INFO_LICENSE_CLI_ACCEPT_YES.get().toString();
+ String no = INFO_LICENSE_CLI_ACCEPT_NO.get().toString();
+ System.out.println(INFO_LICENSE_DETAILS_LABEL.get().toString());
+
+ BufferedReader in = new BufferedReader(new InputStreamReader(
+ System.in));
+ while (true)
+ {
+ System.out.print(INFO_LICENSE_CLI_ACCEPT_QUESTION
+ .get(yes, no, no).toString());
+ try
+ {
+ String response = in.readLine();
+ if ((response == null)
+ || (response.toLowerCase().equals(no.toLowerCase()))
+ || (response.length() == 0))
+ {
+ System.exit(ReturnCode.CANCELLED.getReturnCode());
+ }
+ else if (response.toLowerCase().equals(yes.toLowerCase()))
+ {
+ // create the file
+ LicenseFile.setApproval(true);
+ LicenseFile.createFileLicenseApproved();
+ break;
+ }
+ else
+ {
+ System.out.println(INFO_LICENSE_CLI_ACCEPT_INVALID_RESPONSE
+ .get().toString());
+ }
+ }
+ catch (IOException e)
+ {
+ System.out.println(INFO_LICENSE_CLI_ACCEPT_INVALID_RESPONSE
+ .get().toString());
+ }
+ }
+ }
+ }
+ System.setProperty("INSTALL_ROOT", installRootFromSystem);
+ }
+
if (!Utils.isWebStart())
{
// The command-line upgrade has not the option of leaving the server
--
Gitblit v1.10.0