All Downloads are FREE. Search and download functionalities are using the official Maven repository.

sao.os.SaoOsPrepareOptions Maven / Gradle / Ivy

The newest version!
/*
 * 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.sao.os;

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

import br.com.objectos.rio.HttpServer;
import br.com.objectos.rio.OsDirs;
import br.com.objectos.rio.sao.SaoDirs;

import br.com.objectos.way.core.io.Directory;

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

/**
 * @author [email protected] (Marcio Endo)
 */
@Parameters
class SaoOsPrepareOptions {

  String version = VERSION.get();

  @Parameter(names = { "--stage", "-s" })
  boolean stage = false;

  @Parameter(names = { "--objectos", "-o" })
  boolean objectos = false;

  @Parameter(names = { "--ekernel", "-k" })
  boolean ekernel = false;

  @Parameter(names = { "--realtek" })
  boolean realtek = false;

  @Parameter(names = { "--eworld", "-w" })
  boolean eworld = false;

  @Parameter(names = { "--usepkg" })
  boolean usepkg = false;

  @Parameter(names = { "--revdep" })
  boolean revdep = false;

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

  @Parameter(names = { "--rio", "-r" })
  boolean rio = false;

  @Parameter(names = { "--extras", "-x" })
  boolean extras = 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 HttpServer distfilesServer() {
    String base = String.format("%s/gentoo/distfiles", server);
    return HttpServer.at(base);
  }

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

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

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

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

  public String user() {
    return getCode();
  }

  public String sshKeyScriptName() {
    return String.format("/etc/local.d/00-%s-ssh-key.start", getCode());
  }

  public OsDirs dirs(SaoDirs saoDirs) {
    Directory var = saoDirs.var();
    return new OsDirs(var);
  }

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

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy