/*
* 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;
import java.util.List;
import br.com.objectos.way.base.io.Directory;
/**
* @author marcio.endo@objectos.com.br (Marcio Endo)
*/
class GentooPrepareCommandObjectos extends AbstractGentooPrepareCommand {
public GentooPrepareCommandObjectos(GentooPrepare installer) {
super(installer);
}
@Override
void execute() {
String resourcesAt = pojo.getResourcesAt();
String resourcesList = pojo.getResourcesList();
String resourcesMap = pojo.getResourcesMap();
Object resourceContext = pojo.getResourceContext();
Directory mountDir = pojo.getMountDir();
List<GentooFetch> fetchList = pojo.getFetchList();
infoAction("objectos");
info("Applying objectos configuration.");
resourcesAt(resourcesAt)
.addFromListAt(resourcesList)
.mapFromListAt(resourcesMap)
.evalWith(resourceContext)
.only("/etc/portage/make.conf")
.copyTo(mountDir);
for (GentooFetch fetch : fetchList) {
HttpServer distfilesServer = pojo.getDistfilesServer();
distfilesServer.download(fetch.toString())
.toDir(mountDir.dirAt("usr/portage/distfiles"));
}
}
}