feat(winget): support x86

resolves #2307
This commit is contained in:
Jan De Dobbeleer 2022-05-22 20:31:05 +02:00 committed by Jan De Dobbeleer
parent 8eee3ef039
commit 8276799e9a
2 changed files with 20 additions and 3 deletions

View file

@ -22,6 +22,18 @@ Installers:
Scope: user
InstallerSwitches:
Custom: /CURRENTUSER
- Architecture: x86
InstallerUrl: https://github.com/JanDeDobbeleer/oh-my-posh/releases/download/v<VERSION>/install-386.exe
InstallerSha256: <HASH-386>
Scope: machine
InstallerSwitches:
Custom: /ALLUSERS
- Architecture: x86
InstallerUrl: https://github.com/JanDeDobbeleer/oh-my-posh/releases/download/v<VERSION>/install-386.exe
InstallerSha256: <HASH-386>
Scope: user
InstallerSwitches:
Custom: /CURRENTUSER
- Architecture: arm64
InstallerUrl: https://github.com/JanDeDobbeleer/oh-my-posh/releases/download/v<VERSION>/install-arm64.exe
InstallerSha256: <HASH-ARM64>

View file

@ -19,7 +19,7 @@ function Get-HashForArchitecture {
$Version
)
$hash = (new-object Net.WebClient).DownloadString("https://github.com/JanDeDobbeleer/oh-my-posh/releases/download/v$Version/install-$Architecture.exe.sha256")
return $hash
return $hash.Trim()
}
function Write-MetaData {
@ -35,12 +35,16 @@ function Write-MetaData {
$HashAmd64,
[parameter(Mandatory = $true)]
[string]
$HashArm64
$HashArm64,
[parameter(Mandatory = $true)]
[string]
$Hash386
)
$content = Get-Content $FileName -Raw
$content = $content.Replace('<VERSION>', $Version)
$content = $content.Replace('<HASH-AMD64>', $HashAmd64)
$content = $content.Replace('<HASH-ARM64>', $HashArm64)
$content = $content.Replace('<HASH-386>', $Hash386)
$date = Get-Date -Format "yyyy-MM-dd"
$content = $content.Replace('<DATE>', $date)
$content | Out-File -Encoding 'UTF8' "./$Version/$FileName"
@ -50,8 +54,9 @@ New-Item -Path $PWD -Name $Version -ItemType "directory"
# Get all files inside the folder and adjust the version/hash
$HashAmd64 = Get-HashForArchitecture -Architecture 'amd64' -Version $Version
$HashArm64 = Get-HashForArchitecture -Architecture 'arm64' -Version $Version
$Hash386 = Get-HashForArchitecture -Architecture '386' -Version $Version
Get-ChildItem '*.yaml' | ForEach-Object -Process {
Write-MetaData -FileName $_.Name -Version $Version -HashAmd64 $HashAmd64 -HashArm64 $HashArm64
Write-MetaData -FileName $_.Name -Version $Version -HashAmd64 $HashAmd64 -HashArm64 $HashArm64 -Hash386 $Hash386
}
if (-not $Token) {
return