Install winget if nonexistent

This commit is contained in:
Manuel Thalmann 2024-08-01 18:58:33 +02:00
parent fe11ddf570
commit 5bb1a19a1f
2 changed files with 25 additions and 0 deletions

View file

@ -60,6 +60,11 @@ function Start-InstallationLoop {
continue; continue;
} }
if (-not (Test-Command winget)) {
. "$PSScriptRoot/../Software/winget/Manage.ps1";
continue;
}
if (-not (& { wsl --status; $?; })) { if (-not (& { wsl --status; $?; })) {
wsl --install --no-launch; wsl --install --no-launch;
Restart-Intermediate; Restart-Intermediate;

View file

@ -0,0 +1,20 @@
param(
[string] $Action = ([InstallerAction]::Install),
[hashtable] $Arguments
)
. "$PSScriptRoot/../../Scripts/Software.ps1";
function Install-Software {
$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 -Action $Action -Arguments $Arguments;