diff options
author | Volker Uhrig | 2009-07-15 13:44:14 +0200 |
---|---|---|
committer | Volker Uhrig | 2009-07-15 13:44:14 +0200 |
commit | ec6799fad18e471df982f40d3703d872fa677ee1 (patch) | |
tree | 77c12f8b8349406f646efb50a74732661efaf19b /os-plugins | |
parent | * added option for different network kinds (diff) | |
download | core-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')
6 files changed, 96 insertions, 61 deletions
diff --git a/os-plugins/plugins/virtualbox/OpenSLX/Distro/Base.pm b/os-plugins/plugins/virtualbox/OpenSLX/Distro/Base.pm index e624b897..f23a1142 100644 --- a/os-plugins/plugins/virtualbox/OpenSLX/Distro/Base.pm +++ b/os-plugins/plugins/virtualbox/OpenSLX/Distro/Base.pm @@ -51,9 +51,9 @@ sub installVbox my $engine = $self->{'os-plugin-engine'}; # lets try it... we can't loose anything :) - $engine->installPackages( - $engine->getInstallablePackagesForSelection('virtualbox-ose') - ); + #$engine->installPackages( + # $engine->getInstallablePackagesForSelection('virtualbox-ose') + #); return; } diff --git a/os-plugins/plugins/virtualbox/OpenSLX/Distro/Debian.pm b/os-plugins/plugins/virtualbox/OpenSLX/Distro/Debian.pm index 17f224ac..2cd03647 100644 --- a/os-plugins/plugins/virtualbox/OpenSLX/Distro/Debian.pm +++ b/os-plugins/plugins/virtualbox/OpenSLX/Distro/Debian.pm @@ -32,14 +32,14 @@ sub installVbox my $engine = $self->{'os-plugin-engine'}; my $release = `lsb_release -rs`; + chomp($release); # lenny(5.0) has v1.6 # testing is ok. but no clue which lsb_release -rs it has... if ( $release eq "999999.0") { - $engine->installPackages( - $engine->getInstallablePackagesForSelection('virtualbox-ose') - - ); + #$engine->installPackages( + # $engine->getInstallablePackagesForSelection('virtualbox-ose') + #); } else { print "Couldn't install VirtualBox, no package from distribution\n"; exit; diff --git a/os-plugins/plugins/virtualbox/OpenSLX/Distro/Suse.pm b/os-plugins/plugins/virtualbox/OpenSLX/Distro/Suse.pm index ebdf1835..b7e194a6 100644 --- a/os-plugins/plugins/virtualbox/OpenSLX/Distro/Suse.pm +++ b/os-plugins/plugins/virtualbox/OpenSLX/Distro/Suse.pm @@ -32,12 +32,12 @@ sub installVbox my $engine = $self->{'os-plugin-engine'}; my $release = `lsb_release -rs`; + chomp($release); if ( $release eq "11.1" || $release eq "11.0" || $release eq "10.3") { - $engine->installPackages( - $engine->getInstallablePackagesForSelection('virtualbox-ose') - - ); + #$engine->installPackages( + # $engine->getInstallablePackagesForSelection('virtualbox-ose') + #); } else { print "Couldn't install VirtualBox, no package from distribution\n"; exit; diff --git a/os-plugins/plugins/virtualbox/OpenSLX/Distro/Ubuntu.pm b/os-plugins/plugins/virtualbox/OpenSLX/Distro/Ubuntu.pm index 03dce150..e3a910dc 100644 --- a/os-plugins/plugins/virtualbox/OpenSLX/Distro/Ubuntu.pm +++ b/os-plugins/plugins/virtualbox/OpenSLX/Distro/Ubuntu.pm @@ -19,12 +19,12 @@ use warnings; # inherit everything from Debian (as Ubuntu is based on it anyway) use base qw(virtualbox::OpenSLX::Distro::Debian); - use base qw(virtualbox::OpenSLX::Distro::Base); use OpenSLX::Basics; use OpenSLX::Utils; + ################################################################################ #### interface methods ################################################################################ @@ -35,13 +35,13 @@ sub installVbox my $engine = $self->{'os-plugin-engine'}; my $release = `lsb_release -rs`; + chomp($release); # hardy (8.04LTS): only version VBox v1.5 if ( $release eq "8.10" || $release eq "9.04") { - $engine->installPackages( - $engine->getInstallablePackagesForSelection('virtualbox-ose') - - ); +# $engine->installPackages( +# $engine->getInstallablePackagesForSelection('virtualbox-ose') +# ); } else { print "Couldn't install VirtualBox, no package from distribution!\n"; exit; 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 diff --git a/os-plugins/plugins/virtualbox/XX_virtualbox.sh b/os-plugins/plugins/virtualbox/XX_virtualbox.sh index 4a725a17..36158bdb 100644 --- a/os-plugins/plugins/virtualbox/XX_virtualbox.sh +++ b/os-plugins/plugins/virtualbox/XX_virtualbox.sh @@ -46,10 +46,16 @@ ${virtualbox_imagesrc}." nonfatal cp /mnt/opt/openslx/plugin-repo/virtualbox/run-virt.include \ /mnt/etc/opt/openslx/run-virtualbox.include - modprobe vboxdrv - modprobe vboxnetflt - mknod -m 0660 /dev/vboxdrv c 10 59 - chown root:vboxusers /dev/vboxdrv + # copy and activate init file + cp /mnt/opt/openslx/plugin-repo/virtualbox/vbox-slx \ + /mnt/etc/init.d + chmod 755 /etc/init.d/vbox-slx + rllinker "vbox-slx" 20 2 + + modprobe vboxdrv + modprobe vboxnetflt + mknod -m 0660 /dev/vboxdrv c 10 59 + chown root:vboxusers /dev/vboxdrv fi else [ $DEBUGLEVEL -gt 0 ] && echo " * Configuration of virtualbox plugin failed" |