From fe11ddf5705753fb81698968fe339e281938b688 Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Thu, 1 Aug 2024 18:36:47 +0200 Subject: [PATCH] Use the new commands --- scripts/Windows/OS/Install.ps1 | 5 +++-- scripts/Windows/Scripts/Choco.ps1 | 15 --------------- 2 files changed, 3 insertions(+), 17 deletions(-) delete mode 100644 scripts/Windows/Scripts/Choco.ps1 diff --git a/scripts/Windows/OS/Install.ps1 b/scripts/Windows/OS/Install.ps1 index 35596781..52c8ec14 100644 --- a/scripts/Windows/OS/Install.ps1 +++ b/scripts/Windows/OS/Install.ps1 @@ -8,6 +8,7 @@ . "$PSScriptRoot/../Scripts/Context.ps1"; . "$PSScriptRoot/../Scripts/Hooks.ps1"; . "$PSScriptRoot/../Scripts/PowerManagement.ps1"; +. "$PSScriptRoot/../Scripts/SoftwareManagement.ps1"; . "$PSScriptRoot/../Scripts/Update.ps1"; . "$PSScriptRoot/../Software/Firefox/Install.ps1"; @@ -28,7 +29,7 @@ function Start-InstallationLoop { if ($null -eq (Get-Stage)) { Set-Stage ([SetupStage]::Initialize); } elseif ((Get-Stage) -eq ([SetupStage]::Initialize)) { - if (-not ((Get-Command "choco") -and (Get-Command "refreshenv"))) { + if (-not ((Test-Command "choco") -and (Test-Command "refreshenv"))) { Invoke-Hook "Install-Chocolatey" -Fallback { # Install chocolatey [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; @@ -40,7 +41,7 @@ function Start-InstallationLoop { continue; } - if (-not (Test-ChocoSoftware "powershell-core")) { + if (-not (Test-ChocoPackage "powershell-core")) { Invoke-Hook "Install-PowerShellCore" -Fallback { choco install -y powershell-core --install-arguments='"ADD_FILE_CONTEXT_MENU_RUNPOWERSHELL=1 ADD_EXPLORER_CONTEXT_MENU_OPENPOWERSHELL=1 REGISTER_MANIFEST=1 USER_MU=1 ENABLE_MU=1"'; }; diff --git a/scripts/Windows/Scripts/Choco.ps1 b/scripts/Windows/Scripts/Choco.ps1 deleted file mode 100644 index 99b89e5e..00000000 --- a/scripts/Windows/Scripts/Choco.ps1 +++ /dev/null @@ -1,15 +0,0 @@ -<# - .SYNOPSIS - Checks whether the specified package has been installed using Chocolatey. - - .PARAMETER Name - The name of the package to check. -#> -function Test-ChocoSoftware { - [OutputType([bool])] - param( - [string] $Name - ); - - -not [string]::IsNullOrEmpty((choco list --limit-output --exact $name)); -}