Skip to content

Instantly share code, notes, and snippets.

@amercier
Last active August 29, 2015 13:56
Show Gist options
  • Save amercier/9185219 to your computer and use it in GitHub Desktop.
Save amercier/9185219 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
if [ "`whoami`" != "root" ]; then
echo "You must execute this script as root" >&2
exit 1
fi
echo ".---------------------------."
echo "| VMware tools installation |"
echo "'---------------------------'"
cd /home \
&& (which aptitude > /dev/null && aptitude install gcc make linux-headers-amd64 || exit 0) \
&& (which yum > /dev/null && yum install gcc make kernel-headers perl tar || exit 0) \
&& (grep "blacklist i2c-piix4" /etc/modprobe.d/blacklist.conf >/dev/null || echo "blacklist i2c-piix4" >> /etc/modprobe.d/blacklist.conf) \
&& ([ -d /media/cdrom ] || mkdir -p /media/cdrom) \
&& ([ -e /media/cdrom/VMwareTools-*.tar.gz ] || mount /dev/cdrom /media/cdrom) \
&& tar xvfz /media/cdrom/VMwareTools-*.tar.gz \
&& cd vmware-tools-distrib/ \
&& ./vmware-install.pl --default \
&& cd /home \
&& rm -rf vmware-tools-distrib \
&& echo ".------------------------------------." \
&& echo "| VMware tools installed successfully |" \
&& echo "'------------------------------------'" \
&& echo -n 'VMware tools v' \
&& vmware-toolbox-cmd -v
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment