예제 #1
0
 /** Make scripts (ending with .sh) executable on *nix systems. */
 public static void setScriptsExecutable(File dir) {
   String os = System.getProperty("os.name");
   if (os != null && !os.startsWith("Windows")) {
     FileFilter filter = FileUtils.getSuffixFileFilter(".sh");
     setExecutable(dir, filter);
   }
 }
예제 #2
0
  /**
   * Unpacks the contents of the FEDORA_HOME directory from the Distribution.
   *
   * @throws InstallationFailedException
   */
  private void unpack() throws InstallationFailedException {
    System.out.println("Preparing FEDORA_HOME...");

    if (!_installDir.exists() && !_installDir.mkdirs()) {
      throw new InstallationFailedException(
          "Unable to create FEDORA_HOME: " + _installDir.getAbsolutePath());
    }
    if (!_installDir.isDirectory()) {
      throw new InstallationFailedException(_installDir.getAbsolutePath() + " is not a directory");
    }
    try {
      Zip.unzip(_dist.get(Distribution.FEDORA_HOME), _installDir);
      setScriptsExecutable(new File(_installDir, "client" + File.separator + "bin"));

      File serverDir = new File(_installDir, "server");
      if (_clientOnlyInstall) {
        FileUtils.delete(serverDir);
      } else {
        setScriptsExecutable(new File(serverDir, "bin"));
      }
    } catch (IOException e) {
      throw new InstallationFailedException(e.getMessage(), e);
    }
  }