From 7796d07fd918175dd2ab795c8928d88a47a392c2 Mon Sep 17 00:00:00 2001 From: Volker Uhrig Date: Sat, 7 Jun 2008 19:52:48 +0000 Subject: * finished implementation of vmpl2.0 installation * tested successfull on suse 10.2 (vmpl2.0 and local installation) * some minor (optical) changes * some more errorhandling for invalid configuration needed * theres a need for tests on debian-based systems * Configuration: http://openslx.org/trac/de/openslx/wiki/vmware git-svn-id: http://svn.openslx.org/svn/openslx/openslx/trunk@1859 95ad53e4-c205-0410-b2fa-d234c58c8868 --- os-plugins/plugins/vmware/OpenSLX/Distro/Base.pm | 26 ++++++++---- os-plugins/plugins/vmware/OpenSLX/Distro/Debian.pm | 23 +++++++---- os-plugins/plugins/vmware/OpenSLX/Distro/Gentoo.pm | 22 +++++++--- os-plugins/plugins/vmware/OpenSLX/Distro/Suse.pm | 22 +++++++--- .../plugins/vmware/OpenSLX/OSPlugin/vmware.pm | 47 +++++++++++++--------- os-plugins/plugins/vmware/XX_vmware.sh | 13 +++--- os-plugins/plugins/vmware/files/install-vmpl2.0.sh | 13 +++--- .../plugins/vmware/files/runvmware-player-v1 | 11 +++-- .../plugins/vmware/files/runvmware-player-v2 | 11 +++-- 9 files changed, 122 insertions(+), 66 deletions(-) (limited to 'os-plugins/plugins/vmware') diff --git a/os-plugins/plugins/vmware/OpenSLX/Distro/Base.pm b/os-plugins/plugins/vmware/OpenSLX/Distro/Base.pm index 2dfc2700..20769ca4 100644 --- a/os-plugins/plugins/vmware/OpenSLX/Distro/Base.pm +++ b/os-plugins/plugins/vmware/OpenSLX/Distro/Base.pm @@ -36,7 +36,7 @@ sub initialize { my $self = shift; my $engine = shift; - + return 1; } @@ -53,7 +53,7 @@ sub fillRunlevelScript # Copyright 1998-2007 VMware, Inc. All rights reserved. # # This script manages the services needed to run VMware software - + # Basic support for the Linux Standard Base Specification 1.3 ### BEGIN INIT INFO # Provides: VMware @@ -65,10 +65,19 @@ sub fillRunlevelScript # Description: Manages the services needed to run VMware software ### END INIT INFO load_modules() { - # to be filled in via the stage1 configuration script - modprobe -qa vmmon vmnet vmblock 2>/dev/null || echo "Problem here!" - # most probably nobody wants to run the parallel port driver ... - #modprobe vm... + if [ \${vmware_kind} = "local" ]; then + # to be filled in via the stage1 configuration script + modprobe -qa vmmon vmnet vmblock 2>/dev/null || return 1 + # most probably nobody wants to run the parallel port driver ... + #modprobe vm... + else + # load module manuall + vmware_kind_path=/opt/openslx/plugin-repo/vmware/\${vmware_kind}/ + module_src_path=\${vmware_kind_path}/root/lib/vmware/modules/source + insmod \${module_src_path}/vmblock.o + insmod \${module_src_path}/vmmon.o + insmod \${module_src_path}/vmnet.o + fi } unload_modules() { # to be filled with the proper list within via the stage1 configuration @@ -135,8 +144,9 @@ sub fillRunlevelScript echo "Stopping vmware background services ..." killall vmnet-netifup vmnet-natd vmnet-bridge vmware vmplayer \\ vmware-tray vmnet-dhcpd 2>/dev/null - # wait for shutting down of interfaces - usleep 50000 + # wait for shutting down of interfaces... vmnet needs kinda + # long + usleep 500000 unload_modules ;; #status) diff --git a/os-plugins/plugins/vmware/OpenSLX/Distro/Debian.pm b/os-plugins/plugins/vmware/OpenSLX/Distro/Debian.pm index 5991d6ad..e1c7e2e4 100644 --- a/os-plugins/plugins/vmware/OpenSLX/Distro/Debian.pm +++ b/os-plugins/plugins/vmware/OpenSLX/Distro/Debian.pm @@ -52,11 +52,19 @@ sub fillRunlevelScript ### END INIT INFO load_modules() { - # to be filled in via the stage1 configuration script - #TODO: everything behind || is not equal to Suse.pm - modprobe -qa vmmon vmnet vmblock 2>/dev/null || echo "Problem here!" - # most probably nobody wants to run the parallel port driver ... - #modprobe vm... + if [ \${vmware_kind} = "local" ]; then + # to be filled in via the stage1 configuration script + modprobe -qa vmmon vmnet vmblock 2>/dev/null || return 1 + # most probably nobody wants to run the parallel port driver ... + #modprobe vm... + else + # load module manuall + vmware_kind_path=/opt/openslx/plugin-repo/vmware/\${vmware_kind}/ + module_src_path=\${vmware_kind_path}/root/lib/vmware/modules/source + insmod \${module_src_path}/vmblock.o + insmod \${module_src_path}/vmmon.o + insmod \${module_src_path}/vmnet.o + fi } unload_modules() { # to be filled with the proper list within via the stage1 configuration @@ -131,8 +139,9 @@ sub fillRunlevelScript log_daemon_msg "Stopping vmware background services ..." "vmware" killall vmnet-netifup vmnet-natd vmnet-bridge vmware vmplayer \\ vmware-tray vmnet-dhcpd 2>/dev/null - # wait for shutting down of interfaces - usleep 50000 + # wait for shutting down of interfaces. vmnet needs kinda + # long + usleep 500000 unload_modules log_end_msg $? ;; diff --git a/os-plugins/plugins/vmware/OpenSLX/Distro/Gentoo.pm b/os-plugins/plugins/vmware/OpenSLX/Distro/Gentoo.pm index c11994f1..cac593df 100644 --- a/os-plugins/plugins/vmware/OpenSLX/Distro/Gentoo.pm +++ b/os-plugins/plugins/vmware/OpenSLX/Distro/Gentoo.pm @@ -48,10 +48,19 @@ sub fillRunlevelScript # helper functions load_modules() { - # to be filled in via the stage1 configuration script - modprobe -qa vmmon vmnet vmblock 2>/dev/null || return 1 - # most probably nobody wants to run the parallel port driver ... - #modprobe vm... + if [ \${vmware_kind} = "local" ]; then + # to be filled in via the stage1 configuration script + modprobe -qa vmmon vmnet vmblock 2>/dev/null || return 1 + # most probably nobody wants to run the parallel port driver ... + #modprobe vm... + else + # load module manuall + vmware_kind_path=/opt/openslx/plugin-repo/vmware/\${vmware_kind}/ + module_src_path=\${vmware_kind_path}/root/lib/vmware/modules/source + insmod \${module_src_path}/vmblock.o + insmod \${module_src_path}/vmmon.o + insmod \${module_src_path}/vmnet.o + fi } unload_modules() { # to be filled with the proper list within via the stage1 configuration @@ -121,8 +130,9 @@ sub fillRunlevelScript ebegin "Stopping vmware background services ..." killall vmnet-netifup vmnet-natd vmnet-bridge vmware vmplayer \\ vmware-tray vmnet-dhcpd 2>/dev/null - # wait for shutting down of interfaces - usleep 50000 + # wait for shutting down of interfaces. vmnet needs kinda + # long + usleep 500000 unload_modules eend $? } diff --git a/os-plugins/plugins/vmware/OpenSLX/Distro/Suse.pm b/os-plugins/plugins/vmware/OpenSLX/Distro/Suse.pm index 7e09e3c9..08a64055 100644 --- a/os-plugins/plugins/vmware/OpenSLX/Distro/Suse.pm +++ b/os-plugins/plugins/vmware/OpenSLX/Distro/Suse.pm @@ -53,10 +53,19 @@ sub fillRunlevelScript # helper functions load_modules() { - # to be filled in via the stage1 configuration script - modprobe -qa vmmon vmnet vmblock 2>/dev/null || return 1 - # most probably nobody wants to run the parallel port driver ... - #modprobe vm... + if [ \${vmware_kind} = "local" ]; then + # to be filled in via the stage1 configuration script + modprobe -qa vmmon vmnet vmblock 2>/dev/null || return 1 + # most probably nobody wants to run the parallel port driver ... + #modprobe vm... + else + # load module manuall + vmware_kind_path=/opt/openslx/plugin-repo/vmware/\${vmware_kind}/ + module_src_path=\${vmware_kind_path}/root/lib/vmware/modules/source + insmod \${module_src_path}/vmblock.o + insmod \${module_src_path}/vmmon.o + insmod \${module_src_path}/vmnet.o + fi } unload_modules() { # to be filled with the proper list within via the stage1 configuration @@ -133,8 +142,9 @@ sub fillRunlevelScript echo -n "Stopping vmware background services ..." killall vmnet-netifup vmnet-natd vmnet-bridge vmware vmplayer \\ vmware-tray vmnet-dhcpd 2>/dev/null - # wait for shutting down of interfaces - usleep 50000 + # wait for shutting down of interfaces. vmnet needs kinda + # long + usleep 500000 unload_modules rc_status -v ;; diff --git a/os-plugins/plugins/vmware/OpenSLX/OSPlugin/vmware.pm b/os-plugins/plugins/vmware/OpenSLX/OSPlugin/vmware.pm index 4207a12d..2786594b 100644 --- a/os-plugins/plugins/vmware/OpenSLX/OSPlugin/vmware.pm +++ b/os-plugins/plugins/vmware/OpenSLX/OSPlugin/vmware.pm @@ -196,7 +196,28 @@ sub installationPhase if ($self->{attrs}->{'vmware::vmpl2.0'} == 1) { $self->_vmpl2Installation(); } - + + ## prepration for our faster wrapper script + # rename the default vmplayer script and create a link. + # uninstall routine takes care about plugin remove. + # stage3 copys our own wrapper script + if (-e "/usr/bin/vmplayer") { + rename("/usr/bin/vmplayer", "/usr/bin/vmplayer.slx-bak"); + linkFile("/var/X11R6/bin/vmplayer", "/usr/bin/vmplayer"); + } + # the same with vmware, if ws is installed + if (-e "/usr/bin/vmware") { + rename("/usr/bin/vmware", "/usr/bin/vmware.slx-bak"); + } + # this kinda sucks. what if we have local installed vmplayer but + # plugin installed vmware workstation? what if we have a local + # installed vmware workstation but run plugin installed vmplayer + # without workstation. Link will go to nowhere... kinda ugly that + # /usr/ is ro. + # TODO: need to find a solution (if there is one possible with ro + # mounted /usr ...) + linkFile("/var/X11R6/bin/vmware", "/usr/bin/vmware"); + } sub removalPhase @@ -207,7 +228,7 @@ sub removalPhase # restore old start scripts - to be discussed my @files = qw( vmware vmplayer ); foreach my $file (@files) { - if (-e $file) { + if (-e "/usr/bin/$file.slx-bak") { unlink("/usr/bin/$file"); rename("/usr/bin/$file.slx-bak", "/usr/bin/$file"); } @@ -272,7 +293,7 @@ sub _writeWrapperScript if ($kind ne "local") { $script .= unshiftHereDoc(<<" End-of-Here"); export LD_LIBRARY_PATH=$vmpath/lib - export GTK_PIXBUF_MODULE_FILE=$vmpath/libconf/etc/gtk-2.0/gdk-pixbuf.loaders + export GDK_PIXBUF_MODULE_FILE=$vmpath/libconf/etc/gtk-2.0/gdk-pixbuf.loaders export GTK_IM_MODULE_FILE=$vmpath/libconf/etc/gtk-2.0/gtk.immodules export FONTCONFIG_PATH=$vmpath/libconf/etc/fonts export PANGO_RC_FILE=$vmpath/libconf/etc/pango/pangorc @@ -299,12 +320,12 @@ sub _writeWrapperScript } } -sub _wirteVmwareConfig { +sub _writeVmwareConfig { my $self = shift; my $kind = shift; my $vmpath = shift; - my $config = "libdir = \"$vmpath\""; + my $config = "libdir = \"$vmpath\"\n"; spitFile("$self->{'pluginRepositoryPath'}/$kind/config", $config); chmod 0755, "$self->{'pluginRepositoryPath'}/$kind/config"; @@ -396,20 +417,6 @@ sub _localInstallation $self->_writeWrapperScript("$vmpath", "$kind", "player") } - ## - ## replacement with our faster wrapper script - - # rename the default vmplayer script and copy it. remove function takes - # care about plugin remove. We only need this part if vmplayer - # or ws is installed on the local system - rename("/usr/bin/vmplayer", "/usr/bin/vmplayer.slx-bak"); - copyFile("$self->{'pluginRepositoryPath'}/$kind/vmplayer", "/usr/bin"); - # the same with vmware, if ws is installed - if (-e "/usr/bin/vmware") { - rename("/usr/bin/vmware", "/usr/bin/vmware.slx-bak"); - copyFile("$self->{'pluginRepositoryPath'}/$kind/vmware", "/usr/bin"); - } - } # else { TODO: errorhandling } } @@ -456,7 +463,7 @@ sub _vmpl2Installation { ## ## Creating needed config /etc/vmware/config - $self->_wirteVmwareConfig("$kind", "$vmpath"); + $self->_writeVmwareConfig("$kind", "$vmpath"); } diff --git a/os-plugins/plugins/vmware/XX_vmware.sh b/os-plugins/plugins/vmware/XX_vmware.sh index 3d3f3cc3..3cf8da6b 100644 --- a/os-plugins/plugins/vmware/XX_vmware.sh +++ b/os-plugins/plugins/vmware/XX_vmware.sh @@ -48,6 +48,7 @@ if [ -e /initramfs/plugin-conf/vmware.conf ]; then # should contain (seems to be an average one) echo -e "# configuration file for vmware background services written in \ stage3 setup" > /mnt/etc/vmware/slxvmconfig + echo "vmware_kind=${vmware_kind}" >> /mnt/etc/vmware/slxvmconfig if [ "$vmware_bridge" = 1 ] ; then echo "vmnet0=true" >> /mnt/etc/vmware/slxvmconfig fi @@ -232,22 +233,22 @@ $(ipcalc -m $vmip/$vmpx|sed s/.*=//) {" \ # TODO: perhaps we can a) kick out vmdir # b) configure vmdir by plugin configuration - # TODO: How to start it. See Wiki. Currently a) implemnted - # a) we get get information and start the programm with - # /var/X11R6/bin/run-vmware.sh "$imagename" "$name_for_vmwindow" \ - # "$ostype_of_vm" "$kind_of_network" - # b) we write a wrapper and get the xml-file as attribute ## Copy version depending files cp /mnt/opt/openslx/plugin-repo/vmware/${vmware_kind}/runvmware \ /mnt/var/X11R6/bin/run-vmware.sh chmod 755 /mnt/var/X11R6/bin/run-vmware.sh + cp /mnt/opt/openslx/plugin-repo/vmware/${vmware_kind}/vmplayer \ + /mnt/var/X11R6/bin/vmplayer + if [ -e /mnt/opt/openslx/plugin-repo/vmware/${vmware_kind}/vmware ]; then + cp /mnt/opt/openslx/plugin-repo/vmware/${vmware_kind}/vmware \ + /mnt/var/X11R6/bin/vmware + fi # affects only kernel and config depending configuration of not # local installed versions if [ "${vmware_kind}" != "local" ]; then - # TODO: setup up kernel files cp /mnt/opt/openslx/plugin-repo/vmware/${vmware_kind}/config \ /mnt/etc/vmware chmod 644 /mnt/etc/vmware/config diff --git a/os-plugins/plugins/vmware/files/install-vmpl2.0.sh b/os-plugins/plugins/vmware/files/install-vmpl2.0.sh index 1814fb67..d58d8d81 100644 --- a/os-plugins/plugins/vmware/files/install-vmpl2.0.sh +++ b/os-plugins/plugins/vmware/files/install-vmpl2.0.sh @@ -18,7 +18,7 @@ if [ "${REPLY}" == "YES" ]; then echo " * Downloading vmplayer now. This may take a while" cd /opt/openslx/plugin-repo/vmware/vmpl2.0 - wget -c http://download3.vmware.com/software/vmplayer/VMware-player-2.0.2-59824.i386.tar.gz + wget -q -c http://download3.vmware.com/software/vmplayer/VMware-player-2.0.2-59824.i386.tar.gz echo " * Unpacking vmplayer" tar xfz VMware-player-2.0.2-59824.i386.tar.gz @@ -48,7 +48,7 @@ if [ "${REPLY}" == "YES" ]; then root/lib/vmware/libconf/etc/gtk-2.0/gdk-pixbuf.loaders sed -i \ 's,/build/mts/.*/vmui/../libdir/libconf,/opt/openslx/plugin-repo/vmware/vmpl2.0/root/lib/vmware/libconf,' \ - root/lib/vmware/libconf/etc/gtk-2.0/gdk-immodules + root/lib/vmware/libconf/etc/gtk-2.0/gtk.immodules sed -i \ 's,/build/mts/.*/vmui/../libdir/libconf,/opt/openslx/plugin-repo/vmware/vmpl2.0/root/lib/vmware/libconf,' \ root/lib/vmware/libconf/etc/pango/pango.modules @@ -89,11 +89,14 @@ if [ "${REPLY}" == "YES" ]; then cd vmnet-only sed -i "s%^VM_UNAME = .*%VM_UNAME = $(ls /boot/vmlinuz*|grep -v -e "^/boot/vmlinuz$$"|sed 's,/boot/vmlinuz-,,'|sort|tail -n 1)%" Makefile make -s - cd .. + cd ../../../../../.. + + echo " * setting up EULA" + mv root/doc/EULA root/lib/vmware/share/EULA.txt # TODO: remove. just for debug reasons - echo "Press any return to process" - read + #echo "Press any return to process" + #read echo " * finishing installation" diff --git a/os-plugins/plugins/vmware/files/runvmware-player-v1 b/os-plugins/plugins/vmware/files/runvmware-player-v1 index d368e13d..e41dfcb5 100644 --- a/os-plugins/plugins/vmware/files/runvmware-player-v1 +++ b/os-plugins/plugins/vmware/files/runvmware-player-v1 @@ -451,9 +451,9 @@ writelog "Starting with $(echo ${np} | sed 's/i.*-//g')-mode ...\n" ## log disksetup writelog "Directories:" -writelog "\t\tTmpdir:\t\t${tmpdir}" +writelog "\tTmpdir:\t\t${tmpdir}" writelog "\tVMhome:\t\t${vmhome}" -writelog "\tTmpdir info:\t\t$(mount | grep -i "/tmp ")" +writelog "\tTmpdir info:\t$(mount | grep -i "/tmp ")" ## configuring MAC address: first four bytes are fixed (00:50:56:0D) the ## last two bytes are taken from the local network adaptor @@ -536,8 +536,11 @@ cp ${xml} /etc/vmware/fd-loop/config.xml sync # own nvram. We need it for floppy drive b, default nvram has just drive a -# TODO: optimize, currently kinda inefficient, too much copys -cp /opt/openslx/plugin-repo/vmware/*/nvram.5.0 ${tmpdir}/nvram +# TODO: optimize, currently kinda inefficient, too much copys, but we +# don't know which one is installed... +for i in /opt/openslx/plugin-repo/vmware/*; do + cp ${i}/nvram.5.0 ${tmpdir}/nvram +done # adjust volume writelog "Unmuting sound...\c" diff --git a/os-plugins/plugins/vmware/files/runvmware-player-v2 b/os-plugins/plugins/vmware/files/runvmware-player-v2 index d368e13d..e41dfcb5 100644 --- a/os-plugins/plugins/vmware/files/runvmware-player-v2 +++ b/os-plugins/plugins/vmware/files/runvmware-player-v2 @@ -451,9 +451,9 @@ writelog "Starting with $(echo ${np} | sed 's/i.*-//g')-mode ...\n" ## log disksetup writelog "Directories:" -writelog "\t\tTmpdir:\t\t${tmpdir}" +writelog "\tTmpdir:\t\t${tmpdir}" writelog "\tVMhome:\t\t${vmhome}" -writelog "\tTmpdir info:\t\t$(mount | grep -i "/tmp ")" +writelog "\tTmpdir info:\t$(mount | grep -i "/tmp ")" ## configuring MAC address: first four bytes are fixed (00:50:56:0D) the ## last two bytes are taken from the local network adaptor @@ -536,8 +536,11 @@ cp ${xml} /etc/vmware/fd-loop/config.xml sync # own nvram. We need it for floppy drive b, default nvram has just drive a -# TODO: optimize, currently kinda inefficient, too much copys -cp /opt/openslx/plugin-repo/vmware/*/nvram.5.0 ${tmpdir}/nvram +# TODO: optimize, currently kinda inefficient, too much copys, but we +# don't know which one is installed... +for i in /opt/openslx/plugin-repo/vmware/*; do + cp ${i}/nvram.5.0 ${tmpdir}/nvram +done # adjust volume writelog "Unmuting sound...\c" -- cgit v1.2.3-55-g7522