Add script for installing AMD packages

This commit is contained in:
Manuel Thalmann 2024-08-07 15:25:12 +02:00
parent 63a6c16d99
commit 2f950d89ba
2 changed files with 45 additions and 25 deletions

View file

@ -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;

View file

@ -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,