diff options
author | Volker Uhrig | 2009-06-23 16:34:13 +0200 |
---|---|---|
committer | Volker Uhrig | 2009-06-23 16:34:13 +0200 |
commit | 83b64a7bc5da94461725965f1ad8edc0ef44364c (patch) | |
tree | 3d985dd39859c29540712dfc3847f5d3575ea626 /os-plugins | |
parent | Proper name now ... (there is a list of several hid-* now - to be (diff) | |
download | core-83b64a7bc5da94461725965f1ad8edc0ef44364c.tar.gz core-83b64a7bc5da94461725965f1ad8edc0ef44364c.tar.xz core-83b64a7bc5da94461725965f1ad8edc0ef44364c.zip |
* Added installation checks
* Basic structur of init.d
git-svn-id: http://svn.openslx.org/svn/openslx/openslx/trunk@2982 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'os-plugins')
6 files changed, 109 insertions, 26 deletions
diff --git a/os-plugins/plugins/virtualbox/OpenSLX/Distro/Base.pm b/os-plugins/plugins/virtualbox/OpenSLX/Distro/Base.pm index 6baa6968..e624b897 100644 --- a/os-plugins/plugins/virtualbox/OpenSLX/Distro/Base.pm +++ b/os-plugins/plugins/virtualbox/OpenSLX/Distro/Base.pm @@ -44,18 +44,18 @@ sub initialize return 1; } -sub fillRunlevelScript +sub installVbox { my $self = shift; - my $location = shift; - my $kind = shift; - my $script = unshiftHereDoc(<<' End-of-Here'); - # put something here ... + my $engine = $self->{'os-plugin-engine'}; - End-of-Here + # lets try it... we can't loose anything :) + $engine->installPackages( + $engine->getInstallablePackagesForSelection('virtualbox-ose') + ); - return $script; + return; } 1; diff --git a/os-plugins/plugins/virtualbox/OpenSLX/Distro/Debian.pm b/os-plugins/plugins/virtualbox/OpenSLX/Distro/Debian.pm index f1f93287..17f224ac 100644 --- a/os-plugins/plugins/virtualbox/OpenSLX/Distro/Debian.pm +++ b/os-plugins/plugins/virtualbox/OpenSLX/Distro/Debian.pm @@ -26,17 +26,26 @@ use OpenSLX::Utils; ### interface methods ################################################################################ -sub fillRunlevelScript +sub installVbox { my $self = shift; - my $location = shift; - my $kind = shift; - my $script = unshiftHereDoc(<<' End-of-Here'); - # put something into here ... - - End-of-Here - return $script; + my $engine = $self->{'os-plugin-engine'}; + my $release = `lsb_release -rs`; + + # 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') + + ); + } else { + print "Couldn't install VirtualBox, no package from distribution\n"; + exit; + } + + return; } 1; diff --git a/os-plugins/plugins/virtualbox/OpenSLX/Distro/Suse.pm b/os-plugins/plugins/virtualbox/OpenSLX/Distro/Suse.pm index c514c122..ebdf1835 100644 --- a/os-plugins/plugins/virtualbox/OpenSLX/Distro/Suse.pm +++ b/os-plugins/plugins/virtualbox/OpenSLX/Distro/Suse.pm @@ -26,17 +26,24 @@ use OpenSLX::Utils; ### interface methods ################################################################################ -sub fillRunlevelScript +sub installVbox { my $self = shift; - my $location = shift; - my $kind = shift; - my $script = unshiftHereDoc(<<' End-of-Here'); - # put something into here ... - - End-of-Here - return $script; + my $engine = $self->{'os-plugin-engine'}; + my $release = `lsb_release -rs`; + + if ( $release eq "11.1" || $release eq "11.0" || $release eq "10.3") { + $engine->installPackages( + $engine->getInstallablePackagesForSelection('virtualbox-ose') + + ); + } else { + print "Couldn't install VirtualBox, no package from distribution\n"; + exit; + } + + return; } 1; diff --git a/os-plugins/plugins/virtualbox/OpenSLX/Distro/Ubuntu.pm b/os-plugins/plugins/virtualbox/OpenSLX/Distro/Ubuntu.pm index 067f53c2..03dce150 100644 --- a/os-plugins/plugins/virtualbox/OpenSLX/Distro/Ubuntu.pm +++ b/os-plugins/plugins/virtualbox/OpenSLX/Distro/Ubuntu.pm @@ -20,4 +20,35 @@ 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 +################################################################################ + +sub installVbox +{ + my $self = shift; + + my $engine = $self->{'os-plugin-engine'}; + my $release = `lsb_release -rs`; + + # hardy (8.04LTS): only version VBox v1.5 + if ( $release eq "8.10" || $release eq "9.04") { + $engine->installPackages( + $engine->getInstallablePackagesForSelection('virtualbox-ose') + + ); + } else { + print "Couldn't install VirtualBox, no package from distribution!\n"; + exit; + } + + + return; +} + 1; diff --git a/os-plugins/plugins/virtualbox/OpenSLX/OSPlugin/virtualbox.pm b/os-plugins/plugins/virtualbox/OpenSLX/OSPlugin/virtualbox.pm index 5ce615c5..e88cec79 100644 --- a/os-plugins/plugins/virtualbox/OpenSLX/OSPlugin/virtualbox.pm +++ b/os-plugins/plugins/virtualbox/OpenSLX/OSPlugin/virtualbox.pm @@ -113,10 +113,12 @@ sub installationPhase # Different names of the tool (should be unified somehow!?) if (!isInPath('VirtualBox')) { - $engine->installPackages( - $engine->getInstallablePackagesForSelection('virtualbox-ose') - ); + $self->{distro}->installVbox(); } + if (!isInPath('VirtualBox')) { + print "VirtualBox is not installed. VirtualBox Plugin won't be installed!\n"; + exit + } # Copy run-virt.include to the appropriate place for inclusion in stage4 copyFile("$self->{openslxBasePath}/lib/plugins/virtualbox/files/run-virt.include", "$self->{pluginRepositoryPath}/"); @@ -158,6 +160,36 @@ sub _writeRunlevelScript 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 } # 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 94481df9..4a725a17 100644 --- a/os-plugins/plugins/virtualbox/XX_virtualbox.sh +++ b/os-plugins/plugins/virtualbox/XX_virtualbox.sh @@ -46,6 +46,10 @@ ${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 fi else [ $DEBUGLEVEL -gt 0 ] && echo " * Configuration of virtualbox plugin failed" |