mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

jvergara
16.44.2007 f2fe5c04dd8722297ec97b2737ec8812ffd5ad73
Fix for issue 1252 (restrict installed bin files to relevant platform).

Create a new bat directory where we will place the batch files. Temporarily keep a copy of the batch files under the bin directory and add a README_WINDOWS.txt file under bin directory explaining that the files have been moved.
1 files added
10 files modified
153 ■■■■ changed files
opends/build.xml 9 ●●●●● patch | view | raw | blame | history
opends/resource/bin/README_WINDOWS.txt 30 ●●●●● patch | view | raw | blame | history
opends/resource/bin/_client-script.bat 6 ●●●● patch | view | raw | blame | history
opends/resource/bin/_server-script.bat 6 ●●●● patch | view | raw | blame | history
opends/resource/bin/start-ds.bat 6 ●●●● patch | view | raw | blame | history
opends/resource/bin/statuspanel.bat 6 ●●●● patch | view | raw | blame | history
opends/resource/bin/stop-ds.bat 8 ●●●● patch | view | raw | blame | history
opends/resource/setup.bat 6 ●●●● patch | view | raw | blame | history
opends/resource/uninstall.bat 6 ●●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/installer/webstart/WebStartInstaller.java 11 ●●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/util/Utils.java 59 ●●●● patch | view | raw | blame | history
opends/build.xml
@@ -605,7 +605,8 @@
    <mkdir dir="${pdir}"                 />
    <mkdir dir="${pdir}/bak"             />
    <mkdir dir="${pdir}/bin"             />
    <mkdir dir="${pdir}/bat"             />
    <mkdir dir="${pdir}/bin"             />
    <mkdir dir="${pdir}/classes"         />
    <mkdir dir="${pdir}/config"          />
    <mkdir dir="${pdir}/config/upgrade"  />
@@ -639,9 +640,11 @@
    <fixcrlf srcDir="${scripts.dir}" destDir="${pdir}/bin" excludes="*.bat"
         eol="lf" />
    <fixcrlf srcDir="${scripts.dir}" destDir="${pdir}/bin" includes="*.bat"
    <fixcrlf srcDir="${scripts.dir}" destDir="${pdir}/bin" includes="*.bat,README_WINDOWS.txt"
         eol="crlf" />
    <fixcrlf srcDir="${scripts.dir}" destDir="${pdir}/bat" includes="*.bat"
         eol="crlf" />
    <copy todir="${pdir}/config">
      <fileset file="${config.dir}/*" />
    </copy>
opends/resource/bin/README_WINDOWS.txt
New file
@@ -0,0 +1,30 @@
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
 * add the following below this CDDL HEADER, with the fields enclosed
 * by brackets "[]" replaced with your own identifying information:
 *      Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2007 Sun Microsystems, Inc.
 */
Note that all the batch files under the 'bin' directory have been moved to the
'bat' directory.  For the moment a copy of the batch files is still included
under 'bin' directory.  However these files will be removed in next builds and
so only a copy of the batch files will be provided under the 'bat' directory.
opends/resource/bin/_client-script.bat
@@ -51,8 +51,8 @@
goto setClassPath
:noJavaHome
if not exist "%DIR_HOME%\bin\set-java-home.bat" goto noSetJavaHome
call "%DIR_HOME%\bin\set-java-home.bat"
if not exist "%DIR_HOME%\bat\set-java-home.bat" goto noSetJavaHome
call "%DIR_HOME%\bat\set-java-home.bat"
set JAVA_BIN=%JAVA_HOME%\bin\java.exe
goto setClassPath
@@ -63,7 +63,7 @@
:setClassPath
FOR %%x in ("%DIR_HOME%\lib\*.jar") DO call "%DIR_HOME%\bin\setcp.bat" %%x
FOR %%x in ("%DIR_HOME%\lib\*.jar") DO call "%DIR_HOME%\bat\setcp.bat" %%x
set PATH=%SystemRoot%
opends/resource/bin/_server-script.bat
@@ -51,8 +51,8 @@
goto setClassPath
:noJavaHome
if not exist "%DIR_HOME%\bin\set-java-home.bat" goto noSetJavaHome
call "%DIR_HOME%\bin\set-java-home.bat"
if not exist "%DIR_HOME%\bat\set-java-home.bat" goto noSetJavaHome
call "%DIR_HOME%\bat\set-java-home.bat"
set JAVA_BIN=%JAVA_HOME%\bin\java.exe
goto setClassPath
@@ -62,7 +62,7 @@
goto end
:setClassPath
FOR %%x in ("%DIR_HOME%\lib\*.jar") DO call "%DIR_HOME%\bin\setcp.bat" %%x
FOR %%x in ("%DIR_HOME%\lib\*.jar") DO call "%DIR_HOME%\bat\setcp.bat" %%x
set PATH=%SystemRoot%
opends/resource/bin/start-ds.bat
@@ -41,8 +41,8 @@
goto setClassPath
:noJavaHome
if not exist "%DIR_HOME%\bin\set-java-home.bat" goto noSetJavaHome
call "%DIR_HOME%\bin\set-java-home.bat"
if not exist "%DIR_HOME%\bat\set-java-home.bat" goto noSetJavaHome
call "%DIR_HOME%\bat\set-java-home.bat"
set JAVA_BIN=%JAVA_HOME%\bin\java.exe
goto setClassPath
@@ -52,7 +52,7 @@
goto end
:setClassPath
FOR %%x in ("%DIR_HOME%\lib\*.jar") DO call "%DIR_HOME%\bin\setcp.bat" %%x
FOR %%x in ("%DIR_HOME%\lib\*.jar") DO call "%DIR_HOME%\bat\setcp.bat" %%x
set PATH=%SystemRoot%
opends/resource/bin/statuspanel.bat
@@ -41,8 +41,8 @@
goto setClassPath
:noJavaHome
if not exist "%DIR_HOME%\bin\set-java-home.bat" goto noSetJavaHome
call "%DIR_HOME%\bin\set-java-home.bat"
if not exist "%DIR_HOME%\bat\set-java-home.bat" goto noSetJavaHome
call "%DIR_HOME%\bat\set-java-home.bat"
set JAVA_BIN=%JAVA_HOME%\bin\java.exe
goto setClassPath
@@ -52,7 +52,7 @@
goto end
:setClassPath
FOR %%x in ("%DIR_HOME%\lib\*.jar") DO call "%DIR_HOME%\bin\setcp.bat" %%x
FOR %%x in ("%DIR_HOME%\lib\*.jar") DO call "%DIR_HOME%\bat\setcp.bat" %%x
set PATH=%SystemRoot%
opends/resource/bin/stop-ds.bat
@@ -44,8 +44,8 @@
goto setClassPath
:noJavaHome
if not exist "%DIR_HOME%\bin\set-java-home.bat" goto noSetJavaHome
call "%DIR_HOME%\bin\set-java-home.bat"
if not exist "%DIR_HOME%\bat\set-java-home.bat" goto noSetJavaHome
call "%DIR_HOME%\bat\set-java-home.bat"
set JAVA_BIN=%JAVA_HOME%\bin\java.exe
goto setClassPath
@@ -55,7 +55,7 @@
goto end
:setClassPath
FOR %%x in ("%DIR_HOME%\lib\*.jar") DO call "%DIR_HOME%\bin\setcp.bat" %%x
FOR %%x in ("%DIR_HOME%\lib\*.jar") DO call "%DIR_HOME%\bat\setcp.bat" %%x
"%JAVA_BIN%" -Xms8M -Xmx8M %SCRIPT_NAME_ARG%  org.opends.server.tools.StopDS --checkStoppability %*
@@ -74,7 +74,7 @@
goto end
:startUsingSystemCall
"%DIR_HOME%\bin\start-ds.bat"
"%DIR_HOME%\bat\start-ds.bat"
goto end
:stopUsingSystemCall
opends/resource/setup.bat
@@ -41,8 +41,8 @@
goto setClassPath
:noJavaHome
if not exist "%DIR_HOME%\bin\set-java-home.bat" goto noSetJavaHome
call "%DIR_HOME%\bin\set-java-home.bat"
if not exist "%DIR_HOME%\bat\set-java-home.bat" goto noSetJavaHome
call "%DIR_HOME%\bat\set-java-home.bat"
set JAVA_BIN=%JAVA_HOME%\bin\java.exe
goto setClassPath
@@ -53,7 +53,7 @@
:setClassPath
FOR %%x in ("%DIR_HOME%\lib\*.jar") DO call "%DIR_HOME%\bin\setcp.bat" %%x
FOR %%x in ("%DIR_HOME%\lib\*.jar") DO call "%DIR_HOME%\bat\setcp.bat" %%x
set PATH=%SystemRoot%
opends/resource/uninstall.bat
@@ -41,8 +41,8 @@
goto setClassPath
:noJavaHome
if not exist "%DIR_HOME%\bin\set-java-home.bat" goto noSetJavaHome
call "%DIR_HOME%\bin\set-java-home.bat"
if not exist "%DIR_HOME%\bat\set-java-home.bat" goto noSetJavaHome
call "%DIR_HOME%\bat\set-java-home.bat"
set JAVA_BIN=%JAVA_HOME%\bin\java.exe
goto setClassPath
@@ -52,7 +52,7 @@
goto end
:setClassPath
FOR %%x in ("%DIR_HOME%\lib\*.jar") DO call "%DIR_HOME%\bin\setcp.bat" %%x
FOR %%x in ("%DIR_HOME%\lib\*.jar") DO call "%DIR_HOME%\bat\setcp.bat" %%x
set PATH=%SystemRoot%
opends/src/quicksetup/org/opends/quicksetup/installer/webstart/WebStartInstaller.java
@@ -626,16 +626,21 @@
    String perm;
    File file = new File(path);
    if (file.getParent().endsWith(File.separator + "bin"))
    if (file.getParent().endsWith(
        File.separator + Utils.getWindowsBinariesRelativePath()) ||
        file.getParent().endsWith(
        File.separator + Utils.getUNIXBinariesRelativePath()))
    {
      if (path.endsWith(".bat"))
      {
        perm = "644";
      } else
      }
      else
      {
        perm = "755";
      }
    } else if (path.endsWith(".sh"))
    }
    else if (path.endsWith(".sh"))
    {
      perm = "755";
    } else if (path.endsWith(Utils.getUnixSetupFileName()) ||
opends/src/quicksetup/org/opends/quicksetup/util/Utils.java
@@ -73,10 +73,16 @@
  private static final String[] OPEN_DS_JAR_RELATIVE_PATHS =
    { "lib/quicksetup.jar", "lib/OpenDS.jar", "lib/je.jar" };
  /**
   * The relative path where all the binaries (scripts) are.
   * The relative path where all the Windows binaries (batch files) are.
   */
  private static final String BINARIES_PATH_RELATIVE = "bin";
  private static final String WINDOWS_BINARIES_PATH_RELATIVE = "bat";
  /**
   * The relative path where all the UNIX binaries (scripts) are.
   */
  private static final String UNIX_BINARIES_PATH_RELATIVE = "bin";
  /**
   * The relative path where all the libraries (jar files) are.
@@ -964,7 +970,7 @@
      }
    }
    File f = new File(path).getAbsoluteFile();
    File binariesDir = f.getParentFile();
    File librariesDir = f.getParentFile();
    /*
     * Do a best effort to avoid having a relative representation (for
@@ -972,12 +978,12 @@
     */
    try
    {
      installPath = binariesDir.getParentFile().getCanonicalPath();
      installPath = librariesDir.getParentFile().getCanonicalPath();
    }
    catch (IOException ioe)
    {
      // Best effort
      installPath = binariesDir.getParent();
      installPath = librariesDir.getParent();
    }
    return installPath;
  }
@@ -1005,14 +1011,47 @@
  /**
   * Returns the relative path of the directory containing the binaries of the
   * Open DS installation.  The path is relative to the installation path.
   * @return the relative path of the directory containing the binaries of the
   * Open DS installation.
   * Returns the relative path of the directory containing the Windows binaries
   * of the Open DS installation.  The path is relative to the installation
   * path.
   * @return the relative path of the directory containing the Windows binaries
   * of the Open DS installation.
   */
  public static String getWindowsBinariesRelativePath()
  {
    return WINDOWS_BINARIES_PATH_RELATIVE;
  }
  /**
   * Returns the relative path of the directory containing the binaries/scripts
   * of the Open DS installation.  The path is relative to the installation
   * path.
   * @return the relative path of the directory containing the binaries/scripts
   * of the Open DS installation.
   */
  public static String getBinariesRelativePath()
  {
    return BINARIES_PATH_RELATIVE;
    String binPath;
    if (isWindows())
    {
      binPath = getWindowsBinariesRelativePath();
    }
    else
    {
      binPath = getUNIXBinariesRelativePath();
    }
    return binPath;
  }
  /**
   * Returns the relative path of the directory containing the UNIX binaries of
   * the Open DS installation.  The path is relative to the installation path.
   * @return the relative path of the directory containing the UNIX binaries of
   * the Open DS installation.
   */
  public static String getUNIXBinariesRelativePath()
  {
    return UNIX_BINARIES_PATH_RELATIVE;
  }
  /**