Here is a VMware provisioning script shared by Charles Wyble:
createVmFuncs.sh
#!/bin/bash
#A script to automatically create and boot a vmware image. Supporting functions.
#Copyright Charles Wyble / Open Source Delivery Systems 2007 and later
#Licensed under GPLv2 only.
createVmDir()
{
echo "Creating new virtual machine directory..."
mkdir -p $IMAGE_PATH
}
createVmDisk()
{
echo "Creating disk for vm image..."
qemu-img create -f vmdk $VMDK_IMAGE ${DISK_SIZE} M
}
createVmxFile()
{
echo "Creating configuration file..."
}
createVm.sh
#!/bin/bash
#A script to automatically create and boot a vmware image
#Copyright Charles Wyble / Open Source Delivery Systems 2007 and later
#Licensed under GPLv2 only.
#User editable variables
BASE_PATH="/home/charles/vmtest" #Where your virtual machines live.
IMAGE_NAME="vmwareTest1" #What do you want your machine to be called.
IMAGE_PATH="$BASE_PATH/$IMAGE_NAME" #Used several places below for readability sake
DISK_SIZE="5000" #In kilobytes
PATH_TO_ISO="" #What iso will you be booting from. Leave blank for PXE boot.
VMDK_IMAGE="$IMAGE_PATH/$IMAGE_NAME.vmdk" #Your disk will live in this file.
#VMX_FILE=$IMAGE_PATH.vmx
#********************Don't modify anything below here unless you know what you are doing*************************#
source createVmFuncs.sh
#Start execution
#Do some error handling/checking
if [ ! -d $IMAGE_PATH ] ; then
createVmDir #Create the vm container
fi
if [ -f $IMAGE_PATH ] ; then
echo "Image already exists. Skipping creation."
else
createVmDisk #Create the disk image.
fi
#Creates the vmware configuration file.
createVmxFile
#Starts the virtual machine.
bootVm
bootVm()
{
echo "Booting vmware image...."
#vmware-cmd $VMX_FILE start
}
You can read his blog site or comment on his original post, here.