From 68691e38e11677716202071031a94175cfc2d1f4 Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Wed, 7 Aug 2024 15:25:12 +0200 Subject: [PATCH] Add script for installing AMD packages --- scripts/Windows/OS/Install.ps1 | 25 ---------------- scripts/Windows/Scripts/Software.ps1 | 45 ++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 25 deletions(-) diff --git a/scripts/Windows/OS/Install.ps1 b/scripts/Windows/OS/Install.ps1 index 188bdb28..c0ecf1a4 100644 --- a/scripts/Windows/OS/Install.ps1 +++ b/scripts/Windows/OS/Install.ps1 @@ -122,31 +122,6 @@ $null = New-Module { $arguments.Add("action", $Action); } - # Drivers - $null = New-Module { - $driverPath = "$PSScriptRoot/../Drivers"; - $mbPath = "$driverPath/ROG Zenith Extreme Alpha"; - - foreach ($component in (Get-Config "valhalla.hardware.components")) { - - switch ($component) { - ("ROG Zenith Extreme Alpha") { - . "$mbPath/MarvellEthernet/Manage.ps1" @arguments; - . "$mbPath/IntelWiFi/Manage.ps1" @arguments; - . "$mbPath/AMDChipsetX399/Manage.ps1" @arguments; - . "$driverPath/AMDChipsetX399/Manage.ps1" @arguments; - } - ("Predator Z301C") { - . "$driverPath/Predator Z301C/Manage.ps1" @arguments; - } - } - } - - if (Get-Config "valhalla.hardware.eyeX") { - . "$driverPath/Tobii EyeX/Manage.ps1" @arguments; - } - }; - # Windows Config . "$PSScriptRoot/../Software/Windows/Manage.ps1" @arguments; diff --git a/scripts/Windows/Scripts/Software.ps1 b/scripts/Windows/Scripts/Software.ps1 index 67ce76be..2983ee92 100644 --- a/scripts/Windows/Scripts/Software.ps1 +++ b/scripts/Windows/Scripts/Software.ps1 @@ -4,6 +4,7 @@ . "$PSScriptRoot/../Types/InstallerAction.ps1"; $null = New-Module { + . "$PSScriptRoot/BrowserAutomation.ps1"; . "$PSScriptRoot/SoftwareManagement.ps1"; . "$PSScriptRoot/../Types/InstallerAction.ps1"; $userArgument = "name"; @@ -84,6 +85,50 @@ $null = New-Module { Remove-Item -Recurse $unpackDir; } + <# + .SYNOPSIS + Downloads and installs a package from the AMD website. + + .PARAMETER URL + The URL to download the package from. + #> + function Install-AmdPackage { + param( + [string] $URL + ) + + $dir = New-TemporaryDirectory; + $cookieBannerSelector = "#onetrust-consent-sdk"; + $osSelector = "div[id$='oscategory']>div[id$='-0']"; + $downloadSelector = "$osSelector div[id$='panel'] .button a"; + + $file = Start-CustomBrowserDownload @PSBoundParameters -OutDir $dir -Action { + param( + [OpenQA.Selenium.Firefox.FirefoxDriver] $Browser + ) + + $osContainer = $Browser.FindElement([OpenQA.Selenium.By]::CssSelector($osSelector)); + + if (-not ([bool] $osContainer.GetAttribute("cmp-expanded"))) { + $osContainer.Click(); + } + + $download = { + $browser.FindElement([OpenQA.Selenium.By]::CssSelector($downloadSelector)).Click(); + }; + + try { + & $download; + } catch { + $Browser.ExecuteScript("document.querySelector('$cookieBannerSelector').remove()"); + & $download; + } + }; + + Start-Process -Wait -WorkingDirectory $dir -FilePath $file -ArgumentList "/S"; + Remove-Item -Recurse $dir; + } + function Start-SoftwareInstaller { param( [string] $Name,