Skip to content

Commit

Permalink
(vmwareworkstation) Updated some files
Browse files Browse the repository at this point in the history
  • Loading branch information
virtualex committed Apr 2, 2021
1 parent c9d2ae3 commit 1c51ef6
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 46 deletions.
23 changes: 5 additions & 18 deletions automatic/vmwareworkstation/tools/chocolateyInstall.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,20 @@

$toolsDir = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)"

$url = 'https://softwareupdate.vmware.com/cds/vmw-desktop/ws/16.1.1/17801498/windows/core/VMware-workstation-16.1.1-17801498.exe.tar'
$checksum = '5c606e01a9903430695fee960062f0382908962c531157f9b852c7e9fa7c78ad'
$url = 'https://download3.vmware.com/software/wkst/file/VMware-workstation-full-16.1.1-17801498.exe'
$checksum = '7dab7c43bdfeebb7771a828d208385ade60a86fa31c6beb2f6d93b8e74037f4b'
$checksumType = 'sha256'

$zippackageArgs = @{
$packageArgs = @{
packageName = $env:ChocolateyPackageName
unzipLocation = $toolsDir
fileType = 'exe'
url = $url
softwareName = "VMware Workstation*"
checksum = $checksum
checksumType = $checksumType

}

Install-ChocolateyZipPackage @zippackageArgs

$fileLocation = Get-ChildItem $toolsDir\VMware-workstation*.exe

$packageArgs = @{
packageName = $env:ChocolateyPackageName
unzipLocation = $toolsDir
fileType = 'exe'
file = $fileLocation
softwareName = 'VMware Workstation*'
silentArgs = '/s /v/qn EULAS_AGREED=1 AUTOSOFTWAREUPDATE=0 DATACOLLECTION=0 ADDLOCAL=ALL REBOOT=ReallySuppress'
validExitCodes = @(0, 3010, 1614, 1641)
}

Install-ChocolateyPackage @packageArgs

Get-ChildItem $toolsDir\*.exe | ForEach-Object { Remove-Item $_ -ErrorAction SilentlyContinue; if (Test-Path $_) { Set-Content "$_.ignore" } }
70 changes: 42 additions & 28 deletions automatic/vmwareworkstation/update.ps1
Original file line number Diff line number Diff line change
@@ -1,54 +1,68 @@
Import-Module AU
Import-Module "$env:ChocolateyInstall\helpers\chocolateyInstaller.psm1"

$releases = 'https://softwareupdate.vmware.com/cds/vmw-desktop/ws/'
$allProductsUrl = 'https://my.vmware.com/channel/public/api/v1.0/products/getAllProducts?locale=en_US&isPrivate=true'

function global:au_GetLatest {
#region Get VMware Workstation Pro Url
$download_page = Invoke-WebRequest -Uri $releases -UseBasicParsing
function CreateStream {
param ( $productVersion )

#region Get VMware Workstation Pro for Windows Urls
$productBinariesUrl = "https://my.vmware.com/channel/public/api/v1.0/products/getRelatedDLGList?locale=en_US&category=desktop_end_user_computing&product=vmware_workstation_pro&version=$($productVersion)&dlgType=PRODUCT_BINARY"

$versionFolder = $download_page.Links | Where-Object { $_.href -Match '(\d+)' } | Select-Object -Last 1 -Skip 2 -ExpandProperty href
$versionFolderUrl = $releases + $versionFolder
$jsonProduct = Invoke-WebRequest -Uri $productBinariesUrl | ConvertFrom-Json

$build_page = Invoke-WebRequest -Uri $versionFolderUrl -UseBasicParsing
$buildFolder = $build_page.Links | Where-Object { $_.href -Match '(\d+)' } | Select-Object -Last 1 -ExpandProperty href
$buildFolderUrl = $versionFolderUrl + $buildFolder
$re = '*-WIN'
$product = $jsonProduct.dlgEditionsLists.dlgList | Where-Object code -like $re | Select-Object -First 1

$staticFolders = 'windows/core/'
$fileFolderUrl = $buildFolderUrl + $staticFolders
$downloadFilesUrl = "https://my.vmware.com/channel/public/api/v1.0/dlg/details?locale=en_US&downloadGroup=$($product.code)&productId=$($product.productId)&rPId=$($product.releasePackageId)"

$re = '\.tar$'
$file_page = Invoke-WebRequest -Uri $fileFolderUrl -UseBasicParsing
$fileName = $file_page.Links | Where-Object { $_.href -match $re } | Select-Object -ExpandProperty href
$jsonFile = Invoke-WebRequest -Uri $downloadFilesUrl | ConvertFrom-Json

$Url32 = $fileFolderUrl + $fileName
$version = $versionFolder.Replace("/",".") + $buildFolder.Replace("/","")
$re = '\.exe$'
$Url32 = "https://download3.vmware.com/software/wkst/file/" + ($jsonFile.downloadFiles | Where-Object fileName -match $re | Select-Object -First 1 -ExpandProperty fileName)
$version = $jsonFile.downloadFiles.version + '.' + $jsonFile.downloadFiles.build
$ChecksumType = 'sha256'
$checksum = $jsonFile.downloadFiles.sha256checksum | Select-Object -First 1
#endregion

#region Get Release Notes Url
$feed = 'https://docs.vmware.com/en/VMware-Workstation-Pro/rn_rss.xml'
$xml_fileName = Split-Path -Leaf $feed
$dest = "$env:TEMP\vws_$xml_fileName"
$dlgHeaderUrl = "https://my.vmware.com/channel/public/api/v1.0/products/getDLGHeader?locale=en_US&downloadGroup=$($product.code)&productId=$($product.productId)"

Get-WebFile $feed $dest | Out-Null
[xml]$content = Get-Content $dest
$jsonHeader = Invoke-WebRequest -Uri $dlgHeaderUrl | ConvertFrom-Json

$ReleaseNotes = $content.feed.entry | Where-Object { $_.id -Match $versionFolder } | Select-Object -ExpandProperty id

Remove-Item $dest -Force -ErrorAction SilentlyContinue
$ReleaseNotes = ($jsonHeader.dlg.documentation).Split(';|&') | Where-Object { $_ -match '.html' }
#endregion

@{
$Result = @{
Url32 = $Url32
Version = $version
ChecksumType32 = $ChecksumType
Checksum32 = $checksum
ReleaseNotes = $ReleaseNotes
}
return $Result
}

function global:au_BeforeUpdate {
$Latest.Checksum32 = Get-RemoteChecksum $Latest.Url32 -Algorithm $Latest.ChecksumType32
function global:au_GetLatest {
$streams = @{}

#region Get VMware Workstation Pro for Windows Versions
$jsonProducts = Invoke-WebRequest -Uri $allProductsUrl | ConvertFrom-Json

$re = 'vmware_workstation_pro'
$productVersion = ($jsonProducts.productCategoryList.productList.actions | Where-Object target -match $re | Select-Object -First 1 -ExpandProperty target).Split("/")[-1]

$productHeaderUrl = "https://my.vmware.com/channel/public/api/v1.0/products/getProductHeader?locale=en_US&category=desktop_end_user_computing&product=vmware_workstation_pro&version=$($productVersion)"

$jsonProductHeader = Invoke-WebRequest -Uri $productHeaderUrl | ConvertFrom-Json

foreach ( $id in $jsonProductHeader.versions.id ) {
$streams.Add( $id, ( CreateStream $id ) )
}

return @{ Streams = $streams }
#endregion


}

function global:au_SearchReplace {
Expand Down
3 changes: 3 additions & 0 deletions automatic/vmwareworkstation/vmwareworkstation.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"16_0": "16.1.1.17801498"
}

0 comments on commit 1c51ef6

Please sign in to comment.