コード例 #1
0
  /*
   * If the user is going to clear all partitions from all drives we need to ask
   * him if he's sure first.
   */
  protected boolean showDiskWarning(KickstartData data, DynaActionForm form) {
    Set<KickstartCommand> commands = data.getOptions();
    boolean containsClearpartCommand = false;
    for (KickstartCommand command : commands) {
      if (command.getCommandName() != null
          && command.getCommandName().getName() != null
          && command.getCommandName().getName().equals("clearpart")) {
        if (command.getArguments() != null && command.getArguments().contains("--drives")) {
          return false;
        }
        containsClearpartCommand = true;
        break;
      }
      continue;
    }

    String diskOption = form.getString(DESTROY_DISKS);
    if (!containsClearpartCommand || (diskOption != null && diskOption.equals("true"))) {
      return false;
    }
    return true;
  }