------------------------------------------------------------------------------------------------------------------------ -- -- Workstation Bootstrap.lua -- ------------------------------------------------------------------------------------------------------------------------ -- Initialize Globals ------------------------------------------------------------------------------------------------------------------------ SaveMsiCommandLineValues() sProductName = "VMware Workstation" SaveSetting("product_name", sProductName) -- Set default hostd config values in case the user didn't temp = GetSetting("DATASTORE_PATH", ExpandPath("%COMMON_DOCUMENTS%/Shared Virtual Machines")) SaveSetting("DATASTORE_PATH", temp) temp = GetSetting("HOSTD_HTTPS_PORT", "443") SaveSetting("HOSTD_HTTPS_PORT", temp) WS = {} WS.Config = {} WS.Config.Features = {} -- global variable to track of vmAppControl functionalities bUseVMAppControl = true -- Core WS WS.Config.Features["core"] = { nSize = 3200, bRequired = true, bSelected = true, bHidden = false, sInstallDir = "C:\\BadPath", bInstallDir = true, sParent = "" } -- VMX WS.Config.Features["vix"] = { nSize = 120, -- size in mb of this feature bRequired = true, -- can the user deselect this feature bSelected = true, -- was the feature selected bHidden = false, -- should this feature be shown to the user? sInstallDir = "C:\\BadPath", -- where to install the feature bInstallDir = true, -- can the user change this? sParent = "" } -- Keyboard Driver WS.Config.Features["vmkbd"] = { nSize = 10, bRequired = false, bSelected = false, bHidden = false, sInstallDir = "C:\\BadPath", bInstallDir = false, sParent = "" } -- Visual Studio WS.Config.Features["vs_ivd"] = { nSize = 5, bRequired = false, bSelected = false, bHidden = false, sInstallDir = "", bInstallDir = false, sParent = "" } wsmsi = {} wsmsi = {filename = "VMwareWorkstation.msi", product_code = "{0D94F75A-0EA6-4951-B3AF-B145FA9E05C6}", upgrade_code = "{14F539F3-C4A4-4597-A29D-8C1D753ACC93}", package_code = "{3E2BA1C0-F04F-4166-A2DE-0E1BAABE5753}", properties = {}, version = {major = 11, minor = 1, point = 2, build = 0}} wsmsi.uninstall_on_rollback = true wsmsi.use_internal_ui = false wsmsi.compare_tuple = 4 arpEdits = {} arpEdits.ws_msi = {key = "{0D94F75A-0EA6-4951-B3AF-B145FA9E05C6}"} arpEdits.ws = { key = "VMware_Workstation", product = "VMware Workstation", display_name = "VMware Workstation", display_version = "11.1.2", publisher = "VMware, Inc", help_link = "http://www.vmware.com/", estimated_size = 3412864} appInfows30 = { appname = "VMware Workstation 3.x", registry = { ["HKLM:SOFTWARE/Microsoft/Windows/CurrentVersion/Uninstall/VMware Workstation:DisplayName"] = "exists" } } wsmsi40 = { product_code = "{233A935E-6132-48B2-840F-37C9D32555D5}", package_code = "{46F73961-902A-4A20-BB36-5060DC6ACB2C}", upgrade_code = "{2A0F937B-3E75-47D8-9306-14D45CC0F756}", version = {major = 4, minor = 0, point = 0, build = 0} } -- CDS Components CDSCompTable = {} CDSCompTable[1] = "tools-freebsd-9.9.3.exe" CDSCompTable[2] = "tools-linux-9.9.3.exe" CDSCompTable[3] = "tools-netware-9.9.3.exe" CDSCompTable[4] = "tools-solaris-9.9.3.exe" CDSCompTable[5] = "tools-windows-9.9.3.exe" CDSCompTable[6] = "tools-winPre2k-9.9.3.exe" ------------------------------------------------------------------------------------------------------------------------ -- Helper Functions ------------------------------------------------------------------------------------------------------------------------ -- ------------------------------------------------------------------------------- -- -- SystemCleanUp -- -- Remove all MSI db entries and product registry entries -- ------------------------------------------------------------------------------- -- function SystemCleanUp() UISequence({page="system_cleanup_prompt"}) if GetSettingA("system_cleanup", "0") == "1" then Log("--- removing MSI database keys") DeleteMSIInstallerKeys(wsmsi.product_code) Log("--- deleting uninstaller registry keys") DeleteRegistry({hive = "HKLM", key = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\" .. wsmsi.product_code}) Log("--- deleting product specific registry keys") DeleteRegistry({hive = "HKLM", key = "SOFTWARE\\VMware, Inc.\\VMware Workstation"}) DeleteRegistry({hive = "HKLM", key = "SOFTWARE\\VMware, Inc.", value = "Core"}) UISequence({page = "finish"}) end end -- ------------------------------------------------------------------------------- -- -- CheckSystemPrereqs -- -- Checks to see that the system meets the prereqs for Workstation -- Checks for several cpu features including cmov, paw, tsc, fxsave -- ------------------------------------------------------------------------------- -- function CheckSystemPrereqs() tOSInfo = SystemAnalysis() Log(string.format("Running on windows %f:%f:%dbit build:%d", tOSInfo.version, tOSInfo.sp, tOSInfo.bitness, tOSInfo.build_number)) Log(string.format("CPU CMOV[%s] PAE[%s] TSC[%s] FXSAVE[%s] 64BITVMM[%s]", tostring(tOSInfo.supports_cmov), tostring(tOSInfo.supports_pae), tostring(tOSInfo.supports_tsc), tostring(tOSInfo.supports_fxsave), tostring(tOSInfo.supports_64bit_vmm))) -- Workstation installation is supported on 64bit Vista SP1 or newer OSes Assert(tOSInfo.bitness == 64 and tOSInfo.version > 6.0, 41, "Attempting to install Workstation on an unsupported operating system.") Assert(tOSInfo.supports_cmov and tOSInfo.supports_pae and tOSInfo.supports_tsc and tOSInfo.supports_fxsave and tOSInfo.supports_64bit_vmm, 47, "Attempting to install Workstation on an unsupported CPU.") if ((tOSInfo.major_version == 6 and tOSInfo.minor_version >= 1) or tOSInfo.major_version > 6) then SaveSetting("hide_quicklaunch_shortcut", "1") end return tOSInfo end -- ------------------------------------------------------------------------------- -- -- CheckForSettingsFiles -- -- Checks to see if config.ini or settings.ini files from previous workstation -- installations exist in the app data folder, defaults to saving files on -- uninstall -- ------------------------------------------------------------------------------- -- function CheckForSettingsFiles() SaveSetting("ws_remove_settings", "0") appInfo.tVMConfigIni = { appname = "VMware Workstation Config.ini", paths = { ["%COMMON_APPDATA%/VMware/VMware Workstation/config.ini"] = "exists", ["%COMMON_APPDATA%/VMware/VMware Workstation/config.ini"] = "size > 0" } } appInfo.tVMSettingsIni = { appname = "VMware Workstation Settings.ini", paths = { ["%COMMON_APPDATA%/VMware/VMware Workstation/settings.ini"] = "exists", ["%COMMON_APPDATA%/VMware/VMware Workstation/settings.ini"] = "size > 0" } } if (AppSearch(appInfo.tVMConfigIni) or AppSearch(appInfo.tVMSettingsIni)) then SaveSetting("ws_settings_exist", "1") Log("--- Found WS configuration files") else SaveSetting("ws_settings_exist", "0") Log("--- NO WS configuration files") end end -- ------------------------------------------------------------------------------- -- -- CheckForLicenseFiles -- -- Checks to see if there's any valid license in the registry -- Defaults to saving license information on uninstall -- -- NOTE: "ws_remove_licenses" is not referenced by a silent install/uninstall -- ------------------------------------------------------------------------------- -- function CheckForLicenseFiles() SaveSetting("ws_remove_licenses", "0") tLicenseEntries = ReadLicenseList("VMware, Inc.", "VMware Workstation") if (next(tLicenseEntries, nil) ~= nil) then SaveSetting("ws_licenses_exist", "1") Log("--- Found VMware licenses") else SaveSetting("ws_licenses_exist", "0") Log("--- Did not find any VMware licenses") end end -- ------------------------------------------------------------------------------- -- -- CheckForPreviouslyPrompted -- -- Checks to see if we already prompted the user for some data -- ------------------------------------------------------------------------------- -- function CheckForPreviouslyPrompted() if (not HasSetting("autoSoftwareUpdateEnabled")) then Log("--- Software Update info has not been stored, prompt") SaveSetting("prompt_softwareupdate", "1") else Log("--- Software Update previously prompted, don't prompt again") SaveSetting("prompt_softwareupdate", "0") end if (not HasSetting("dataCollectionEnabled")) then Log("--- Data collection info has not been stored, prompt") SaveSetting("prompt_datacollection", "1") else Log("--- Data collection previously prompted, don't prompt again") SaveSetting("prompt_datacollection", "0") end end -- ------------------------------------------------------------------------------- -- -- CheckForVisualStudio -- -- Quick check to see if Visual Studio 2005, 2008, 2012, or 2013 is installed -- ------------------------------------------------------------------------------- -- function CheckForVisualStudio() appInfoVS80 = { appname = "Visual Studio 2005(8.0)", registry = { ["HKCR:VisualStudio.DTE.8.0"] = "exists" } } appInfoVS90 = { appname = "Visual Studio 2008(9.0)", registry = { ["HKCR:VisualStudio.DTE.9.0"] = "exists" } } appInfoVS100 = { appname = "Visual Studio 2010(10.0)", registry = { ["HKCR:VisualStudio.DTE.10.0"] = "exists" } } appInfoVS110 = { appname = "Visual Studio 2012(11.0)", registry = { ["HKLM:SOFTWARE/Microsoft/VisualStudio/11.0"] = "exists" } } appInfoVS120 = { appname = "Visual Studio 2013(12.0)", registry = { ["HKLM:SOFTWARE/Microsoft/VisualStudio/12.0"] = "exists" } } return AppSearch(appInfoVS80) or AppSearch(appInfoVS90) or AppSearch(appInfoVS100) or AppSearch(appInfoVS110) or AppSearch(appInfoVS120) end -- ------------------------------------------------------------------------------- -- -- CheckForKeyboardDriver -- -- A simple check to see if the keyboard driver is installed on the system. -- If found, the keyboard driver feature is selected by default. -- Otherwise, the keyboard driver feature is unselected by default. -- ------------------------------------------------------------------------------- -- function CheckForKeyboardDriver() installDir = GetSettingA("install_dir", "") if (installDir) then appInfoKeyboard = { appname = "vmkbd.sys", paths = { [installDir .. "/vmkbd.sys"] = "exists" } } if (AppSearch(appInfoKeyboard)) then Log("--- Found existing keyboard driver") WS.Config.Features["vmkbd"].bSelected = true return end end Log("--- No keyboard driver found") WS.Config.Features["vmkbd"].bSelected = false end -- ------------------------------------------------------------------------------- -- -- CheckForRunningProcesses -- -- Checks to see if there are any VMware products or IDEs or applications that -- create a network configuration lock currently running and prompts the user -- to shut them down before proceeding with an install or uninstall -- ------------------------------------------------------------------------------- -- function CheckForRunningProcesses() bHasRunningProcess = true bVMware = true bVMwareWS = true bVMwarePlayer = true bVMwareACEPlayer = true bVMwareVM = true bVisualStudio = true bNetCfgLock = true bVMAppControl = bUseVMAppControl and IsVMAppControlAvailable("WS") outPropNames = {} outPropNames["1"] = "VMwareWSRunning" outPropNames["2"] = "VMwarePlayerRunning" outPropNames["3"] = "VMwareACEPlayerRunning" while (bHasRunningProcess) do bVMware = CheckRunningProcesses("vmware-vmx.exe", "vmware-vmx-debug.exe", "vmware-vmx-stats.exe", "vmnetcfg.exe", "vmware.exe", "vmplayer.exe") bVisualStudio = CheckRunningProcesses("devenv.exe") and WS.Config.Features["vs_ivd"].bSelected bNetCfgLock = (SafeToInstallNetwork() == 3) if (bVMAppControl) then Log("-- Using vmAppControl to detect running processes --") VMAppListVMs("WS", "VMwareVMsRunning") VMAppListApps("WS", outPropNames) bVMwareWS = HasSetting(outPropNames["1"]) bVMwarePlayer = HasSetting(outPropNames["2"]) bVMwareACEPlayer = HasSetting(outPropNames["3"]) bVMwareVM = HasSetting("VMwareVMsRunning") else Log("-- Using running processes to detect existing applications --") bVMwareWS = CheckRunningProcesses("vmware.exe") bVMwarePlayer = CheckRunningProcesses("vmplayer.exe") bVMwareACEPlayer = false bVMwareVM = false end -- check to see if WS or Player is running bHasRunningProcess = (bVMware or bVMwareVM or bVMwareWS or bVMwarePlayer or bVMwareACEPlayer or bVisualStudio or bNetCfgLock) if (bHasRunningProcess) then if (bVMAppControl and (bVMwareVM or bVMwareWS or bVMwarePlayer or bVMwareACEPlayer)) then if GetSettingA("force_silent", "0") == "1" then -- We are running a silent install/uninstall, log that a process is running and exit the installer Log("ERROR: --- The installer has detected that VMware application is running on this machine. The user needs to close all VMware applications before continuing.") -- Since we're in silent mode and we can't kill the processes just assert with and unknown error Assert(false, 1, "Unable to deal with running processes in silent mode") end -- One of the processes is running, prompt the user to shut them down before trying again UISequence({page="running_vmapp_prompt"}) VMAppShutdownVMs("WS") VMAppShutdownApps("WS") -- check to see if we successfully shut down everything VMAppListVMs("WS", "VMwareVMsRunning") VMAppListApps("WS", outPropNames) if (HasSetting(outPropNames["1"]) or HasSetting(outPropNames["2"]) or HasSetting(outPropNames["3"]) or HasSetting("VMwareVMsRunning")) then Log("ERROR: --- Unable to shut down VMs or apps using vmAppControl calls, do not attempt again") bUseVMAppControl = false bVMAppControl = false end else if GetSettingA("force_silent", "0") == "1" then -- We are running a silent install/uninstall, log that a process is running and exit the installer if (bVMware or bVMwareVM or bVMwareWS or bVMwarePlayer or bVMwareACEPlayer) then Log("ERROR: --- VMware software is running on this machine. The user needs to power off or suspend all virtual machines and close all VMware applications before continuing.") elseif bVisualStudio == true then Log("ERROR: --- The installer has detected that Visual Studio is running on this machine. The user needs to shut down this application before continuing.") elseif bNetCfgLock == true then Log("ERROR: --- The installer has detected that Network Configuration is locked on this machine. The user needs to close network config application before continuing.") end -- Since we're in silent mode and we can't kill the processes just assert with and unknown error Assert(false, 1, "Unable to deal with running processes in silent mode") end -- One of the processes is running, prompt the user to shut them down before trying again if (bVMware or bVMwareVM or bVMwareWS or bVMwarePlayer or bVMwareACEPlayer) then SaveSetting("VMware Process Running", "1") elseif bVisualStudio then SaveSetting("Visual Studio Process Running", "1") elseif bNetCfgLock then SaveSetting("Net Config Lock", "1") end UISequence({page="running_process_prompt"}) end end end end -- ------------------------------------------------------------------------------- -- -- InstallCDSComponents -- -- Install all the bundled CDS components -- ------------------------------------------------------------------------------- -- function InstallCDSComponents() Log("==== Start installing all CDS components") for compIndex, compInstaller in ipairs(CDSCompTable) do Log(string.format("Installing CDS Component [%d][%s]", compIndex, compInstaller)) UnpackFiles(compInstaller) Run(compInstaller, "--DisableCWD --debug", {foil_unlock = true}) end Log("==== All CDS components have been installed") end -- ------------------------------------------------------------------------------- -- -- UninstallCDSComponents(): -- Removes all the installed CDS components -- ------------------------------------------------------------------------------- -- function UninstallCDSComponents() Log("==== Start uninstalling all CDS components") CDSComponents = FindInstalledCDSComponents("VMware Workstation") for compName,compValues in pairs(CDSComponents) do currentComp = {filename = compValues.ProductName, product_code = compValues.ProductCode} UninstallMSI(currentComp, "") end Log("==== All CDS components have been uninstalled") end -- ------------------------------------------------------------------------------- -- -- InstallWS(): -- Initailzes the properties in the provided table with the values stored -- in the SettingsDB, then installs the msi and sets up the foil resident -- ------------------------------------------------------------------------------- -- function InstallWS(wsmsi) wsmsi.properties.INSTALLDIR = WS.Config.Features["core"].sInstallDir wsmsi.properties.VIX_DIR = WS.Config.Features["vix"].sInstallDir wsmsi.properties.REBOOT = "ReallySuppress" wsmsi.properties.DESKTOP_SHORTCUT = GetSetting("DESKTOP_SHORTCUT", "1") wsmsi.properties.QUICKLAUNCH_SHORTCUT = GetSetting("QUICKLAUNCH_SHORTCUT", "1") wsmsi.properties.STARTMENU_SHORTCUT = GetSetting("STARTMENU_SHORTCUT", "1") wsmsi.properties.REMOVE = "" wsmsi.properties.AUTOSOFTWAREUPDATE = GetSetting("autoSoftwareUpdateEnabled", "1") wsmsi.properties.COMPONENTDOWNLOAD = GetSetting("componentDownloadEnabled", "1") wsmsi.properties.DATACOLLECTION = GetSetting("dataCollectionEnabled", "1") temp = GetSetting("DATASTORE_PATH", "") wsmsi.properties.DATASTORE_PATH = SanitizePath(temp) wsmsi.properties.HOSTD_HTTPS_PORT = GetSetting("HOSTD_HTTPS_PORT", "") wsmsi.properties.EULAS_AGREED = GetSetting("accepted_eula", "0") -- Don't pass the TRANSFORMS property if it's English (1033). The MSIs are -- English by default, and don't have a 1033 mst packed into the -- _Storages table. locale = GetSettingA("locale", "1033") -- XXX: Since the move to WiX, passing the TRANSFORMS property doesn't work. --- Leave this property out, and fix it later. -- if locale ~= "1033" then -- wsmsi.properties.TRANSFORMS = ":" .. A(locale) -- end if wsmsi.properties.ADDLOCAL == nil then wsmsi.properties.ADDLOCAL = "ALL" end if not WS.Config.Features["vs_ivd"].bSelected then wsmsi.properties.REMOVE = "VisualStudio" end if not WS.Config.Features["vmkbd"].bSelected then if wsmsi.properties.REMOVE ~= "" then wsmsi.properties.REMOVE = wsmsi.properties.REMOVE .. "," end wsmsi.properties.REMOVE = wsmsi.properties.REMOVE .. "Keyboard" end InstallMSI(wsmsi) path, uninstaller = CreateUninstaller("bootstrap.lua", "ui.pkg", "ws.ico", "common.lua", "module_core.dll", "module_license.dll", "instUtils.dll", "module_ws.dll", "vminstutil.dll", "vnetlib.dll", "vnetlib.exe", "vnetlib64.dll", "vnetlib64.exe", "deleter.exe", "uninstall.exe") uninstaller = A(path) .. "\\uninstall.exe" SaveSetting("uninstaller", uninstaller) PersistSettings(sProductName, "uninstaller", "DESKTOP_SHORTCUT", "QUICKLAUNCH_SHORTCUT", "STARTMENU_SHORTCUT", "dataCollectionEnabled", "autoSoftwareUpdateEnabled", "DATASTORE_PATH", "HOSTD_HTTPS_PORT") arpEdits.ws.install_location = wsmsi.properties.INSTALLDIR; UpdateAndAddFoilARPEntry(arpEdits.ws_msi, arpEdits.ws, "\"" .. A(uninstaller) .. "\" -x -S \"" .. A(path) .. "\"", A(path) .. "ws.ico") InstallCDSComponents() RunBatchInstallers() if (sAction ~= "repair") then UnpackFiles("instUtils.dll") nResult = NeedValidLicense() Log(string.format("--- LicenseCheck[%d]",nResult)) if (nResult ~= 0) then serialnumber = GetSettingA("SERIALNUMBER","") if GetSettingA("force_silent", "0") == "1" and serialnumber ~= "" then -- We're doing a silent install, and SERIALNUMBER is defined ValidateSerialNumber("", "", serialnumber) else Log("Do the Serial dialog") UISequence({page = "serial_prompt"}) end end end end -- ------------------------------------------------------------------------------- -- -- ModifyWS(
): -- Sets up the properties in the table to modify the current installation -- then calls the msi to implement the requested changes. -- ------------------------------------------------------------------------------- -- function ModifyWS(wsmsi) wsmsi.properties.INSTALLDIR = WS.Config.Features["core"].sInstallDir wsmsi.properties.VIX_DIR = WS.Config.Features["vix"].sInstallDir wsmsi.properties.REBOOT = "ReallySuppress" wsmsi.properties.REMOVE = "" if wsmsi.properties.ADDLOCAL == nil then wsmsi.properties.ADDLOCAL = "ALL" end if not WS.Config.Features["vs_ivd"].bSelected then wsmsi.properties.REMOVE = "VisualStudio" end if not WS.Config.Features["vmkbd"].bSelected then if wsmsi.properties.REMOVE ~= "" then wsmsi.properties.REMOVE = wsmsi.properties.REMOVE .. "," end wsmsi.properties.REMOVE = wsmsi.properties.REMOVE .. "Keyboard" end InstallMSI(wsmsi) end -- ------------------------------------------------------------------------------- -- -- RepairWS(
): -- Sets up the properties in the table to repair the current installation -- then calls InstallWS to set the remainder of the properties and re-install -- the workstation -- ------------------------------------------------------------------------------- -- function RepairWS(wsmsi) wsmsi.properties.REINSTALL = "ALL" wsmsi.properties.REINSTALLMODE = "vomus" wsmsi.properties.ADDLOCAL = "ALL" if GetSettingA("install_vs_plugin", "1") == "1" then wsmsi.properties.ADDLOCAL = wsmsi.properties.ADDLOCAL .. ",VisualStudio" end InstallWS(wsmsi) end -- ------------------------------------------------------------------------------- -- -- UninstallWS(
): -- Removes all the installed CDS components, then uninstalls workstation -- and cleans up the foil resident -- ------------------------------------------------------------------------------- -- function UninstallWS(tMSI, sMSIProperties) -- Uninstall CDS components that were installed by workstation UninstallCDSComponents() -- retrieve data save settings sMSIProperties = A(sMSIProperties) .."REBOOT=ReallySuppress " -- If we're running a silent install don't try to overwrite what the user might have passed in if GetSettingA("force_silent", "0") == "1" then -- Read the properties from the command-line sMSIProperties = sMSIProperties .. "REMOVE_SETTINGFILES=" .. GetSettingA("REMOVE_SETTINGFILES", "0") .. " " sMSIProperties = sMSIProperties .. "REMOVE_LICENSE=" .. GetSettingA("REMOVE_LICENSE", "0") .. " " else -- Read the properties from the user's UI choices sMSIProperties = sMSIProperties .. "REMOVE_SETTINGFILES=" .. GetSettingA("ws_remove_settings", "0") .. " " sMSIProperties = sMSIProperties .. "REMOVE_LICENSE=" .. GetSettingA("ws_remove_licenses", "0") .. " " end -- Uninstall workstation UninstallMSI(tMSI, sMSIProperties) -- Cleanup the foil resident RemoveFoilARPEntry(arpEdits.ws) RemoveUninstaller() SaveSetting("uninstaller", "") PersistSettings(sProductName, "uninstaller") end -- ------------------------------------------------------------------------------- -- -- RunBatchInstallers(): -- Run the batched installers if they are specified on the command line -- ------------------------------------------------------------------------------- -- function RunBatchInstallers() Log("==== Start installing batched installers") BatchInstallers = GetBatchInstallers() for installerName,installerValues in pairs(BatchInstallers) do -- Log(string.format(" ==== installing [%s][%s]", installerValues.Name, installerValues.Exe)) Log(" ==== installing [%s][%s]") Log(installerValues.Name) Log(installerValues.Exe) Run(installerValues.Exe, "--DisableCWD --debug", {foil_unlock=true, use_external_exe=true}) end CleanUpBatchInstallerCache() Log("==== All batched installers completed") end ------------------------------------------------------------------------------------------------------------------------ --====================================================================================================================== ------------------------------------------------------------------------------------------------------------------------ --====================================================================================================================== ------------------------------------------------------------------------------------------------------------------------ -- -- Setup Script -- ------------------------------------------------------------------------------------------------------------------------ --====================================================================================================================== ------------------------------------------------------------------------------------------------------------------------ --====================================================================================================================== ------------------------------------------------------------------------------------------------------------------------ -- -- Do some basic checks, initialize the locale, and unpack required files and show the splash screen -- VerifyUserIsAdmin() InitializeLocale(1033, 1041, 2052) UnpackPackages("ui.pkg", "ui_images.pkg") UnpackFiles("vminstUtil.dll") UnpackFilesRegex("vnetlib.*") ShowUI({title = "VMware Workstation Setup", file = "index.htm", page = "splash"}) Import("module_core.dll") Import("module_ws.dll") Import("module_license.dll") Include("common.lua") sAction = GetSettingA("action", "unknown") sMSIActionDetails = "" if sAction == "clean" then SystemCleanUp() return end -- We don't need to check system requirements (and potentially block) the installer if it's already been successfully installed if sAction ~= "uninstall" and sAction ~= "maintenance" then CheckSystemPrereqs() end GetAllStoredSettings(sProductName) -- Set default install paths if they already exist in the registry install_dir = ReadRegistry("HKLM", "Software\\VMware, Inc.\\VMware Workstation", "InstallPath") if install_dir ~= nil and A(install_dir) ~= "" then SaveSetting("install_dir", install_dir) end vix_install_dir = ReadRegistry("HKLM", "Software\\VMware, Inc.\\VMware VIX", "InstallPath") if vix_install_dir ~= nil and A(vix_install_dir) ~= "" then SaveSetting("vix_install_dir", vix_install_dir) end CheckForRunningProcesses() CheckForSettingsFiles() CheckForLicenseFiles() CheckForPreviouslyPrompted() msiName = "VMwareWorkstation.msi" if sAction == "unknown" or sAction == "install" then sMSIAction, sMSIActionDetails, tSystemMSIData = GetMSIState(wsmsi); sMSIAction = A(sMSIAction) sMSIActionDetails = A(sMSIActionDetails) sProductsToUninstall = "" sOldAction, sJunk2, tSystemOldMSIData = GetMSIState(wsmsi40); if A(sOldAction) ~= "install" then sMSIAction = "upgrade" end SaveSetting("action", sMSIAction) sAction = sMSIAction tMSIData = {} for k,v in pairs(tSystemOldMSIData) do tMSIData[k] = v end for k,v in pairs(tSystemMSIData) do tMSIData[k] = v end for name, value in pairs(tMSIData) do SaveSetting(value.product_code, A(value.product_name) .. ";" .. A(value.version_string)) sProductsToUninstall = sProductsToUninstall .. ";" .. A(value.product_code) end SaveSetting("products_to_uninstall", sProductsToUninstall) elseif sAction == "upgrade_uninstall" then ShowUI({page = "progress"}) UninstallWS(wsmsi, "VM_UPGRADE_UNINSTALL=1 ") return elseif sAction == "cross_uninstall" then ShowUI({page = "progress"}) UninstallWS(wsmsi, "") return end if sAction == "downgrade" then UISequence({page = "downgrade_prompt"}) return end -- not allow user to change WS install directory in maintenance mode if sAction == "maintenance" then WS.Config.Features["core"].bInstallDir = false WS.Config.Features["vix"].bInstallDir = false CheckForKeyboardDriver() end -- If we're not in maintenance mode and need a reboot then prompt the user about it if sAction ~= "maintenance" and RebootCheck() then CheckSystemPrereqs() Log("--- Detected reboot required before we should continue with current installer...") if GetSettingA("force_silent", "0") == "0" then UISequence({page = "reboot_prompt"}) initiateReboot = GetSettingA("start_reboot", "1") == "1" StartReboot(true, initiateReboot) else StartReboot(true, true) end end if AppSearch(appInfows30) then UISequence({page="manual_uninstall_prompt"}) return end if sAction == "upgrade" then CheckSystemPrereqs() UISequence({page="uninstall_prompt"}) CheckForRunningProcesses() sUninstaller = A(GetStoredSetting(sProductName, "uninstaller")) if sUninstaller == "" then sUninstaller = A(GetStoredSetting("VMware Player", "uninstaller")) end if sUninstaller ~= "" then sSilentCommand = "" if GetSettingA("force_silent", "0") == "1" then sSilentCommand = "-s -nsr" end uninstallResult = 0 sUninstallerPath = A(string.gsub(sUninstaller, "uninstall.exe", "")) if sMSIActionDetails == "cross product" then uninstallResult = Run(sUninstaller, sSilentCommand .. " -z action=cross_uninstall" .. " -S \"" .. sUninstallerPath .. "\"", {foil_unlock = true}) else uninstallResult = Run(sUninstaller, sSilentCommand .. " -z action=upgrade_uninstall" .. " -S \"" .. sUninstallerPath .. "\"", {foil_unlock = true}) end if uninstallResult ~= 0 then Log(string.format("ERROR: Uninstall failed with return value %d", uninstallResult)) return end else UninstallCDSComponents() for name, value in pairs(tMSIData) do if A(value.product_name) == sProductName then Log("--- Product Names match, but no previous supported foil installation") UninstallMSI({filename = value.product_name, product_code = value.product_code}, 'VM_UPGRADE_UNINSTALL=1 REMOVE_LICENSE=0 REMOVE_SETTINGFILES=0 REBOOT="ReallySuppress"') else UninstallMSI({filename = value.product_name, product_code = value.product_code}, 'REBOOT="ReallySuppress"') end end end wsmsi.properties.VM_UPGRADE_INSTALL = 1 sAction = "install" SaveSetting("action", sAction) end if sAction ~= "maintenance" and RebootCheck() then Log("--- Prepare for reboot after uninstall...") if GetSettingA("force_silent", "0") == "0" then UISequence({page = "reboot_prompt"}) initiateReboot = GetSettingA("start_reboot", "1") == "1" StartReboot(true, initiateReboot, "-v VM_UPGRADE_INSTALL=1") else StartReboot(true, true, "-v VM_UPGRADE_INSTALL=1") end end -- Setup the default feature install paths if install_dir ~= nil and A(install_dir) ~= "" then WS.Config.Features["core"].sInstallDir = install_dir else WS.Config.Features["core"].sInstallDir = PickDefaultInstallDirectory("VMware\\VMware Workstation", 800000000) end if vix_install_dir ~= nil and A(vix_install_dir) ~= "" then WS.Config.Features["vix"].sInstallDir = vix_install_dir else WS.Config.Features["vix"].sInstallDir = PickDefaultInstallDirectory("VMware\\VMware VIX", 300000000) end WS.Config.Features["vs_ivd"].bSelected = CheckForVisualStudio() ------------------------------------------------------------------------------------------------------------------------ -- Unpack required files -- if FileExists(msiName) then UnpackFiles(msiName) end -- This property is used to determine if we are being called from ARP (if we are, the original MSI won't be present) SaveSetting("ws_msi_present", tostring(FileExists(msiName))) CheckForHostdConfigFiles() GetFeatureInfo("VMware Workstation", WS.Config.Features) UISequence({page = "welcome"}) CheckForRunningProcesses() sAction = GetSettingA("action") if sAction == "install" then CheckSystemPrereqs() -- Before installing Workstation we need to install the VC9 runtime libraries UnpackFiles("vcredist_x86.exe") Run("vcredist_x86.exe", "/q") UnpackFiles("vcredist_x64.exe") Run("vcredist_x64.exe", "/q") PersistFeatureInfo("VMware Workstation", WS.Config.Features) InstallWS(wsmsi) elseif sAction == "modify" then PersistFeatureInfo("VMware Workstation", WS.Config.Features) ModifyWS(wsmsi) elseif sAction == "repair" then RepairWS(wsmsi) elseif sAction == "uninstall" then UninstallWS(wsmsi, "") RemoveAllStoredSettings(sProductName) end UISequence({page = "finish"}) if GetSettingA("start_reboot","1") == "1" and RebootCheck() then Log("--- Final reboot") StartReboot(false, true) end