mirror of https://github.com/apache/jclouds.git
Moved RunScriptData to src/main as there are non test dependencies; Deleted orpah and duplicate file GuestAdditionsInstallation.java (wrong place and duplicated in InstallGuestAdditions.java) as well as duplicate script installGuestAdditions.sh (duplicated in installModuleAssistantIfNeeded.sh)
This commit is contained in:
parent
df65c91a54
commit
ca602e7db0
|
@ -1,10 +0,0 @@
|
|||
function installGuestAdditions {
|
||||
unset OSNAME;
|
||||
local OSNAME=`lsb_release -d -s | cut -d ' ' -f 1`; shift
|
||||
if [ $OSNAME = 'Ubuntu' ]
|
||||
then
|
||||
echo "OS is Ubuntu"
|
||||
apt-get -f -y -qq --force-yes install build-essential module-assistant && m-a prepare -i
|
||||
fi
|
||||
return 0
|
||||
}
|
|
@ -1,74 +0,0 @@
|
|||
/**
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you 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 org.jclouds.virtualbox.statements;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static org.jclouds.scriptbuilder.domain.Statements.call;
|
||||
import static org.jclouds.scriptbuilder.domain.Statements.exec;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Collections;
|
||||
|
||||
import org.jclouds.scriptbuilder.ScriptBuilder;
|
||||
import org.jclouds.scriptbuilder.domain.OsFamily;
|
||||
import org.jclouds.scriptbuilder.domain.SaveHttpResponseTo;
|
||||
import org.jclouds.scriptbuilder.domain.Statement;
|
||||
|
||||
import com.google.common.collect.ImmutableMultimap;
|
||||
|
||||
public class GuestAdditionsInstallation implements Statement {
|
||||
|
||||
private final String vboxVersion;
|
||||
private final String mountPoint;
|
||||
|
||||
public GuestAdditionsInstallation(String vboxVersion) {
|
||||
this(vboxVersion, "/mnt");
|
||||
}
|
||||
|
||||
public GuestAdditionsInstallation(String vboxVersion, String mountPoint) {
|
||||
this.vboxVersion = checkNotNull(vboxVersion, "vboxVersion");
|
||||
this.mountPoint = checkNotNull(mountPoint, "mountPoint");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<String> functionDependencies(OsFamily family) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String render(OsFamily family) {
|
||||
checkNotNull(family, "family");
|
||||
if (family == OsFamily.WINDOWS)
|
||||
throw new UnsupportedOperationException("windows not yet implemented");
|
||||
|
||||
String vboxGuestAdditionsIso = "VBoxGuestAdditions_" + vboxVersion + ".iso";
|
||||
ScriptBuilder scriptBuilder = new ScriptBuilder()
|
||||
.addStatement(
|
||||
new SaveHttpResponseTo("{tmp}", vboxGuestAdditionsIso, "GET", URI
|
||||
.create("http://download.virtualbox.org/virtualbox/" + vboxVersion + "/"
|
||||
+ vboxGuestAdditionsIso), ImmutableMultimap.<String, String> of()))
|
||||
.addStatement(exec(String.format("mount -o loop {tmp}{fs}%s %s", vboxGuestAdditionsIso, mountPoint)))
|
||||
.addStatement(call("installGuestAdditions"))
|
||||
.addStatement(exec(String.format("sh %s%s", mountPoint, "/VBoxLinuxAdditions.run")))
|
||||
.addStatement(exec(String.format("umount %s", mountPoint)));
|
||||
return scriptBuilder.render(family);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue