Install winget
if nonexistent
This commit is contained in:
parent
fe11ddf570
commit
5bb1a19a1f
2 changed files with 25 additions and 0 deletions
|
@ -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;
|
||||
|
|
20
scripts/Windows/Software/winget/Manage.ps1
Normal file
20
scripts/Windows/Software/winget/Manage.ps1
Normal 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;
|
Loading…
Reference in a new issue