Slackware This Forum is for the discussion of Slackware Linux.
|
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
|
06-29-2006, 06:36 PM
|
#16
|
LQ Newbie
Registered: Apr 2005
Posts: 4
Rep:
|
Awesome script! Worked like a charm
Thanks!!
|
|
|
07-20-2006, 02:58 PM
|
#17
|
Senior Member
Registered: May 2003
Location: Columbus, OH
Distribution: DIYSlackware
Posts: 1,914
Original Poster
Rep:
|
Yet another new script
2.6.17.x broke vmware... Suprise, suprise. This one will check for your running kernel and then determine whether or not to patch. These any-any updates are backwards compatable but I did it this way because I've noticed some people are adverse to the any-any updates. Not sure why. They are made by a VMware dev... So, unless your actually running kernel 2.6.17 when you run this script, it won't get patched.
Code:
#!/bin/sh
#
# After you install the resulting Slackware package, and then run
# vmware-config.pl, It will ask where certain directories are located.
# Take the default answer by hitting [ENTER]. It will also report that
# some files already exist. We have placed them in the default
# locations via this script so just hit [ENTER] to overwrite.
# Nobody likes cruft when you uninstall.
CWD=`pwd`
TMP=/tmp
PKG=$TMP/package-vmware
VERSION=5.5.1
VMWAREBUILD=19175
UPDATE=update101
ARCH=i386
BUILD=1
# Start VMware at boot? anything other than a 'no' means a 'yes'...
AUTOSTART=yes
# The system has to be clean:
if [ -a /var/log/packages/vmware* ]; then
echo
echo "Detected an existing install. Removing..."
removepkg /var/log/packages/vmware* > /dev/null 2>&1
fi
# Check for a tarball install. Really... We need it clean.
if [ -d /etc/vmware ]; then
if [ -a /usr/bin/vmware-uninstall.pl ]; then
echo
echo "Detected an existing install. Removing..."
perl /usr/bin/vmware-uninstall.pl > /dev/null 2>&1
fi
rm -rf /etc/vmware
fi
if [ -d /usr/lib/vmware ]; then
rm -rf /usr/lib/vmware
fi
# We need these on the system first:
# We'll clean up at the end
mkdir -p /etc/rc.d/init.d
mkdir -p /etc/rc.d/rc{0,1,2,3,4,5,6}.d
rm -rf $PKG
mkdir -p $PKG/{install,usr,etc/rc.d}
mkdir -p $PKG/usr/{lib,bin,doc,man/man1}
mkdir -p $PKG/usr/share/{applications,pixmaps,mime/packages,icons/hicolor}
cd $TMP
rm -rf vmware-distrib
echo
echo "VMware-workstation-$VERSION-$VMWAREBUILD.tar.gz is now extracting..."
echo
tar xzf $CWD/VMware-workstation-$VERSION-$VMWAREBUILD.tar.gz
cd vmware-distrib
# Temporarily disable the configurator. We
# want the user to run it, not the builder..
sed -i 's@vmware-config.pl@IGNORE-THIS-ERROR@g' bin/vmware-uninstall.pl
perl vmware-install.pl -d
# Change the configurator back:
sed -i 's@IGNORE-THIS-ERROR@vmware-config.pl@g' /usr/bin/vmware-uninstall.pl
echo
mv /usr/lib/vmware $PKG/usr/lib
mv /usr/doc/vmware $PKG/usr/doc
mv /usr/man/man1/vmware.1.gz $PKG/usr/man/man1
mv /etc/rc.d/init.d/vmware $PKG/etc/rc.d/rc.vmware
chmod 755 $PKG/etc/rc.d/rc.vmware
mv /usr/bin/vmware-* $PKG/usr/bin
mv /usr/bin/vmnet-* $PKG/usr/bin
mv /usr/bin/{vmrun,vmplayer,vm-support,vmware} $PKG/usr/bin
cp -a /etc/vmware $PKG/etc
# Remove misc cruft, if any...
sed -i 's@IGNORE-THIS-ERROR@vmware-config.pl@g' bin/vmware-uninstall.pl
perl bin/vmware-uninstall.pl > /dev/null 2>&1
# This makes it easier to access the documentation...
( cd $PKG/usr/doc/vmware
ln -sf ../../lib/vmware/help/workstation/index.htm Workstation
ln -sf ../../lib/vmware/help/player/player_index.htm Vmware-Player
ln -sf ../../lib/vmware/help-manual/index.htm General
sed -i 's@href="@href="file:///usr/lib/vmware/help/workstation/@g' $PKG/usr/lib/vmware/help/workstation/index.htm
sed -i 's@href="@href="file:///usr/lib/vmware/help/player/@g' $PKG/usr/lib/vmware/help/player/player_index.htm
sed -i 's@href="@href="file:///usr/lib/vmware/help-manual/@g' $PKG/usr/lib/vmware/help-manual/index.htm
# One of our links got changed that we didn't want to:
sed -i 's@file:///usr/lib/vmware/help/player/#top@#top@g' $PKG/usr/lib/vmware/help/player/player_index.htm )
# When the user runs the configurator, some more stuff will
# get dropped on the system. Not good if we're using pkgtool..
# Let's try and get as much as we can in place now so we
# don't have a bunch of cruft if/when we 'removepkg'
touch $PKG/usr/share/mime/packages/vmware.xml
# I've never heard of icon 'size directories' going straight into /usr/share/icons
sed -i 's@/usr/share/icons@/usr/share/icons/hicolor@g' $PKG/usr/bin/vmware-config.pl
cp -a $PKG/usr/lib/vmware/share/icons/48x48 $PKG/usr/share/icons/hicolor
cp -a $PKG/usr/share/icons/hicolor/48x48/apps/vmware-workstation.png $PKG/usr/share/pixmaps
cp -a $PKG/usr/share/icons/hicolor/48x48/apps/vmware-player.png $PKG/usr/share/pixmaps
# We need to have SyVinit directories everytime vmware-config.pl is run:
cat << EOF > $TMP/vmware-config-slack.patch
--- ./vmware-config.pl.orig 2005-03-23 06:54:21.000000000 -0500
+++ ./vmware-config.pl 2005-10-08 08:53:29.000000000 -0400
@@ -5,6 +5,11 @@
#
# Host configurator for VMware
+# Slackware setup:
+!mkdir -p /etc/rc.d/init.d!;
+!ln -sf /etc/rc.d/rc.vmware /etc/rc.d/init.d/vmware!;
+!mkdir -p /etc/rc.d/rc{0,2,3,5,6}.d!;
+
use strict;
# Use Config module to update VMware host-wide configuration file
@@ -8560,6 +8565,13 @@
show_PROMOCODE();
+ # Slackware cleanup:
+ !rm -f /etc/rc.d/init.d/vmware!;
+ !rmdir /etc/rc.d/init.d!;
+ !rm -f /etc/rc.d/rc{0,2,3,5,6}.d/K08vmware!;
+ !rm -f /etc/rc.d/rc{2,3,5}.d/S90vmware!;
+ !rmdir /etc/rc.d/rc{0,2,3,5,6}.d!;
+
print wrap('The configuration of ' . vmware_longname() . ' for this ' .
'running kernel completed successfully.' . "\n\n", 0);
if ((vmware_product() ne 'wgs') && (vmware_product() ne 'server')) {
EOF
# sed a cat'ed patch.
sed -i 's@!@`@g' $TMP/vmware-config-slack.patch
( cd $PKG/usr/bin
patch -Np1 -i $TMP/vmware-config-slack.patch
rm -f vmware-config.pl~ )
# Make the menu launchers:
cat << EOF > $PKG/usr/share/applications/vmware-workstation.desktop
[Desktop Entry]
Encoding=UTF-8
Name=VMware Workstation
Comment=Run virtual machines
Exec=vmware
Terminal=false
Type=Application
Icon=/usr/share/pixmaps/vmware-workstation.png
StartupNotify=true
Categories=Application;System;
X-Desktop-File-Install-Version=0.10
MimeType=application/x-vmware-vm;application/x-vmware-team;
EOF
cat << EOF > $PKG/usr/share/applications/vmware-player.desktop
[Desktop Entry]
Encoding=UTF-8
Name=VMware Player
Comment=Run a virtual machine
Exec=vmplayer
Terminal=false
Type=Application
Icon=/usr/share/pixmaps/vmware-player.png
StartupNotify=true
Categories=Application;System;
X-Desktop-File-Install-Version=0.10
MimeType=application/x-vmware-vm;
EOF
# Keep everything seperated for future upgrades:
( cd $PKG/usr/lib
mv vmware vmware-${VERSION}_${VMWAREBUILD}
ln -sf vmware-${VERSION}_${VMWAREBUILD} vmware
cd $PKG/usr/doc
mv vmware vmware-${VERSION}_${VMWAREBUILD}
ln -sf vmware-${VERSION}_${VMWAREBUILD} vmware )
# 54.8 Mb of Redhat 7.3 binaries are utterly useless:
rm -rf $PKG/usr/lib/vmware-${VERSION}_${VMWAREBUILD}/modules/binary/*
if [ "$AUTOSTART" = "no" ]; then
chmod 644 $PKG/etc/rc.d/rc.vmware
fi
# 2.16.7.x broke VMware. Check for your running kernel.
# FIXME: Check for greater than or equal to.
if [ `echo $(uname -r) | cut -d "." -f 1,2,3` = 2.6.17 ]; then
if [ ! -f $CWD/vmware-any-any-$UPDATE.tar.gz ]; then
cd $CWD
wget http://ftp.cvut.cz/vmware/vmware-any-any-$UPDATE.tar.gz
fi
cd $TMP
tar xzf $CWD/vmware-any-any-$UPDATE.tar.gz
mv vmware-any-any-$UPDATE/vm* $PKG/usr/lib/vmware/modules/source
rm -rf vmware-any-any-*
cat << EOF > $TMP/any-any-$UPDATE.patch
--- ./vmware-config.pl.orig 2006-07-20 13:59:21.000000000 -0400
+++ ./vmware-config.pl 2006-07-20 14:04:47.000000000 -0400
@@ -1966,6 +1966,7 @@
return '';
}
}
+ return !answer;
!header_page_offset = direct_command(
shell_string(!gHelper{'echo'}) . ' '
. shell_string('#define __KERNEL__' . "\n" . '#include <asm/page.h>'
EOF
sed -i 's@!@$@g' $TMP/any-any-$UPDATE.patch
cd $PKG/usr/bin
patch -Np1 -i $TMP/any-any-$UPDATE.patch
rm -f vmware-config.pl~
fi
cat << EOF > $PKG/install/slack-desc
# HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description. Line
# up the first '|' above the ':' following the base package name, and the '|' on
# the right side marks the last column you can put a character in. You must make
# exactly 11 lines for the formatting to be correct. It's also customary to
# leave one space after the ':'.
|-----handy-ruler--------------------------------------------------------|
vmware: vmware (Virtual Machine Software)
vmware:
vmware: VMware Workstation allows users to run multiple x86-based operating
vmware: systems, including Windows, Linux, and NetWare, and their applications
vmware: simultaneously on a single PC in fully networked, portable virtual
vmware: machines - no hard drive partitioning or rebooting required.
vmware:
vmware: Before running VMware Workstation for the first time, you need to
vmware: configure it by invoking the following command: vmware-config.pl
vmware:
vmware:
EOF
cat << EOF > $PKG/install/doinst.sh
# Append to /etc/rc.d/rc.local if it's
# not already there, commented or not...
if ! grep /etc/rc.d/rc.vmware /etc/rc.d/rc.local 1> /dev/null 2> /dev/null ; then
cat << EOF >> /etc/rc.d/rc.local
# Added by VMware install:
if [ -x /etc/rc.d/rc.vmware ]; then
/etc/rc.d/rc.vmware start
fi
EOF
echo 'EOF
fi
# Our .desktop has a MimeType:
if [ -x usr/bin/update-desktop-database ]; then
chroot . usr/bin/update-desktop-database 1>/dev/null 2>/dev/null
fi
# Update the icon cache:
ls -1 usr/share/icons | while read DIR
do
if [ -d "usr/share/icons/$DIR" ]; then
rm -f "usr/share/icons/$DIR/icon-theme.cache"
chroot . usr/bin/gtk-update-icon-cache "/usr/share/icons/$DIR" \
2>/dev/null 1>/dev/null
fi
done
# Begin Symlinks:' >> $PKG/install/doinst.sh
# Restore the system. If you already had SysVinit
# scripts in place, this won't harm anything.
rmdir /etc/rc.d/init.d
rm -f /etc/rc.d/rc{0,2,3,5,6}.d/K08vmware
rm -f /etc/rc.d/rc{2,3,5}.d/S90vmware
rmdir /etc/rc.d/rc{0,1,2,3,4,5,6}.d
# Remove the extracted source:
rm -rf $TMP/vmware-distrib
# Build the package:
cd $PKG
makepkg -l y -c n $TMP/vmware-${VERSION}_${VMWAREBUILD}-$ARCH-$BUILD.tgz
|
|
|
All times are GMT -5. The time now is 01:45 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|