From 2f950d89ba5d787e2639bcbf89bc9bdc339998d2 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 ec4786b6..0e766984 100644 --- a/scripts/Windows/OS/Install.ps1 +++ b/scripts/Windows/OS/Install.ps1 @@ -123,31 +123,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 ac2d1eae..c75f5f35 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,