mirror of
https://github.com/Baipyrus/dotfiles.git
synced 2024-12-26 11:21:46 +00:00
replace builtin install method with web request to app installer
This commit is contained in:
parent
24b6d1f115
commit
4ce997d016
@ -1,12 +1,18 @@
|
|||||||
function InstallWinget
|
function InstallWinget
|
||||||
{
|
{
|
||||||
# Reference: https://learn.microsoft.com/en-us/windows/package-manager/winget/#install-winget-on-windows-sandbox
|
$download = 'https://api.github.com/repos/microsoft/winget-cli/releases/latest'
|
||||||
$progressPreference = 'silentlyContinue'
|
$setup = "$env:TMP\winget_setup.msixbundle"
|
||||||
Write-Host "Installing WinGet PowerShell module from PSGallery..."
|
|
||||||
Install-PackageProvider -Name NuGet -Force | Out-Null
|
if (-not (Test-Path $setup))
|
||||||
Install-Module -Name Microsoft.WinGet.Client -Force -Repository PSGallery | Out-Null
|
{
|
||||||
Write-Host "Using Repair-WinGetPackageManager cmdlet to bootstrap WinGet..."
|
$releases = Invoke-RestMethod $download
|
||||||
Repair-WinGetPackageManager
|
$assets = $releases | Select-Object -ExpandProperty "assets"
|
||||||
|
$installer = $assets | Where-Object "name" -Match "msixbundle"
|
||||||
|
$url = $installer | Select-Object -ExpandProperty "browser_download_url"
|
||||||
|
Invoke-RestMethod $url -OutFile $setup
|
||||||
|
}
|
||||||
|
|
||||||
|
Add-AppxPackage -Path $setup
|
||||||
}
|
}
|
||||||
|
|
||||||
function WingetInstall
|
function WingetInstall
|
||||||
|
Loading…
Reference in New Issue
Block a user