diff --git a/scripts/Windows/OS/Install.ps1 b/scripts/Windows/OS/Install.ps1 index 52c8ec14a..5866787c4 100644 --- a/scripts/Windows/OS/Install.ps1 +++ b/scripts/Windows/OS/Install.ps1 @@ -60,6 +60,11 @@ function Start-InstallationLoop { continue; } + if (-not (Test-Command winget)) { + . "$PSScriptRoot/../Software/winget/Manage.ps1"; + continue; + } + if (-not (& { wsl --status; $?; })) { wsl --install --no-launch; Restart-Intermediate; diff --git a/scripts/Windows/Software/winget/Manage.ps1 b/scripts/Windows/Software/winget/Manage.ps1 new file mode 100644 index 000000000..734f4583b --- /dev/null +++ b/scripts/Windows/Software/winget/Manage.ps1 @@ -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;