diff options
-rw-r--r-- | os-plugins/plugins/vmware/OpenSLX/OSPlugin/vmware.pm | 45 | ||||
-rw-r--r-- | os-plugins/plugins/vmware/XX_vmware.sh | 45 |
2 files changed, 51 insertions, 39 deletions
diff --git a/os-plugins/plugins/vmware/OpenSLX/OSPlugin/vmware.pm b/os-plugins/plugins/vmware/OpenSLX/OSPlugin/vmware.pm index 92107519..d04d8319 100644 --- a/os-plugins/plugins/vmware/OpenSLX/OSPlugin/vmware.pm +++ b/os-plugins/plugins/vmware/OpenSLX/OSPlugin/vmware.pm @@ -146,10 +146,11 @@ sub getAttrInfo applies_to_systems => 1, applies_to_clients => 1, description => unshiftHereDoc(<<' End-of-Here'), - Which set of VMware binaries to use? + Which set of VMware binaries to use: installed (local) or provided by an + other plugin (e.g. Workstation 5.5: vmws5.5, Player 2.0: vmpl2.0, ...) End-of-Here content_regex => qr{^(0|1)$}, - content_descr => 'Allowed values: local, path to vmware installation', + content_descr => 'Allowed values: local, vmws5.5, vmws6.0, vmpl1.0 ...', default => 'local', }, }; @@ -164,27 +165,38 @@ sub installationPhase $self->{openslxPath} = shift; $self->{attrs} = shift; - # location of the vmware stuff - # if $vmware::kind 'local' - my $vmpath = "/usr/lib/vmware"; - my $vmbin = "/usr/bin"; - # if $vmware::kind '/opt/openslx/plugin...' - #my $vmpath = $vmware::kind - #my $vmbin = "$vmpath/bin"; + my $vmpath = ""; + my $vmbin = ""; # get path of files we need to install my $pluginFilesPath = "$self->{'openslxPath'}/lib/plugins/$self->{'name'}/files"; - # copy all needed files + # copy all needed files (TODO: nvram should depend on the "kind" of vmware ...) my @files = qw( vmware-init nvram.5.0 runvmware-v2 ); foreach my $file (@files) { copyFile("$pluginFilesPath/$file", $self->{'pluginRepositoryPath'}); } - # generate the runlevel script (depends on distro/version and vmware - # location) - my $runlevelScriptPath = $self->{distro}->getRunlevelScriptPath(); - $self->_writeRunlevelScript($vmbin, $runlevelScriptPath); + # generate the runlevel scripts for all existing vmware installations, + # variants because we do not know which on is selected on client level + # (code depends on distro/version and vmware location) + # for local ... other vm-installations (TODO: generate list) + @files = qw( local ); + foreach my $file (@files) { + # location of the vmware stuff, "local" for directly installed + # package (more sophisticated assignment might be needed ...) + if ( $file eq "local" ) { + my $vmpath = "/usr/lib/vmware"; + my $vmbin = "/usr/bin"; + } + # if provided via another plugin (TODO: pathname not completely clear ...) + else { + my $vmpath = "/opt/openslx/plugin-repo/vmwareXXX/$file"; + my $vmbin = "$vmpath/bin"; + } + my $runlevelScript = "$self->{'pluginRepositoryPath'}/vmware.$file"; + $self->_writeRunlevelScript($vmbin, $runlevelScript); + } # generate links for the user executables vmware and player and a # simplified version of the start script @@ -235,8 +247,9 @@ sub _writeRunlevelScript my $script = unshiftHereDoc(<<" End-of-Here"); #!/bin/sh # - # parts taken from vmware start script: - # Copyright 1998-2007 VMware, Inc. All rights reserved. + # generated via stage1 'vmware' plugin install + # inspiration taken from vmware start script: + # Copyright 1998-2007 VMware, Inc. All rights reserved. # # This script manages the services needed to run VMware software diff --git a/os-plugins/plugins/vmware/XX_vmware.sh b/os-plugins/plugins/vmware/XX_vmware.sh index af676efb..c4fb72d2 100644 --- a/os-plugins/plugins/vmware/XX_vmware.sh +++ b/os-plugins/plugins/vmware/XX_vmware.sh @@ -31,6 +31,7 @@ if [ -e /initramfs/plugin-conf/vmware.conf ]; then # Load general configuration . /initramfs/machine-setup . /etc/functions + . /etc/distro-functions . /etc/sysconfig/config # prepare all needed vmware configuration files @@ -57,50 +58,50 @@ stage3 setup" > /mnt/etc/vmware/slxvmconfig local dnslist=$(echo "$domain_name_servers"|sed "s/ /,/g") echo -e "# /etc/vmware/dhcpd.conf written in stage3 ...\nallow \ unknown-clients;\ndefault-lease-time 1800;\nmax-lease-time 7200;\n\ -option domain-name-servers $dnslist;\noption domain-name \"vm.local\";" \ +option domain-name-servers $dnslist;\noption domain-name \"vm.local\";\n" \ > /mnt/etc/vmware/dhcpd.conf fi # variable might contain ",NAT" which is to be taken off if [ -n "$vmware_vmnet1" ] ; then - local vmnt=${vmware_vmnet1%,*} - local vmnet1=${vmware_vmnet%,*} + local vmnet1=${vmware_vmnet1%,*} + local vmnat=${vmware_vmnet1#$vmnet1*} local vmip=${vmnet1%/*} local vmpx=${vmnet1#*/} - echo "$vmnt, $vmnet1, $vmip, $vmpx" - echo -e "vmnet1=$vmip/$vmpx" >> /mnt/etc/vmware/slxvmconfig + echo -e "vmnet1=$vmnet1" >> /mnt/etc/vmware/slxvmconfig [ -n "$vmnt" ] && echo "vmnet1nat=true" >> /mnt/etc/vmware/slxvmconfig - echo -e "subnet $(ipcalc -n $vmip/$vmpx|sed s/.*=//) netmask \ -$(ipcalc -n $vmip/$vmpx|sed s/.*=//) {\n\trange $rstart $rend;\n\ -\toption broadcast $(ipcalc -b $vmip/$vmpx|sed s/.*=//);\n\ -\toption routers $vmip;\n}" > /mnt/etc/vmware/dhcpd.conf + echo -e "# definition for virtual vmnet1 interface\n\ +subnet $(ipcalc -n $vmnet1|sed s/.*=//) netmask \ +$(ipcalc -m $vmnet1|sed s/.*=//) {\n\trange $rstart $rend;\n\ +\toption broadcast $(ipcalc -b $vmnet1|sed s/.*=//);\n\ +\toption routers $vmip;\n}" >> /mnt/etc/vmware/dhcpd.conf fi - # vmware nat interface + # vmware nat interface configuration if [ -n "$vmware_vmnet8" ] ; then local vmip=${vmware_vmnet8%/*} local vmpx=${vmware_vmnet8#*/} - echo "vmnet8=$vmip/$vmpx" >> /mnt/etc/vmware/slxvmconfig - echo "\nsubnet $(ipcalc -n $vmip/$vmpx|sed s/.*=//) netmask \ + echo -e "vmnet8=$vmip/$vmpx" >> /mnt/etc/vmware/slxvmconfig + echo -e "\n# definition for virtual vmnet8 interface\n\ +subnet $(ipcalc -m $vmip/$vmpx|sed s/.*=//) netmask \ $(ipcalc -n $vmip/$vmpx|sed s/.*=//) {\n\trange $rstart $rend;\n\ \toption broadcast $(ipcalc -b $vmip/$vmpx|sed s/.*=//);\n\ -\toption routers $vmip;\n}" > /mnt/etc/vmware/dhcpd.conf +\toption routers $vmip;\n}" >> /mnt/etc/vmware/dhcpd.conf # generate the NAT configuration file - echo "# Linux NAT configuration file\n[host]\nip = $vmip/$vmpx\n\ + echo -e "# Linux NAT configuration file\n[host]\nip = $vmip/$vmpx\n\ device = /dev/vmnet8\nactiveFTP = 1\n[udp]\ntimeout = 60\n[incomingtcp]\n\ [incomingudp]" > /mnt/etc/vmware/nat.conf echo "00:50:56:F1:30:50" > /mnt/etc/vmware/vmnet-natd-8.mac fi - # copy the runlevelscript to the proper place - cp /mnt/opt/openslx/plugin-repo/vmware/vmware-init \ - /mnt/etc/${D_INITDIR}/vmware + # copy the runlevelscript to the proper place and activate it + cp /mnt/opt/openslx/plugin-repo/vmware/vmware.${vmware_kind} \ + /mnt/etc/${D_INITDIR}/vmware || echo "this should not happen ..." rllinker "vmware" 20 2 - - echo " * vmware part 1" ############################################################################# # vmware stuff first part: two scenarios # * VM images in /usr/share/vmware - then simply link # * VM images via additional mount (mount source NFS, NBD, ...) + # TODO: shouldn't that handled by the vmchooser plugin!?! # map slxgrp to pool, so it's better to understand pool=${slxgrp} # if we dont have slxgrp defined @@ -137,20 +138,18 @@ device = /dev/vmnet8\nactiveFTP = 1\n[udp]\ntimeout = 60\n[incomingtcp]\n\ esac fi - echo " * vmware part 2" - ############################################################################# # vmware stuff second part: setting up the environment # create needed directories and files for i in /var/run/vmware /etc/vmware/loopimg \ - /etc/vmware/fd-loop /var/X11R6/bin /etc/X11/sessions; do + /etc/vmware/fd-loop /var/X11R6/bin /etc/X11/sessions; do testmkd /mnt/$i done # create needed devices (not created automatically via module load) for i in "/dev/vmnet0 c 119 0" "/dev/vmnet1 c 119 1" \ - "/dev/vmnet8 c 119 8" "/dev/vmmon c 10 165"; do + "/dev/vmnet8 c 119 8" "/dev/vmmon c 10 165"; do mknod $i done |