Compare commits
17 commits
44d4bdb7ec
...
770445ea95
Author | SHA1 | Date | |
---|---|---|---|
Manuel Thalmann | 770445ea95 | ||
Manuel Thalmann | 3e57070f4e | ||
Manuel Thalmann | 8b921112e2 | ||
Manuel Thalmann | 6ca8369d08 | ||
Manuel Thalmann | 979e77a95d | ||
Manuel Thalmann | 81db7a4bca | ||
Manuel Thalmann | 46c30157a0 | ||
Manuel Thalmann | d6f58f3185 | ||
Manuel Thalmann | a1c094dba5 | ||
Manuel Thalmann | 82a365a14a | ||
Manuel Thalmann | cd822fc916 | ||
Manuel Thalmann | 35867a0016 | ||
Manuel Thalmann | ff48173d0d | ||
Manuel Thalmann | 143b4d86fb | ||
Manuel Thalmann | 639eb26da1 | ||
Manuel Thalmann | 4a5c658315 | ||
Manuel Thalmann | 9cbf51fe45 |
43
lib/modules/hardware.nix
Normal file
43
lib/modules/hardware.nix
Normal file
|
@ -0,0 +1,43 @@
|
|||
{ lib, ... }:
|
||||
let
|
||||
inherit (lib)
|
||||
mkOption
|
||||
types
|
||||
;
|
||||
in {
|
||||
options = {
|
||||
valhalla = {
|
||||
hardware = {
|
||||
components = mkOption {
|
||||
type = types.listOf types.str;
|
||||
description = "The names of the hardware components of the computer.";
|
||||
default = [];
|
||||
};
|
||||
|
||||
eyeX = mkOption {
|
||||
type = types.bool;
|
||||
description = "A value indicating whether a Tobii EyeX device is present.";
|
||||
default = false;
|
||||
};
|
||||
|
||||
amdCPU = mkOption {
|
||||
type = types.bool;
|
||||
description = "A value indicating whether an AMD CPU is present.";
|
||||
default = false;
|
||||
};
|
||||
|
||||
nvidiaGPU = mkOption {
|
||||
type = types.bool;
|
||||
description = "A value indicating whether an NVIDIA GPU is present.";
|
||||
default = false;
|
||||
};
|
||||
|
||||
elgatoWave = mkOption {
|
||||
type = types.bool;
|
||||
description = "A value indicating whether an Elgato Wave device is present.";
|
||||
default = false;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
|
@ -7,6 +7,7 @@
|
|||
in {
|
||||
imports = [
|
||||
./git.nix
|
||||
./hardware.nix
|
||||
./i18n.nix
|
||||
./partition.nix
|
||||
./software.nix
|
||||
|
|
|
@ -24,6 +24,17 @@
|
|||
keepExisting = true;
|
||||
};
|
||||
};
|
||||
|
||||
hardware = {
|
||||
components = [
|
||||
"ROG Zenith Extreme Alpha"
|
||||
];
|
||||
|
||||
eyeX = true;
|
||||
amdCPU = true;
|
||||
nvidiaGPU = true;
|
||||
elgatoWave = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
11
scripts/Windows/Drivers/AMDChipsetX399/Manage.ps1
Normal file
11
scripts/Windows/Drivers/AMDChipsetX399/Manage.ps1
Normal file
|
@ -0,0 +1,11 @@
|
|||
param(
|
||||
$Action,
|
||||
[hashtable] $Arguments
|
||||
)
|
||||
|
||||
. "$PSScriptRoot/../../Scripts/Software.ps1";
|
||||
|
||||
Start-SoftwareInstaller @PSBoundParameters `
|
||||
-Installer {
|
||||
Install-AmdPackage "https://www.amd.com/en/support/downloads/drivers.html/chipsets/tr4/x399.html";
|
||||
};
|
21
scripts/Windows/Drivers/Predator Z301C/Manage.ps1
Normal file
21
scripts/Windows/Drivers/Predator Z301C/Manage.ps1
Normal file
|
@ -0,0 +1,21 @@
|
|||
param(
|
||||
$Action,
|
||||
[hashtable] $Arguments
|
||||
)
|
||||
|
||||
. "$PSScriptRoot/../../Scripts/Software.ps1";
|
||||
. "$PSScriptRoot/../../Scripts/System.ps1";
|
||||
|
||||
Start-SoftwareInstaller @PSBoundParameters `
|
||||
-Installer {
|
||||
$dir = New-TemporaryDirectory;
|
||||
$file = "driver.zip";
|
||||
|
||||
$null = Push-Location $dir;
|
||||
Invoke-WebRequest "https://global-download.acer.com/GDFiles/Driver/Monitor/Monitor_Acer_1.0_W7x86W7x64W8x86W8x64_A.zip?acerid=636092441703392074" -OutFile $file;
|
||||
Expand-Archive $file;
|
||||
$null = Start-Process -Wait -FilePath "pnputil" -ArgumentList "/add-driver","*.inf","/install","/subdirs";
|
||||
$null = Pop-Location;
|
||||
|
||||
Remove-Item -Recurse $dir;
|
||||
};
|
|
@ -0,0 +1,11 @@
|
|||
param(
|
||||
$Action,
|
||||
[hashtable] $Arguments
|
||||
)
|
||||
|
||||
. "$PSScriptRoot/../../../Scripts/Software.ps1";
|
||||
|
||||
Start-SoftwareInstaller @PSBoundParameters `
|
||||
-Installer {
|
||||
Install-AsusPackage "https://dlcdnets.asus.com/pub/ASUS/mb/03CHIPSET/DRV_Chipset_AMD_TRX40_TP_TSD_W10_64_V30901140_20211006R.zip?model=ROG%20ZENITH%20EXTREME%20ALPHA";
|
||||
};
|
|
@ -0,0 +1,11 @@
|
|||
param(
|
||||
$Action,
|
||||
[hashtable] $Arguments
|
||||
)
|
||||
|
||||
. "$PSScriptRoot/../../../Scripts/Software.ps1";
|
||||
|
||||
Start-SoftwareInstaller @PSBoundParameters `
|
||||
-Installer {
|
||||
Install-AsusPackage "https://dlcdnets.asus.com/pub/ASUS/mb/02BT/DRV_Bluetooth_Intel_9260_TP_W11_64_V2210002_20211222R.zip?model=ROG%20ZENITH%20EXTREME%20ALPHA";
|
||||
};
|
|
@ -0,0 +1,11 @@
|
|||
param(
|
||||
$Action,
|
||||
[hashtable] $Arguments
|
||||
)
|
||||
|
||||
. "$PSScriptRoot/../../../Scripts/Software.ps1";
|
||||
|
||||
Start-SoftwareInstaller @PSBoundParameters `
|
||||
-Installer {
|
||||
Install-AsusPackage "https://dlcdnets.asus.com/pub/ASUS/mb/08WIRELESS/DRV_WiFi_Intel_TP_W11_64_V2219004_20230130R.zip?model=ROG%20ZENITH%20EXTREME%20ALPHA";
|
||||
};
|
|
@ -0,0 +1,11 @@
|
|||
param(
|
||||
$Action,
|
||||
[hashtable] $Arguments
|
||||
)
|
||||
|
||||
. "$PSScriptRoot/../../../Scripts/Software.ps1";
|
||||
|
||||
Start-SoftwareInstaller @PSBoundParameters `
|
||||
-Installer {
|
||||
Install-AsusPackage "https://dlcdnets.asus.com/pub/ASUS/mb/04LAN/DRV_LAN_Marvell_TP_TSD_W11_64_V3130_20211118R.zip?model=ROG%20ZENITH%20EXTREME%20ALPHA";
|
||||
};
|
11
scripts/Windows/Drivers/Tobii EyeX/Manage.ps1
Normal file
11
scripts/Windows/Drivers/Tobii EyeX/Manage.ps1
Normal file
|
@ -0,0 +1,11 @@
|
|||
param(
|
||||
$Action,
|
||||
[hashtable] $Arguments
|
||||
)
|
||||
|
||||
. "$PSScriptRoot/../../Scripts/Software.ps1";
|
||||
|
||||
Start-SoftwareInstaller @PSBoundParameters `
|
||||
-Installer {
|
||||
Install-SetupPackage -Source "https://files.update.tech.tobii.com/Tobii_Eye_Tracking_Core_v2.16.8.214_x86.exe";
|
||||
};
|
|
@ -10,8 +10,10 @@ $null = New-Module {
|
|||
. "$PSScriptRoot/../Scripts/Hooks.ps1";
|
||||
. "$PSScriptRoot/../Scripts/Operations.ps1";
|
||||
. "$PSScriptRoot/../Scripts/PowerManagement.ps1";
|
||||
. "$PSScriptRoot/../Scripts/Software.ps1";
|
||||
. "$PSScriptRoot/../Scripts/SoftwareManagement.ps1";
|
||||
. "$PSScriptRoot/../Scripts/Update.ps1";
|
||||
. "$PSScriptRoot/../Types/InstallerAction.ps1";
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
|
@ -53,20 +55,29 @@ $null = New-Module {
|
|||
return;
|
||||
}
|
||||
|
||||
Invoke-Hook "Install-PSModules" -Fallback {
|
||||
Install-Module -AcceptLicense -Force PSWindowsUpdate;
|
||||
};
|
||||
|
||||
if (Test-Path $env:PWSH_PATH) {
|
||||
attrib "-R" "$env:PWSH_PATH\*" /S /D;
|
||||
Remove-Item -Recurse -Force $env:PWSH_PATH;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (-not (Test-Command winget)) {
|
||||
Invoke-Hook "Install-PSModules" -Fallback {
|
||||
Install-Module -AcceptLicense -Force PSWindowsUpdate;
|
||||
};
|
||||
|
||||
if (-not (Test-Winget)) {
|
||||
. "$PSScriptRoot/../Software/winget/Manage.ps1";
|
||||
continue;
|
||||
}
|
||||
|
||||
if (-not (Test-PSPackage Selenium.WebDriver)) {
|
||||
Install-Module -AcceptLicense -Force NuGet;
|
||||
Import-Module NuGet;
|
||||
$null = Install-Package -Force Selenium.WebDriver -RequiredVersion 4.10.0 -SkipDependencies;
|
||||
continue;
|
||||
}
|
||||
|
||||
Install-ChocoPackage selenium-gecko-driver firefox;
|
||||
|
||||
if (-not (& { wsl --status; $?; })) {
|
||||
wsl --install --no-launch;
|
||||
|
@ -92,6 +103,78 @@ $null = New-Module {
|
|||
Restart-Intermediate;
|
||||
return;
|
||||
}
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Deploys an action for each software.
|
||||
|
||||
.PARAMETER Action
|
||||
The action to execute by default.
|
||||
#>
|
||||
function Deploy-SoftwareAction {
|
||||
param(
|
||||
[InstallerAction] $Action
|
||||
)
|
||||
|
||||
$arguments = [hashtable]@{ };
|
||||
|
||||
if ($Action) {
|
||||
$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/IntelBluetooth/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.amdCPU") {
|
||||
Install-ChocoPackage amd-ryzen-master;
|
||||
# ToDo: backup Ryzen energy saving plan
|
||||
}
|
||||
|
||||
if (Get-Config "valhalla.hardware.nvidiaGPU") {
|
||||
Install-ChocoPackage geforce-game-ready-driver;
|
||||
Remove-DesktopIcon "*Geforce*";
|
||||
}
|
||||
|
||||
if (Get-Config "valhalla.hardware.corsairLighting") {
|
||||
Install-ChocoPackage icue;
|
||||
}
|
||||
|
||||
if (Get-Config "valhalla.hardware.elgatoWave") {
|
||||
Install-ChocoPackage wavelink;
|
||||
Remove-DesktopIcon "*Wave Link*";
|
||||
}
|
||||
|
||||
if (Get-Config "valhalla.hardware.eyeX") {
|
||||
. "$driverPath/Tobii EyeX/Manage.ps1" @arguments;
|
||||
}
|
||||
};
|
||||
|
||||
# Windows Config
|
||||
. "$PSScriptRoot/../Software/Windows/Manage.ps1" @arguments;
|
||||
|
||||
if (Test-Collection "essential") {
|
||||
# Essentials
|
||||
. "$PSScriptRoot/../Software/OpenSSH/Manage.ps1" @arguments;
|
||||
}
|
||||
}
|
||||
|
||||
switch (Get-Stage) {
|
||||
([SetupStage]::Configure) {
|
||||
|
@ -114,15 +197,7 @@ $null = New-Module {
|
|||
}
|
||||
([SetupStage]::Install) {
|
||||
Write-Host "Entering install phase";
|
||||
|
||||
# Windows Config
|
||||
. "$PSScriptRoot/../Software/Windows/Manage.ps1";
|
||||
|
||||
if (Test-Collection "essential") {
|
||||
# Essentials
|
||||
. "$PSScriptRoot/../Software/OpenSSH/Manage.ps1";
|
||||
}
|
||||
|
||||
Deploy-SoftwareAction;
|
||||
Set-IsFinished $true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ function Install-AmdSoftwarePackage() {
|
|||
}
|
||||
}
|
||||
|
||||
$file = Start-CustomDownload $context $url $action $tempDir;
|
||||
$file = Start-CustomBrowserDownload $context $url $action $tempDir;
|
||||
|
||||
Start-Process -Wait -FilePath $file -ArgumentList "/S";
|
||||
Remove-Item -Recurse $tempDir;
|
||||
|
|
|
@ -1,92 +1,134 @@
|
|||
#!/bin/bash
|
||||
. "$PSScriptRoot/Context.ps1";
|
||||
|
||||
if (-not ("OpenQA.Selenium.Firefox.FirefoxDriver" -as [type])) {
|
||||
if ((Get-Package Selenium.WebDriver -ErrorAction "SilentlyContinue")) {
|
||||
$zipFile = [System.IO.Compression.ZipFile]::OpenRead((Get-Package Selenium.WebDriver).Source);
|
||||
$stream = [System.IO.MemoryStream]::new();
|
||||
$reader = [System.IO.StreamReader]($zipFile.Entries[2]).Open();
|
||||
$reader.BaseStream.CopyTo($stream);
|
||||
[byte[]]$bytes = $stream.ToArray();
|
||||
$reader.Close();
|
||||
$zipFile.Dispose();
|
||||
$null = [System.Reflection.Assembly]::Load($bytes);
|
||||
}
|
||||
}
|
||||
$null = New-Module {
|
||||
. "$PSScriptRoot/System.ps1";
|
||||
|
||||
function Start-CustomDownload() {
|
||||
param(
|
||||
[Context] $context,
|
||||
[string] $url,
|
||||
[Action[OpenQA.Selenium.Firefox.FirefoxDriver]] $action,
|
||||
[string] $outDir = $null
|
||||
)
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Runs an action involving browser automation.
|
||||
|
||||
.PARAMETER Action
|
||||
The action to execute.
|
||||
#>
|
||||
function Start-BrowserAutomation {
|
||||
param(
|
||||
[scriptblock] $Action
|
||||
)
|
||||
|
||||
$tempDir = $context.GetTempDirectory();
|
||||
$options = [OpenQA.Selenium.Firefox.FirefoxOptions]::new();
|
||||
$options.SetPreference("browser.download.folderList", 2);
|
||||
$options.SetPreference("browser.download.dir", $tempDir);
|
||||
# $options.AddArgument("--headless");
|
||||
|
||||
$downloadChecker = {
|
||||
param()
|
||||
|
||||
$files = Get-ChildItem $tempDir;
|
||||
|
||||
if ($(@($files)).Count -gt 0) {
|
||||
foreach ($file in Get-ChildItem $tempDir) {
|
||||
try {
|
||||
$stream = [System.IO.File]::Open($file.FullName, [System.IO.FileMode]::Open, [System.IO.FileAccess]::ReadWrite, [System.IO.FileShare]::None);
|
||||
|
||||
if ($stream) {
|
||||
$stream.Close();
|
||||
}
|
||||
|
||||
}
|
||||
catch {
|
||||
return $true;
|
||||
}
|
||||
}
|
||||
|
||||
return $false;
|
||||
} else {
|
||||
return $true;
|
||||
if (-not ("OpenQA.Selenium.Firefox.FirefoxDriver" -as [type])) {
|
||||
$zipFile = [System.IO.Compression.ZipFile]::OpenRead((Get-Package Selenium.WebDriver).Source);
|
||||
$webDriver = ($zipFile.Entries | Where-Object { $_.FullName -like "lib/net6.0/WebDriver.dll" })[0];
|
||||
$stream = [System.IO.MemoryStream]::new();
|
||||
$reader = [System.IO.StreamReader]($webDriver).Open();
|
||||
$reader.BaseStream.CopyTo($stream);
|
||||
[byte[]]$bytes = $stream.ToArray();
|
||||
$reader.Close();
|
||||
$reader.Dispose();
|
||||
$stream.Close();
|
||||
$stream.Dispose();
|
||||
$zipFile.Dispose();
|
||||
$null = [System.Reflection.Assembly]::Load($bytes);
|
||||
}
|
||||
|
||||
& $Action;
|
||||
}
|
||||
|
||||
$browser = [OpenQA.Selenium.Firefox.FirefoxDriver]::new($options);
|
||||
$browser.Navigate().GoToUrl($url);
|
||||
$action.Invoke($browser);
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Downloads a file from the specified url using browser automation.
|
||||
|
||||
while ($downloadChecker.Invoke()) {
|
||||
Write-Information "Waiting for download to finish...";
|
||||
Start-Sleep 1;
|
||||
.PARAMETER URL
|
||||
The url to download the file from.
|
||||
|
||||
.PARAMETER Action
|
||||
The action to execute in the browser for initiating the download.
|
||||
|
||||
.PARAMETER OutDir
|
||||
The directory to download the file to.
|
||||
#>
|
||||
function Start-CustomBrowserDownload {
|
||||
param(
|
||||
[string] $URL,
|
||||
[scriptblock] $Action,
|
||||
[string] $OutDir
|
||||
)
|
||||
|
||||
if (-not $OutDir) {
|
||||
$OutDir = ".";
|
||||
}
|
||||
|
||||
$dir = New-TemporaryDirectory;
|
||||
Write-Host "Downloading ``$URL`` using browser automation…";
|
||||
$options = [OpenQA.Selenium.Firefox.FirefoxOptions]::new();
|
||||
$options.SetPreference("browser.download.folderList", 2);
|
||||
$options.SetPreference("browser.download.dir", "$dir");
|
||||
|
||||
$downloadChecker = {
|
||||
$files = Get-ChildItem $dir;
|
||||
|
||||
if ((@($files)).Count -gt 0) {
|
||||
foreach ($file in $files) {
|
||||
try {
|
||||
$stream = [System.IO.File]::Open($file.FullName, [System.IO.FileMode]::Open, [System.IO.FileAccess]::ReadWrite, [System.IO.FileShare]::None);
|
||||
|
||||
if ($stream) {
|
||||
$stream.Close();
|
||||
}
|
||||
}
|
||||
catch {
|
||||
return $true;
|
||||
}
|
||||
}
|
||||
|
||||
return $false;
|
||||
} else {
|
||||
return $true;
|
||||
}
|
||||
};
|
||||
|
||||
$browser = [OpenQA.Selenium.Firefox.FirefoxDriver]::new($options);
|
||||
$browser.Navigate().GoToUrl($URL);
|
||||
& $Action -Browser $browser;
|
||||
|
||||
while (& $downloadChecker) {
|
||||
Write-Host "Waiting for the download to finish…";
|
||||
Start-Sleep 1;
|
||||
}
|
||||
|
||||
$file = Get-ChildItem $dir;
|
||||
$result = Move-Item $file $OutDir -PassThru;
|
||||
$browser.Quit();
|
||||
Remove-Item -Recurse $dir;
|
||||
$result;
|
||||
}
|
||||
|
||||
$file = Get-ChildItem $tempDir;
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Downloads a file from the specified url using browser automation.
|
||||
|
||||
if (-not $outDir) {
|
||||
$outDir = ".";
|
||||
.PARAMETER URL
|
||||
The url to download the file from.
|
||||
|
||||
.PARAMETER ButtonSelector
|
||||
The jQuery selector for finding the download button.
|
||||
|
||||
.PARAMETER OutDir
|
||||
The directory to download the file to.
|
||||
#>
|
||||
function Start-BrowserDownload {
|
||||
param(
|
||||
[string] $URL,
|
||||
[string] $ButtonSelector,
|
||||
[string] $OutDir = $null
|
||||
)
|
||||
|
||||
Start-CustomBrowserDownload @PSBoundParameters -Action {
|
||||
param(
|
||||
[OpenQA.Selenium.Firefox.FirefoxDriver] $Browser
|
||||
)
|
||||
|
||||
$Browser.FindElement([OpenQA.Selenium.By]::CssSelector($ButtonSelector)).Click();
|
||||
};
|
||||
}
|
||||
|
||||
$result = Move-Item $file $outDir -PassThru;
|
||||
$browser.Quit();
|
||||
Remove-Item -Recurse $tempDir;
|
||||
return $result;
|
||||
}
|
||||
|
||||
function Start-AutomatedDownload() {
|
||||
param(
|
||||
[Context] $context,
|
||||
[string] $url,
|
||||
[string] $buttonSelector,
|
||||
[string] $outDir = $null
|
||||
)
|
||||
|
||||
$action = {
|
||||
param([OpenQA.Selenium.Firefox.FirefoxDriver] $browser)
|
||||
$browser.FindElement([OpenQA.Selenium.By]::CssSelector("$buttonSelector")).Click();
|
||||
}
|
||||
|
||||
return Start-CustomDownload $context $url $action $outDir;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1,11 +1,134 @@
|
|||
. "$PSScriptRoot/Config.ps1";
|
||||
. "$PSScriptRoot/Operations.ps1";
|
||||
. "$PSScriptRoot/System.ps1";
|
||||
. "$PSScriptRoot/../Types/InstallerAction.ps1";
|
||||
|
||||
$null = New-Module {
|
||||
. "$PSScriptRoot/BrowserAutomation.ps1";
|
||||
. "$PSScriptRoot/SoftwareManagement.ps1";
|
||||
. "$PSScriptRoot/../Types/InstallerAction.ps1";
|
||||
$userArgument = "name";
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Installs the specified packages using chocolatey.
|
||||
|
||||
.PARAMETER Names
|
||||
The names of the packages to install.
|
||||
#>
|
||||
function Install-ChocoPackage {
|
||||
param(
|
||||
[switch] $Force,
|
||||
[Parameter(ValueFromRemainingArguments = $true)]
|
||||
[string[]] $Names
|
||||
)
|
||||
|
||||
[System.Collections.ArrayList] $Names = $Names;
|
||||
|
||||
if (-not ($Force.IsPresent)) {
|
||||
for ($i = $Names.Count - 1; $i -ge 0; $i--) {
|
||||
if (Test-ChocoPackage $Names[$i]) {
|
||||
$Names.RemoveAt($i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($Names.Count -ge 1) {
|
||||
choco install -y $Names;
|
||||
}
|
||||
}
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Installs the specified packages using `winget`.
|
||||
|
||||
.PARAMETER Names
|
||||
The names of the packages to install.
|
||||
#>
|
||||
function Install-WingetPackage {
|
||||
param(
|
||||
[switch] $Force,
|
||||
[Parameter(ValueFromRemainingArguments = $true)]
|
||||
[string[]] $Names
|
||||
)
|
||||
|
||||
foreach ($name in $Names) {
|
||||
if ($Force.IsPresent -and -not (Test-WingetPackage $name)) {
|
||||
winget install --accept-source-agreements --accept-package-agreements -e --id $name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Installs a package downloaded from ASUS.
|
||||
|
||||
.PARAMETER URL
|
||||
The URL to download the package from.
|
||||
#>
|
||||
function Install-AsusPackage {
|
||||
param(
|
||||
[string] $URL
|
||||
)
|
||||
|
||||
$file = "AsusPackage.zip";
|
||||
$dir = New-TemporaryDirectory;
|
||||
$unpackDir = New-TemporaryDirectory;
|
||||
|
||||
$null = Push-Location $dir;
|
||||
Invoke-WebRequest $URL -OutFile $file;
|
||||
Expand-Archive $file $unpackDir;
|
||||
$null = Pop-Location;
|
||||
Remove-Item -Recurse $dir;
|
||||
|
||||
$null = Start-Process -Wait -WorkingDirectory $unpackDir -FilePath (Join-Path $unpackDir "AsusSetup.exe") -ArgumentList "/S";
|
||||
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,
|
||||
|
|
|
@ -43,6 +43,22 @@ function Test-ChocoPackage {
|
|||
-not [string]::IsNullOrEmpty((choco list --limit-output --exact $name));
|
||||
}
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Checks whether a `winget` package with the specified id is installed.
|
||||
|
||||
.PARAMETER ID
|
||||
The id of the package to check.
|
||||
#>
|
||||
function Test-WingetPackage {
|
||||
[OutputType([bool])]
|
||||
param(
|
||||
[string] $ID
|
||||
)
|
||||
|
||||
-not (& { $null = winget list --accept-source-agreements -e --id $ID; $?; });
|
||||
}
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Checks whether a command with the specified name exists.
|
||||
|
@ -57,3 +73,29 @@ function Test-Command {
|
|||
|
||||
[bool] (Get-Command $Name -ErrorAction SilentlyContinue);
|
||||
}
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Checks whether `winget` is working properly.
|
||||
#>
|
||||
function Test-Winget {
|
||||
(Test-Command winget) -and -not (
|
||||
[System.Linq.Enumerable]::Any(
|
||||
[string[]](winget source update winget),
|
||||
[System.Func[string,bool]]{ param($line) $line -eq "Cancelled"; }));
|
||||
}
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Checks whether a package with the specified name is installed.
|
||||
|
||||
.PARAMETER Name
|
||||
The name of the package to check.
|
||||
#>
|
||||
function Test-PSPackage {
|
||||
param(
|
||||
[string] $Name
|
||||
)
|
||||
|
||||
[bool] (Get-Package $Name -ErrorAction SilentlyContinue);
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ $action = {
|
|||
}
|
||||
|
||||
Write-Information "Downloading GPU-Z";
|
||||
$file = Start-CustomDownload $context "https://www.techpowerup.com/download/techpowerup-gpu-z/" $action $tempDir;
|
||||
$file = Start-CustomBrowserDownload $context "https://www.techpowerup.com/download/techpowerup-gpu-z/" $action $tempDir;
|
||||
Write-Information "Launching GPU-Z installer";
|
||||
Start-Process -Wait -FilePath $file.FullName -ArgumentList "-installSilent";
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ Start-SoftwareInstaller @PSBoundParameters `
|
|||
} `
|
||||
-Configurator {
|
||||
$nativeProfile = powershell -c '$PROFILE';
|
||||
New-Item -Force $nativeProfile;
|
||||
$null = New-Item -Force $nativeProfile;
|
||||
choco install -y --force chocolatey;
|
||||
Copy-Item -Force $nativeProfile $PROFILE;
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ $null = New-Module {
|
|||
$tempDir = $context.GetTempDirectory();
|
||||
|
||||
Write-Information "Downloading reWASD";
|
||||
$file = Start-AutomatedDownload $context "https://rewasd.com/" 'a.btn-default[href="#"]' $tempDir;
|
||||
$file = Start-BrowserDownload $context "https://rewasd.com/" 'a.btn-default[href="#"]' $tempDir;
|
||||
|
||||
Write-Information "Installing reWASD";
|
||||
Start-Process -Wait -FilePath $file.FullName -ArgumentList "/S";
|
||||
|
|
|
@ -3,18 +3,19 @@ param(
|
|||
[hashtable] $Arguments
|
||||
)
|
||||
|
||||
. "$PSScriptRoot/../../Scripts/Software.ps1";
|
||||
. "$PSScriptRoot/../../Types/InstallerAction.ps1";
|
||||
$null = New-Module {
|
||||
. "$PSScriptRoot/../../Scripts/Software.ps1";
|
||||
|
||||
Start-SoftwareInstaller @PSBoundParameters `
|
||||
-Installer {
|
||||
$xamlDownloadLink = "https://github.com/microsoft/microsoft-ui-xaml/releases/download/v2.8.6/Microsoft.UI.Xaml.2.8.x64.appx";
|
||||
$downloadLink = "https://github.com/microsoft/winget-cli/releases/latest/download/Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle";
|
||||
$file = New-TemporaryFile;
|
||||
$file = Rename-Item $file "$file.msixbundle" -PassThru;
|
||||
Invoke-WebRequest "$xamlDownloadLink" -OutFile "$file";
|
||||
Add-AppxPackage "$file";
|
||||
Invoke-WebRequest "$downloadLink" -OutFile "$file";
|
||||
Add-AppxPackage "$file";
|
||||
Remove-Item $file;
|
||||
};
|
||||
Start-SoftwareInstaller @PSBoundParameters `
|
||||
-Installer {
|
||||
$xamlDownloadLink = "https://github.com/microsoft/microsoft-ui-xaml/releases/download/v2.8.6/Microsoft.UI.Xaml.2.8.x64.appx";
|
||||
$downloadLink = "https://github.com/microsoft/winget-cli/releases/latest/download/Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle";
|
||||
$file = New-TemporaryFile;
|
||||
$file = Rename-Item $file "$file.msixbundle" -PassThru;
|
||||
Invoke-WebRequest "$xamlDownloadLink" -OutFile "$file";
|
||||
Add-AppxPackage "$file";
|
||||
Invoke-WebRequest "$downloadLink" -OutFile "$file";
|
||||
Add-AppxPackage "$file";
|
||||
Remove-Item $file;
|
||||
};
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue