Package br.com.objectos.rio.eto.os

Source Code of br.com.objectos.rio.eto.os.EtoOsInstallOptions

/*
* Copyright 2014 Objectos, Fábrica de Software LTDA.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package br.com.objectos.rio.eto.os;

import static br.com.objectos.rio.RioVersion.VERSION;

import java.io.File;

import br.com.objectos.rio.HttpServer;
import br.com.objectos.rio.OsDirs;
import br.com.objectos.rio.eto.EtoDirs;
import br.com.objectos.way.base.io.Directory;

import com.beust.jcommander.Parameter;
import com.beust.jcommander.Parameters;

/**
* @author marcio.endo@objectos.com.br (Marcio Endo)
*/
@Parameters
class EtoOsInstallOptions {

  @Parameter(names = { "--version" })
  String version = VERSION.get();

  @Parameter(names = { "--device", "-d" })
  String device = "/dev/sdb";

  @Parameter(names = "--hd")
  String hd = "WDC_WD5000AAKX";

  @Parameter(names = { "--download", "-dl" })
  boolean download = false;

  @Parameter(names = { "--skip-download", "-no-dl" })
  boolean skipDownload = false;

  @Parameter(names = { "--partition", "-p" })
  boolean partition = false;

  @Parameter(names = { "--unpack", "-u" })
  boolean unpack = false;

  @Parameter(names = { "--grub", "-g" })
  boolean grub = false;

  @Parameter(names = { "--server" })
  String server = "rio.objectos.com.br";

  public HttpServer fileServer() {
    String base = String.format("%s/%s/os/%s", server, getCode(), version);
    return HttpServer.at(base);
  }

  public String getStage3Name() {
    return String.format("%s-%s.tar.gz", getCode(), version);
  }

  public File getStage3File(OsDirs dirs) {
    Directory osVar = dirs.osVar();
    return osVar.fileAt(getStage3Name());
  }

  public String sfdiskName() {
    return String.format("disk/%s.sfdisk", hd);
  }

  public String dev(int i) {
    return device + i;
  }

  public OsDirs dirs(EtoDirs xtoDirs) {
    Directory var = xtoDirs.var(getCode());
    return new OsDirs(var);
  }

  public String resourcesDir() {
    return String.format("/%s/os", getCode());
  }

  private String getCode() {
    return "eto";
  }

}
TOP

Related Classes of br.com.objectos.rio.eto.os.EtoOsInstallOptions

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.