| | |
| | | import static org.forgerock.util.Utils.*; |
| | | import static org.opends.messages.QuickSetupMessages.*; |
| | | import static org.opends.server.util.DynamicConstants.*; |
| | | import static com.forgerock.opendj.util.OperatingSystem.isWindows; |
| | | import static com.forgerock.opendj.util.OperatingSystem.isUnix; |
| | | |
| | | import java.io.*; |
| | | import java.net.InetAddress; |
| | |
| | | String script; |
| | | String libPath = Utils.getPath(installPath, |
| | | Installation.LIBRARIES_PATH_RELATIVE); |
| | | if (Utils.isWindows()) |
| | | if (isWindows()) |
| | | { |
| | | script = Utils.getScriptPath(Utils.getPath(libPath, |
| | | Installation.SCRIPT_UTIL_FILE_WINDOWS)); |
| | |
| | | env.remove("OPENDJ_JAVA_BIN"); |
| | | // In windows by default the scripts ask the user to click on enter when |
| | | // they fail. Set this environment variable to avoid it. |
| | | if (Utils.isWindows()) |
| | | if (isWindows()) |
| | | { |
| | | env.put("DO_NOT_PAUSE", "true"); |
| | | } |
| | |
| | | logger.info(LocalizableMessage.raw("The output: "+line)); |
| | | if (line.contains("ERROR: The detected Java version")) |
| | | { |
| | | if (Utils.isWindows()) |
| | | if (isWindows()) |
| | | { |
| | | // If we are running windows, the process get blocked waiting for |
| | | // user input. Just wait for a certain time to print the output |
| | |
| | | } |
| | | |
| | | /** |
| | | * Returns <CODE>true</CODE> if we are running under windows and |
| | | * <CODE>false</CODE> otherwise. |
| | | * @return <CODE>true</CODE> if we are running under windows and |
| | | * <CODE>false</CODE> otherwise. |
| | | */ |
| | | public static boolean isWindows() |
| | | { |
| | | return SetupUtils.isWindows(); |
| | | } |
| | | |
| | | /** |
| | | * Returns <CODE>true</CODE> if we are running under Mac OS and |
| | | * <CODE>false</CODE> otherwise. |
| | | * @return <CODE>true</CODE> if we are running under Mac OS and |
| | | * <CODE>false</CODE> otherwise. |
| | | */ |
| | | public static boolean isMacOS() |
| | | { |
| | | return SetupUtils.isMacOS(); |
| | | } |
| | | |
| | | /** |
| | | * Returns <CODE>true</CODE> if we are running under Unix and |
| | | * <CODE>false</CODE> otherwise. |
| | | * @return <CODE>true</CODE> if we are running under Unix and |
| | | * <CODE>false</CODE> otherwise. |
| | | */ |
| | | public static boolean isUnix() |
| | | { |
| | | return SetupUtils.isUnix(); |
| | | } |
| | | |
| | | /** |
| | | * Returns a String representation of the OS we are running. |
| | | * @return a String representation of the OS we are running. |
| | | */ |
| | | public static String getOSString() |
| | | { |
| | | return SetupUtils.getOSString(); |
| | | } |
| | | |
| | | /** |
| | | * Returns <CODE>true</CODE> if the parent directory for the provided path |
| | | * exists and <CODE>false</CODE> otherwise. |
| | | * @param path the path that we are analyzing. |
| | |
| | | catch (Throwable t) |
| | | { |
| | | String setupFile; |
| | | if (Utils.isWindows()) |
| | | if (isWindows()) |
| | | { |
| | | setupFile = Installation.WINDOWS_SETUP_FILE_NAME; |
| | | } |
| | |
| | | int initialIndex = 1; |
| | | StringBuilder sbSeparator = new StringBuilder(); |
| | | sbSeparator.append(formatter.getSpace()); |
| | | if (!Utils.isWindows()) |
| | | if (!isWindows()) |
| | | { |
| | | sbSeparator.append("\\"); |
| | | sbSeparator.append(formatter.getLineBreak()); |
| | |
| | | public static String escapeCommandLineValue(String value) |
| | | { |
| | | StringBuilder b = new StringBuilder(); |
| | | if (Utils.isUnix()) |
| | | if (isUnix()) |
| | | { |
| | | for (int i=0 ; i<value.length(); i++) |
| | | { |
| | |
| | | { |
| | | ArrayList<String> cmdLine = new ArrayList<String>(); |
| | | String setupFile; |
| | | if (Utils.isWindows()) |
| | | if (isWindows()) |
| | | { |
| | | setupFile = Installation.WINDOWS_SETUP_FILE_NAME; |
| | | } |
| | |
| | | cmdLine.add("--rootUserPassword"); |
| | | cmdLine.add(OBFUSCATED_VALUE); |
| | | |
| | | if (Utils.isWindows() && userData.getEnableWindowsService()) |
| | | if (isWindows() && userData.getEnableWindowsService()) |
| | | { |
| | | cmdLine.add("--enableWindowsService"); |
| | | } |