summaryrefslogtreecommitdiffstats
path: root/os-plugins/plugins/virtualbox/OpenSLX/OSPlugin/virtualbox.pm
diff options
context:
space:
mode:
authorVolker Uhrig2009-07-15 13:44:14 +0200
committerVolker Uhrig2009-07-15 13:44:14 +0200
commitec6799fad18e471df982f40d3703d872fa677ee1 (patch)
tree77c12f8b8349406f646efb50a74732661efaf19b /os-plugins/plugins/virtualbox/OpenSLX/OSPlugin/virtualbox.pm
parent* added option for different network kinds (diff)
downloadcore-ec6799fad18e471df982f40d3703d872fa677ee1.tar.gz
core-ec6799fad18e471df982f40d3703d872fa677ee1.tar.xz
core-ec6799fad18e471df982f40d3703d872fa677ee1.zip
* workaround for init-file
* disabled virtualbox installation till installation process got fixed git-svn-id: http://svn.openslx.org/svn/openslx/openslx/trunk@3004 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'os-plugins/plugins/virtualbox/OpenSLX/OSPlugin/virtualbox.pm')
-rw-r--r--os-plugins/plugins/virtualbox/OpenSLX/OSPlugin/virtualbox.pm111
1 files changed, 70 insertions, 41 deletions
diff --git a/os-plugins/plugins/virtualbox/OpenSLX/OSPlugin/virtualbox.pm b/os-plugins/plugins/virtualbox/OpenSLX/OSPlugin/virtualbox.pm
index e88cec79..e9400c55 100644
--- a/os-plugins/plugins/virtualbox/OpenSLX/OSPlugin/virtualbox.pm
+++ b/os-plugins/plugins/virtualbox/OpenSLX/OSPlugin/virtualbox.pm
@@ -23,6 +23,7 @@ use File::Path;
use OpenSLX::Basics;
use OpenSLX::Utils;
+use OpenSLX::DistroUtils;
sub new
{
@@ -113,12 +114,16 @@ sub installationPhase
# Different names of the tool (should be unified somehow!?)
if (!isInPath('VirtualBox')) {
+ # todo: fix this
$self->{distro}->installVbox();
}
if (!isInPath('VirtualBox')) {
print "VirtualBox is not installed. VirtualBox Plugin won't be installed!\n";
- exit
- }
+# exit
+ }
+
+ $self->_writeRunlevelScript();
+
# Copy run-virt.include to the appropriate place for inclusion in stage4
copyFile("$self->{openslxBasePath}/lib/plugins/virtualbox/files/run-virt.include",
"$self->{pluginRepositoryPath}/");
@@ -150,46 +155,70 @@ sub checkStage3AttrValues
sub _writeRunlevelScript
{
my $self = shift;
- my $location = shift;
- my $file = shift;
- my $kind = shift;
- # should use the abstract write runlevel script way, see
- # http://lab.openslx.org/repositories/revision/openslx/2405 ff.
- my $runlevelScript = $self->{distro}->fillRunlevelScript($location, $kind);
-
-
- spitFile($file, $runlevelScript);
- # function:
- # running() {
- # lsmod | grep -q "$1[^_-]"
- # }
- # vmstatus() {
- # if running vboxdrv; then
- # if running vboxnetflt; then
- # echo "VirtualBox kernel modules (vboxdrv and vboxnetflt) are loaded."
- # else
- # echo "VirtualBox kernel module is loaded."
- # fi
- # #TODO: check it: ignore user check. handling our own way:
- # for i in /tmp/.vbox-*-ipc; do
- # echo "Running: "
- # $(VBoxManage --nologo list runningvms | sed -e 's/^".*"//' 2>/dev/null)
- # done
- # else
- # echo "VirtualBox kernel module is not loaded."
- # fi
- # }
- # start() {
- # modprobe vboxdrv && modprobe vboxnetflt
- # }
- # stop() {
- # rmmod vboxnetflt && rmmod vboxdrv
- # }
- # case start: start
- # case stop: stop
- # case status: vmstatus
- # case restart: stop && start
+ my $initfile = newInitFile();
+ my $workaround = "# Workaround till DistroUtils support functions\n";
+
+ $initfile->setName("virtualbox.slx");
+ $initfile->setDesc("Setup environment for virtualbox. Part of OpenSLX virtualbox plugin.");
+
+ #$initfile->addScript(
+ # 'running',
+ # 'lsmod | grep -q "$1[^_-]"'
+ #);
+ #$initfile->addScript(
+ # 'vmstatus',
+ # 'if running vboxdrv; then
+ # if running vboxnetflt; then
+ # echo "VirtualBox kernel modules (vboxdrv and vboxnetflt) are loaded."
+ # else
+ # echo "VirtualBox kernel module is loaded."
+ # fi
+ # #TODO: check it: ignore user check. handling our own way:
+ # for i in /tmp/.vbox-*-ipc; do
+ # echo "Running: "
+ # $(VBoxManage --nologo list runningvms | sed -e \'s/^".*"//\' 2>/dev/null)
+ # done
+ # else
+ # echo "VirtualBox kernel module is not loaded."
+ # fi'
+ #);
+ #$initfile->addScript(
+ # 'start',
+ # 'modprobe vboxdrv && modprobe vboxnetflt',
+ #);
+ $workaround .= "start() { modprobe vboxdrv && modprobe vboxnetflt }\n";
+ #$initfile->addScript(
+ # 'stop',
+ # 'rmmod vboxnetflt && rmmod vboxdrv',
+ #);
+ $workaround .= "stop() { rmmod vboxnetflt && rmmod vboxdrv }\n";
+ $initfile->addToCase(
+ 'start',
+ 'start'
+ );
+ $initfile->addToCase(
+ 'stop',
+ 'stop'
+ );
+ $initfile->addToCase(
+ 'status',
+ 'vmstatus'
+ );
+ $initfile->addToCase(
+ 'restart',
+ 'stop && start'
+ );
+
+ # get distro version
+ my $workaround_distro = qx(lsb_release -si);
+ my $runlevelscript = getInitFileForDistro($initfile, $workaround_distro);
+
+ $workaround .= $runlevelscript;
+
+ # todo: because we dont have distribution or version dependend
+ # init scripts we could put it directly into /etc/init.d...
+ spitFile("$self->{'pluginRepositoryPath'}/vbox-slx", $workaround);
}
# The bridge configuration needs the bridge module to be present in early