Use the new commands

This commit is contained in:
Manuel Thalmann 2024-08-01 18:36:47 +02:00
parent a2d0c89424
commit fe11ddf570
2 changed files with 3 additions and 17 deletions

View file

@ -8,6 +8,7 @@
. "$PSScriptRoot/../Scripts/Context.ps1"; . "$PSScriptRoot/../Scripts/Context.ps1";
. "$PSScriptRoot/../Scripts/Hooks.ps1"; . "$PSScriptRoot/../Scripts/Hooks.ps1";
. "$PSScriptRoot/../Scripts/PowerManagement.ps1"; . "$PSScriptRoot/../Scripts/PowerManagement.ps1";
. "$PSScriptRoot/../Scripts/SoftwareManagement.ps1";
. "$PSScriptRoot/../Scripts/Update.ps1"; . "$PSScriptRoot/../Scripts/Update.ps1";
. "$PSScriptRoot/../Software/Firefox/Install.ps1"; . "$PSScriptRoot/../Software/Firefox/Install.ps1";
@ -28,7 +29,7 @@ function Start-InstallationLoop {
if ($null -eq (Get-Stage)) { if ($null -eq (Get-Stage)) {
Set-Stage ([SetupStage]::Initialize); Set-Stage ([SetupStage]::Initialize);
} elseif ((Get-Stage) -eq ([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 { Invoke-Hook "Install-Chocolatey" -Fallback {
# Install chocolatey # Install chocolatey
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072;
@ -40,7 +41,7 @@ function Start-InstallationLoop {
continue; continue;
} }
if (-not (Test-ChocoSoftware "powershell-core")) { if (-not (Test-ChocoPackage "powershell-core")) {
Invoke-Hook "Install-PowerShellCore" -Fallback { 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"'; 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"';
}; };

View file

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