sh 自动安装VMware Tools for Mac OS X的静默安装

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh 自动安装VMware Tools for Mac OS X的静默安装相关的知识,希望对你有一定的参考价值。

#!/usr/bin/env bash

# 1 = VMware Tools ISO is mounted from vSphere
# 2 = Download VMware Tools (assumes you can connect to internet)
INSTALL_METHOD=2

# Thanks to Rich Trouton for tip on Tools being available online
VMWARE_TOOLS_DOWNLOAD_URL="http://softwareupdate.vmware.com/cds/vmw-desktop/fusion/7.1.2/2779224/packages/com.vmware.fusion.tools.darwin.zip.tar"

# DO NOT MODIFY BEYOND HERE #

VMWARE_TOOLS_INSTALLER_DIR="/Volumes/VMware Tools/Install VMware Tools.app/Contents/Resources"
VMWARE_TOOLS_INSTALLER_FILE="VMware Tools.pkg"

if [ $EUID -ne 0 ]; then
  echo "Please run the script with sudo ..."
  exit 1
fi

if [ ${INSTALL_METHOD} == "1" ]; then
  if [ -d "${VMWARE_TOOLS_INSTALLER_DIR}" ]; then
    /usr/sbin/installer -pkg "${VMWARE_TOOLS_INSTALLER_DIR}/${VMWARE_TOOLS_INSTALLER_FILE}" -target /
    echo "Please reboot the system for the installation to complete ..."
  fi
elif [ ${INSTALL_METHOD} == "2" ]; then
  TMP_DIR=/tmp/osx-vmware-tools
  mkdir -p "${TMP_DIR}"
  
  VMWARE_TOOLS_TAR_FILE=com.vmware.fusion.tools.darwin.zip.tar
  VMWARE_TOOLS_ZIP_FILE=com.vmware.fusion.tools.darwin.zip
  VMWARE_TOOLS_ISO_FILE="payload/darwin.iso"
  
  cd ${TMP_DIR}
  
  # Download VMware Tools from online repo
  curl -O "${VMWARE_TOOLS_DOWNLOAD_URL}"
  
  # Extract the VMware Tools tar file
  tar -xf "${VMWARE_TOOLS_TAR_FILE}"
  
  # Unzip the VMware Tools zip file
  unzip "${VMWARE_TOOLS_ZIP_FILE}"
  
  # Mount VMware Tools ISO (similiar to vSphere/ESXi)
  hdiutil attach "${VMWARE_TOOLS_ISO_FILE}"
  
  # Perform installation
  /usr/sbin/installer -pkg "${VMWARE_TOOLS_INSTALLER_DIR}/${VMWARE_TOOLS_INSTALLER_FILE}" -target /
  
  # Detach mount & clean up
  hdiutil detach '/Volumes/VMware Tools'
  rm -rf "${TMP_DIR}"
  echo "Please reboot the system for the installation to complete ..."
else
  echo "Invalid Selection"
fi

以上是关于sh 自动安装VMware Tools for Mac OS X的静默安装的主要内容,如果未能解决你的问题,请参考以下文章

vmware tools for linux安装失败

VMware Tools for Linux 增强功能安装

给新安装的RHEL8虚拟机 安装 vmware tools

Linux挂载:VMware tools for Linux安装

新人求助,关于vmware tools安装

VMware tools 我安装系统后、怎么不自动安装啊?