From dc2f8400180c9483648d1aab098549dc7efec4bc Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Wed, 7 Aug 2024 18:01:17 +0200 Subject: [PATCH] Prevent reboot during WaveLink installation --- scripts/Windows/OS/Install.ps1 | 8 ++++++-- scripts/Windows/Scripts/Software.ps1 | 11 ++++++++--- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/scripts/Windows/OS/Install.ps1 b/scripts/Windows/OS/Install.ps1 index 68803f55..48a41583 100644 --- a/scripts/Windows/OS/Install.ps1 +++ b/scripts/Windows/OS/Install.ps1 @@ -159,8 +159,12 @@ $null = New-Module { } if (Get-Config "valhalla.hardware.elgatoWave") { - Install-ChocoPackage wavelink; - Remove-DesktopIcon "*Wave Link*"; + if (-not (Test-ChocoPackage wavelink)) { + Install-ChocoPackage wavelink -ArgumentList '--install-arguments="/norestart"'; + Remove-DesktopIcon "*Wave Link*"; + Restart-Intermediate; + exit; + } } if (Get-Config "valhalla.hardware.eyeX") { diff --git a/scripts/Windows/Scripts/Software.ps1 b/scripts/Windows/Scripts/Software.ps1 index c75f5f35..6fd04a34 100644 --- a/scripts/Windows/Scripts/Software.ps1 +++ b/scripts/Windows/Scripts/Software.ps1 @@ -19,11 +19,16 @@ $null = New-Module { function Install-ChocoPackage { param( [switch] $Force, + [string[]] $ArgumentList, + [Parameter(Position=0)] + [string] $Name, [Parameter(ValueFromRemainingArguments = $true)] - [string[]] $Names + [string[]] $AdditionalNames = @() ) - [System.Collections.ArrayList] $Names = $Names; + [System.Collections.ArrayList] $Names = @(); + $null = $Names.Add($Name); + $Names.AddRange($AdditionalNames); if (-not ($Force.IsPresent)) { for ($i = $Names.Count - 1; $i -ge 0; $i--) { @@ -34,7 +39,7 @@ $null = New-Module { } if ($Names.Count -ge 1) { - choco install -y $Names; + choco install -y $ArgumentList $Names; } }