Package br.com.objectos.rio.sao.os

Source Code of br.com.objectos.rio.sao.os.SaoOsInstall

/*
* 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 br.com.objectos.rio.AbstractRioCommand;
import br.com.objectos.rio.Gentoo;
import br.com.objectos.rio.GentooInstall;
import br.com.objectos.rio.OsDirs;
import br.com.objectos.rio.sao.SaoDirs;

import com.google.inject.Inject;

/**
* @author marcio.endo@objectos.com.br (Marcio Endo)
*/
class SaoOsInstall extends AbstractRioCommand<SaoOsInstallOptions> implements SaoOsInstallCommand {

  private final Gentoo gentoo;

  private final SaoDirs saoDirs;

  @Inject
  public SaoOsInstall(Gentoo gentoo, SaoDirs saoDirs) {
    this.gentoo = gentoo;
    this.saoDirs = saoDirs;
  }

  @Override
  protected String getCommandName() {
    return "eto os install";
  }

  @Override
  protected SaoOsInstallOptions newOptions() {
    return new SaoOsInstallOptions();
  }

  @Override
  protected void executeCommand(SaoOsInstallOptions options) {
    OsDirs dirs = options.dirs(saoDirs);

    GentooInstall install = gentoo.install(this)
        .tempDirAt(dirs.osVar())
        .mountDirAt(dirs.installMountDir())
        .resourcesAt(options.resourcesDir())

        .serverAt(options.fileServer())
        .stage3(options.getStage3Name())

        .toDevice(options.device)
        .model(options.hd)
        .sfdisk(options.sfdiskName())

        .fs()
        /**/.dev(1).ext2()
        /**/.dev(2).swap()
        /**/.dev(3).ext4()
        /**/.dev(4).ext4()
        .done()

        .mount()
        /**/.dev(3).at()
        /**/.dev(1).at("boot")
        /**/.dev(4).at("srv")
        .done()

        .build();

    if (options.download && !options.skipDownload) {
      install.dowload();
    }

    if (options.partition) {
      install.partition();
    }

    if (options.unpack) {
      install.unpack();
    }

    if (options.grub) {
      install.grub();
    }
  }

}
TOP

Related Classes of br.com.objectos.rio.sao.os.SaoOsInstall

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.