Skip to content

Instantly share code, notes, and snippets.

@dragon788
Forked from lamw/gist:bae9687faa14c7d7ee18
Created January 27, 2016 01:22
Show Gist options
  • Save dragon788/eb42335db2886639e099 to your computer and use it in GitHub Desktop.
Save dragon788/eb42335db2886639e099 to your computer and use it in GitHub Desktop.
Automate silent install of VMware Tools including enabling Automatic Kernel Module Update
#!/bin/bash
# Create temp workign directory
mkdir -p /mnt/vmw-tools
# Mount VMware Tools ISO
mount /dev/cdrom /mnt/vmw-tools
# Retrieve the VMware Tools package name from the directory
VMW_TOOLS=$(ls /mnt/vmw-tools/ | grep .gz)
# Copy VMware Tools package to /tmp
cp -f /mnt/vmw-tools/${VMW_TOOLS} /tmp/
# Unmount the VMware Tools ISO
umount /mnt/vmw-tools
# Clean up and remove temp mount directory
rmdir /mnt/vmw-tools
# Extract VMware Tools installer to /tmp
tar -zxvf /tmp/${VMW_TOOLS} -C /tmp/
# Change into VMware Tools installer directory
cd /tmp/vmware-tools-distrib/
# Create silent answer file for VMware Tools Installer
# If you wish to change which Kernel modules get installed
# The last four entries (no,no,yes,no) map to the following:
# VMware Host-Guest Filesystem
# vmblock enables dragging or copying files
# VMware automatic kernel modules
# Guest Authentication
# and you can also change the other params as well
cat > /tmp/answer << __ANSWER__
yes
/usr/bin
/etc
/etc/init.d
/usr/sbin
/usr/lib/vmware-tools
yes
/usr/share/doc/vmware-tools
yes
yes
no
no
yes
no
__ANSWER__
# Install VMware Tools and redirecting the silent instlal file
./vmware-install.pl < /tmp/answer
# Final clean up
rm -rf vmware-tools-distrib/
rm -f /tmp/${VMW_TOOLS}
cd ~
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment