summaryrefslogtreecommitdiffstats
path: root/os-plugins/plugins/vmware/OpenSLX/OSPlugin/vmware.pm
diff options
context:
space:
mode:
authorVolker Uhrig2008-05-02 19:04:30 +0200
committerVolker Uhrig2008-05-02 19:04:30 +0200
commit52fa98c86c0bf1cc04bda17ae465a48c4f849e7e (patch)
tree2f743b992ef601e3401209628fd50772779054e2 /os-plugins/plugins/vmware/OpenSLX/OSPlugin/vmware.pm
parentSome comments to vmware plugin code ... (diff)
downloadcore-52fa98c86c0bf1cc04bda17ae465a48c4f849e7e.tar.gz
core-52fa98c86c0bf1cc04bda17ae465a48c4f849e7e.tar.xz
core-52fa98c86c0bf1cc04bda17ae465a48c4f849e7e.zip
* created function for version check
* removed vmware-ws check * cleaned up some code git-svn-id: http://svn.openslx.org/svn/openslx/openslx/trunk@1760 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'os-plugins/plugins/vmware/OpenSLX/OSPlugin/vmware.pm')
-rw-r--r--os-plugins/plugins/vmware/OpenSLX/OSPlugin/vmware.pm89
1 files changed, 50 insertions, 39 deletions
diff --git a/os-plugins/plugins/vmware/OpenSLX/OSPlugin/vmware.pm b/os-plugins/plugins/vmware/OpenSLX/OSPlugin/vmware.pm
index 9d4a985d..8d1110fe 100644
--- a/os-plugins/plugins/vmware/OpenSLX/OSPlugin/vmware.pm
+++ b/os-plugins/plugins/vmware/OpenSLX/OSPlugin/vmware.pm
@@ -69,7 +69,7 @@ sub getAttrInfo
default => '1',
},
# attribute 'imagesrc' defines where we can find vmware images
- 'vmware::imagessrc' => {
+ 'vmware::imagesrc' => {
applies_to_systems => 1,
applies_to_clients => 1,
description => unshiftHereDoc(<<' End-of-Here'),
@@ -158,7 +158,11 @@ sub installationPhase
my $vmbin = "";
my $vmfile = ""; # will be vmware or vmplayer
my $vmversion = ""; # will be v1/2 (vmplayer)
- # or v5.x/6.x (vmware ws) --> build number might be needed too
+ # Dirk: didnt we say we will always use vmplayer,
+ # even if vmware ws is installed?
+ # or v5.x/6.x (vmware ws) --> build number might be needed too
+ my $vmbuildversion = "";
+ my @versioninfo; # array we get from _checkVersion
# get path of files we need to install
my $pluginFilesPath
@@ -195,51 +199,31 @@ sub installationPhase
# (do not generate scripts for packages which are not installed)
my @types = qw( local );
foreach my $type (@types) {
- # location of the vmware stuff, "local" for directly installed
- # package (more sophisticated assignment might be needed ...)
+ # location of the vmware stuff
if ($type eq "local") {
$vmpath = "/usr/lib/vmware";
$vmbin = "/usr/bin";
- # test if we use vmplayer or vmware - should be moved to subroutine +++!!, because
- # needed in other places too ... (check in this routine both vmware/player, build)
#TODO: error handling if non installed or not supported
# version of local
- if (-e "/usr/lib/vmware/bin/vmware") {
- $vmfile = "vmware";
- # get version. read it out of the binary
- open(FH, "/usr/lib/vmware/bin/vmware");
- $/ = undef;
- my $data = <FH>;
- close FH;
- #TODO: add the else case, if we cant find this string
- if ($data =~ m{(\d\.\d)\.\d build-(\d)+}) {
- $vmversion = $1;
- }
- print "DEBUG: vmware ws version: $vmversion\n";
- rename("/usr/bin/$vmfile", "/usr/bin/$vmfile.slx-bak");
- linkFile("/var/X11R6/bin/$vmfile", "/usr/bin/$vmfile");
- } elsif (-e "/usr/lib/vmware/bin/vmplayer") {
- $vmfile = "vmplayer";
- # dublicate of test for vmware - should be put into a function,
- # e.g. in one which decides if workstation or player too ... (see above, exactly
- # the same code for checking!!)
- open(FH, "/usr/lib/vmware/bin/vmplayer");
- $/ = undef;
- my $data = <FH>;
- close FH;
- #TODO: add the else case, if we cant find this string
- if ($data =~ m{(\d\.\d)\.\d build-(\d)+}) {
- $vmversion = $1;
- }
- chomp($vmversion);
+ # if vmware ws is installed, vmplayer is installed, too.
+ # we will only use vmplayer
+ if (-e "/usr/lib/vmware/bin/vmplayer") {
+ # perhaps not optimal with the array, but how to solve
+ # else if we don't want to open the file twice?
+ @versioninfo = $self->_checkVersion("/usr/lib/vmware/bin/vmplayer");
+ $vmbuildversion = pop(@versioninfo);
+ $vmversion = pop(@versioninfo);
+
print "DEBUG: vmplayer version: $vmversion\n";
- rename("/usr/bin/$vmfile", "/usr/bin/$vmfile.slx-bak");
- linkFile("/var/X11R6/bin/$vmfile", "/usr/bin/$vmfile");
+ print " and build-version: $vmbuildversion\n";
+
+ rename("/usr/bin/vmplayer", "/usr/bin/vmplayer.slx-bak");
+ # TODO: rename ok, but linkfile will be in conflict
+ # with local installed versions. => move to stage3
+ #linkFile("/var/X11R6/bin/vmplayer", "/usr/bin/vmplayer");
}
}
-
- # (TODO: pathname not completely clear ...
- # -> should be the one of the plugin)
+ # TODO: here we will add the slx-installed versions
else {
$vmpath = "$self->{'pluginRepositoryPath'}/vmware/$type";
$vmbin = "$vmpath/bin";
@@ -247,6 +231,7 @@ sub installationPhase
$vmversion = "TODO: get information from the stage1 flag";
$vmfile = "TODO: get information from the stage1 flag";
}
+
my $runlevelScript = "$self->{'pluginRepositoryPath'}/vmware.$type";
$self->_writeRunlevelScript($vmbin, $runlevelScript);
@@ -343,4 +328,30 @@ sub _writeRunlevelScript
spitFile($file, $runlevelScript);
}
+
+# function checks vmplayer version and buildnumber
+sub _checkVersion
+{
+ my $self = shift;
+ my $file = shift;
+ my $vmversion = "";
+ my $vmbuildversion = "";
+
+ open(FH, "$file");
+ $/ = undef;
+ my $data = <FH>;
+ close FH;
+
+ #TODO: add the else case, if we cant find this string
+ if ($data =~ m{(\d\.\d)\.\d build-(\d+)}) {
+ $vmversion = $1;
+ $vmbuildversion = $2;
+ }
+ chomp($vmversion);
+ chomp($vmbuildversion);
+ my @returnarray = ($vmversion, $vmbuildversion);
+
+ return @returnarray;
+}
+
1;