Skip to content

Commit

Permalink
fix(amd-ryzen-master): update script
Browse files Browse the repository at this point in the history
Signed-off-by: mikeee <[email protected]>
  • Loading branch information
mikeee committed Oct 30, 2024
1 parent 5dde192 commit 89c47f3
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions automatic/amd-ryzen-master/update.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@

. $PSScriptRoot\..\..\scripts\all.ps1

$releases = 'https://download.amd.com/Desktop/AMD-Ryzen-Master.exe'
$checksumType = 'SHA256'
$releases = 'https://www.amd.com/en/products/software/ryzen-master.html'

function global:au_SearchReplace {
@{
Expand All @@ -20,18 +19,15 @@ function global:au_AfterUpdate {
}

function global:au_GetLatest {
$tempFile = New-TemporaryFile
Invoke-WebRequest -Uri $releases -OutFile $tempFile -UseBasicParsing
$page = Invoke-WebRequest -Uri $releases -UseBasicParsing -UserAgent [Microsoft.PowerShell.Commands.PSUserAgent]::FireFox

$version = (Get-Item $tempfile).VersionInfo.FileVersion
$regexUrl = 'https:\/\/download.amd.com\/Desktop\/amd-ryzen-master-(?<version>[\d\-]+)\.exe'

$checksum = Get-FileHash -Algorithm $checksumType -Path $tempFile -ErrorAction SilentlyContinue | Select-Object -ExpandProperty Hash
$url = $page.links | Where-Object href -match $regexUrl | Select-Object -First 1 -expand href

return @{
URL = $releases
Checksum = $checksum
ChecksumType = $checksumType
Version = $version
URL = $url
Version = $matches.version
}
}

Expand Down

0 comments on commit 89c47f3

Please sign in to comment.