mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2025-01-17 18:27:42 -06:00
Compile Winutil
This commit is contained in:
parent
eb205771fb
commit
963bfe9358
10
winutil.ps1
10
winutil.ps1
@ -624,14 +624,17 @@ function Get-WinUtilWingetLatest {
|
|||||||
.DESCRIPTION
|
.DESCRIPTION
|
||||||
This function grabs the latest version of Winget and returns the download path to Install-WinUtilWinget for installation.
|
This function grabs the latest version of Winget and returns the download path to Install-WinUtilWinget for installation.
|
||||||
#>
|
#>
|
||||||
|
# Invoke-WebRequest is notoriously slow when the byte progress is displayed. The following lines disable the progress bar and reset them at the end of the function
|
||||||
|
$PreviousProgressPreference = $ProgressPreference
|
||||||
|
$ProgressPreference = "silentlyContinue"
|
||||||
Try{
|
Try{
|
||||||
# Grabs the latest release of Winget from the Github API for the install process.
|
# Grabs the latest release of Winget from the Github API for the install process.
|
||||||
$response = Invoke-RestMethod -Uri "https://api.github.com/repos/microsoft/Winget-cli/releases/latest" -Method Get -ErrorAction Stop
|
$response = Invoke-RestMethod -Uri "https://api.github.com/repos/microsoft/Winget-cli/releases/latest" -Method Get -ErrorAction Stop
|
||||||
$latestVersion = $response.tag_name #Stores version number of latest release.
|
$latestVersion = $response.tag_name #Stores version number of latest release.
|
||||||
$licenseWingetUrl = $response.assets.browser_download_url[0] #Index value for License file.
|
$licenseWingetUrl = $response.assets.browser_download_url | Where-Object {$_ -like "*License1.xml"} #Index value for License file.
|
||||||
Write-Host "Latest Version:`t$($latestVersion)`n"
|
Write-Host "Latest Version:`t$($latestVersion)`n"
|
||||||
$assetUrl = $response.assets.browser_download_url[2] #Index value for download URL.
|
Write-Host "Downloading..."
|
||||||
|
$assetUrl = $response.assets.browser_download_url | Where-Object {$_ -like "*Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle"}
|
||||||
Invoke-WebRequest -Uri $licenseWingetUrl -OutFile $ENV:TEMP\License1.xml
|
Invoke-WebRequest -Uri $licenseWingetUrl -OutFile $ENV:TEMP\License1.xml
|
||||||
# The only pain is that the msixbundle for winget-cli is 246MB. In some situations this can take a bit, with slower connections.
|
# The only pain is that the msixbundle for winget-cli is 246MB. In some situations this can take a bit, with slower connections.
|
||||||
Invoke-WebRequest -Uri $assetUrl -OutFile $ENV:TEMP\Microsoft.DesktopAppInstaller.msixbundle
|
Invoke-WebRequest -Uri $assetUrl -OutFile $ENV:TEMP\Microsoft.DesktopAppInstaller.msixbundle
|
||||||
@ -639,6 +642,7 @@ function Get-WinUtilWingetLatest {
|
|||||||
Catch{
|
Catch{
|
||||||
throw [WingetFailedInstall]::new('Failed to get latest Winget release and license')
|
throw [WingetFailedInstall]::new('Failed to get latest Winget release and license')
|
||||||
}
|
}
|
||||||
|
$ProgressPreference = $PreviousProgressPreference
|
||||||
}
|
}
|
||||||
function Get-WinUtilWingetPrerequisites {
|
function Get-WinUtilWingetPrerequisites {
|
||||||
<#
|
<#
|
||||||
|
Loading…
Reference in New Issue
Block a user