#!/bin/bash
echo "This the console installer of"
echo "www.radiproductions.com's VMware Server HowTo."
echo "This tool comes without any warranty"
echo ""
echo "* YOU NEED TO BE ROOT!!!"
echo "!WARNING! In order to successful build the server you"
echo "need the following packages installed:"
echo ">=wget-1.10.2"
echo -n "Enter full device path to *nix partition (i.e. /dev/hda1)"
read unixPartDev
echo -n "Enter full device path to swap partition (i.e. /dev/hda2)"
read swapPartDev
echo -n "Enter full device path to microsoft's (c) ntfs/fat partition (i.e. /dev/hda2)"
read winPartDev
echo -n "Enter full device path to cdrom device(i.e. /dev/hdc)"
read cdromDev
echo -n "Enter VMware Server 1.01 serial (format XXXXX-XXXXX-XXXXX-XXXXX)"
read vmServerSerial
echo -n "Enter kernel C header files (ie./usr/src/linux/include)"
read kernelHeaders
echo -n "Enter the username you want to create shortcuts"
read userName
#------------------------------
# starting script...
winPartMount=/mnt/windowsPartition
unixPartMount=/mnt/unixPartition
mkdir $swapPartMount
swapon $swapPartDev
mkdir $winPartMount
mount $winPart $winPartMount
mkdir $unixPartMount
mount $unixPartDev $unixPartMount
cd $winPartMount
wget
http://s3.amazonaws.com/puppy/devx_202.sfscp $winPartMount/devx_202.sfs $unixPartMount/devx_202.sfs
cd $unixPartMount
wget
http://www.puppyos.com/test/linux-2.6.1 ... tch.tar.gzwget
http://www.xinetd.org/xinetd-2.3.14.tar.gzwget
http://download3.vmware.com/software/vm ... 996.tar.gzwget
http://download3.vmware.com/software/vm ... 996.tar.gzgunzip *
tar -xf *
cd xinetd*
./configure --prefix=/usr --with-loadavg && make && make install
mkdir /etc/xinetd.d /etc/pam.d
>/etc/xinetd.conf
cd /etc/rc.d
mkdir rc0.d rc1.d rc2.d rc3.d rc4.d rc5.d rc6.d
cp -Rp /usr/src/linux/* $unixPartMount/linux
rm /usr/src/linux
ln -s $unixPartMount/linux /usr/src/linux
cd $unixPartMount/vmware-server-distrib
echo "Now inheriting VMware setup. For faster license"
echo "agreement press page down"
echo "When vmware setup is searching for suitable vmmon"
echo "module say 'yes' to built it!"
read dump
./vmware-install.pl -d
cd $kernelHeaders
echo "configure your network settings yourself!"
read dump2
cat /etc/ld.so.conf >> /lib/vmware/lib
ldconfig
cd $unixPartMount/vmware-mui-distrib # IS THIS CORRECT?
./mui-install.pl # IS THIS CORRECT?
cat /etc/rc.d/rc.local >> /etc/rc.d/./vmware start
cat /etc/rc.d/rc.local >> /etc/rc.d/./httpd.vmware start
ln -s /usr/bin/vmware /home/$userName/Desktop/VMware
# Dunno how to create icons
echo "Unfortunately, there's something to do by hand."
echo "Append the following lines to /root/.jwmrc."
echo "Note it must be within the <Root Menu> tag!"
echo ""
echo "<Program label="VMware Server" icon="/usr/share/icons/hicolor/48x48/apps/vmware-server.png">exec vmware</Program>"
cd $unixPartMount
mkdir pup devx savepup all newcd
# Please look at this, looks strange (dev_save exists???)
cp /initrd/mnt/dev_save/pup_save.3fs $unixPartMount/
mount -o loop $unixPartMount/pup_save.3fs savepup
mount -o loop $unixPartMount/pup_202.sfs pup
mount -o loop $unixPartMount/devx_202.sfs devx
mount -t unionfs -o dirs=devx:savepup:pup none all
/etc/rc.d/./httpd.vmware stop
/etc/rc.d/./vmware stop
rm $unixPartMount/savepup/cdrom
# NO WARRANTY
rm -r * $unixPartMount/savepup/root/$(ls * |grep -v ".vmware"|grep -v "/Choices")
rm $unixPartMount/savepup/etc/vmware/not_configured
rm -r * $unixPartMount/savepup/etc/$(ls * |grep -v "*vmware*"|grep -v "xinetd*"|grep -v "pam.d"|grep -v "rc.d"|grep -v "ls.so*")
rm -r * /mnt/data/savepup/etc/rc.d/$(ls * |grep -v "rc.local"|grep -v "*vmware*"|grep -v "rc*.d")
rm -r $unixPartMount/savepup/tmp/*
rm -r $unixPartMount/savepup/var/run/*
rm -r $unixPartMount/savepup/var/tmp/*
rm -r $unixPartMount/savepup/var/log/*
mksquashfs all $unixPartMount/newcd/pup_202.sfs
umount all savepup pup devx
rm $unixPartMount/pup_save.3fs
rm $unixPartMount/pup_202.sfs
cd $cdromDev
cp boot.cat boot.msg initrd.gz isolinux.bin isolinux.cfg vmlinuz $unixPartMount/newcd
mkisofs -o $unixPartMount/newpuppy.iso -b isolinux.bin -c boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table $unixPartMount/newcd
echo "exiting successfully..."
exit 0