Skip to content

Commit

Permalink
winget fix (#952)
Browse files Browse the repository at this point in the history
* winget fix

* Compile Winutil

---------

Co-authored-by: ChrisTitusTech <[email protected]>
  • Loading branch information
ChrisTitusTech and ChrisTitusTech authored Aug 8, 2023
1 parent cfb04b5 commit 8e138c3
Show file tree
Hide file tree
Showing 4 changed files with 469 additions and 212 deletions.
58 changes: 2 additions & 56 deletions functions/private/Install-WinUtilWinget.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -38,62 +38,8 @@ function Install-WinUtilWinget {
}

Write-Host "Running Alternative Installer and Direct Installing"
$ErrorActionPreference = "Stop"
$apiLatestUrl = 'https://api.github.com/repos/microsoft/winget-cli/releases/latest'
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

# Hide the progress bar of Invoke-WebRequest
$oldProgressPreference = $ProgressPreference
$ProgressPreference = 'SilentlyContinue'

$desktopAppInstaller = @{
fileName = 'Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle'
url = $(((Invoke-WebRequest $apiLatestUrl -UseBasicParsing | ConvertFrom-Json).assets | Where-Object { $_.name -match '^Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle$' }).browser_download_url)
hash = $(Get-LatestHash)
}

$vcLibsUwp = @{
fileName = 'Microsoft.VCLibs.x64.14.00.Desktop.appx'
url = 'https://aka.ms/Microsoft.VCLibs.x64.14.00.Desktop.appx'
hash = '6602159c341bafea747d0edf15669ac72df8817299fbfaa90469909e06794256'
}
$uiLibs = @{
nupkg = @{
fileName = 'microsoft.ui.xaml.2.7.0.nupkg'
url = 'https://www.nuget.org/api/v2/package/Microsoft.UI.Xaml/2.7.0'
hash = "422FD24B231E87A842C4DAEABC6A335112E0D35B86FAC91F5CE7CF327E36A591"
}
uwp = @{
fileName = 'Microsoft.UI.Xaml.2.7.appx'
}
}
$uiLibs.uwp.file = $PWD.Path + '\' + $uiLibs.uwp.fileName
$uiLibs.uwp.zipPath = '*/x64/*/' + $uiLibs.uwp.fileName

$dependencies = @($desktopAppInstaller, $vcLibsUwp, $uiLibs.nupkg)

foreach ($dependency in $dependencies) {
$dependency.file = $dependency.fileName
Invoke-WebRequest $dependency.url -OutFile $dependency.file
}

$uiLibs.nupkg.file = $PSScriptRoot + '\' + $uiLibs.nupkg.fileName
Add-Type -Assembly System.IO.Compression.FileSystem
$uiLibs.nupkg.zip = [IO.Compression.ZipFile]::OpenRead($uiLibs.nupkg.file)
$uiLibs.nupkg.zipUwp = $uiLibs.nupkg.zip.Entries | Where-Object { $_.FullName -like $uiLibs.uwp.zipPath }
[System.IO.Compression.ZipFileExtensions]::ExtractToFile($uiLibs.nupkg.zipUwp, $uiLibs.uwp.file, $true)
$uiLibs.nupkg.zip.Dispose()

Add-AppxPackage -Path $desktopAppInstaller.file -DependencyPath $vcLibsUwp.file,$uiLibs.uwp.file

Remove-Item $desktopAppInstaller.file
Remove-Item $vcLibsUwp.file
Remove-Item $uiLibs.nupkg.file
Remove-Item $uiLibs.uwp.file
Write-Host "WinGet installed!" -ForegroundColor Green
$ProgressPreference = $oldProgressPreference
Update-EnvironmentVariables

Start-Process -Verb runas -FilePath powershell.exe -ArgumentList "irm https://raw.githubusercontent.com/ChrisTitusTech/winutil/main/winget.ps1 | iex"

Write-Host "Winget Installed"
}
Catch{
Expand Down
18 changes: 0 additions & 18 deletions functions/private/Update-EnvironmentVariables.ps1

This file was deleted.

Loading

0 comments on commit 8e138c3

Please sign in to comment.