Use the new commands

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

View file

@ -4,6 +4,7 @@
. "$PSScriptRoot/../Scripts/Config.ps1"; . "$PSScriptRoot/../Scripts/Config.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/../Scripts/Context.ps1"; . "$PSScriptRoot/../Scripts/Context.ps1";
. "$PSScriptRoot/../Software/Firefox/Install.ps1"; . "$PSScriptRoot/../Software/Firefox/Install.ps1";
@ -27,7 +28,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;
@ -39,7 +40,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));
}