From 8276799e9af7d7fe190a54adeeadf94218fcc791 Mon Sep 17 00:00:00 2001 From: Jan De Dobbeleer Date: Sun, 22 May 2022 20:31:05 +0200 Subject: [PATCH] feat(winget): support x86 resolves #2307 --- .../winget/JanDeDobbeleer.OhMyPosh.installer.yaml | 12 ++++++++++++ packages/winget/build.ps1 | 11 ++++++++--- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/packages/winget/JanDeDobbeleer.OhMyPosh.installer.yaml b/packages/winget/JanDeDobbeleer.OhMyPosh.installer.yaml index 356c184b..f3d91a9f 100644 --- a/packages/winget/JanDeDobbeleer.OhMyPosh.installer.yaml +++ b/packages/winget/JanDeDobbeleer.OhMyPosh.installer.yaml @@ -22,6 +22,18 @@ Installers: Scope: user InstallerSwitches: Custom: /CURRENTUSER +- Architecture: x86 + InstallerUrl: https://github.com/JanDeDobbeleer/oh-my-posh/releases/download/v/install-386.exe + InstallerSha256: + Scope: machine + InstallerSwitches: + Custom: /ALLUSERS +- Architecture: x86 + InstallerUrl: https://github.com/JanDeDobbeleer/oh-my-posh/releases/download/v/install-386.exe + InstallerSha256: + Scope: user + InstallerSwitches: + Custom: /CURRENTUSER - Architecture: arm64 InstallerUrl: https://github.com/JanDeDobbeleer/oh-my-posh/releases/download/v/install-arm64.exe InstallerSha256: diff --git a/packages/winget/build.ps1 b/packages/winget/build.ps1 index 26acbee0..3e3a66f7 100644 --- a/packages/winget/build.ps1 +++ b/packages/winget/build.ps1 @@ -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) $content = $content.Replace('', $HashAmd64) $content = $content.Replace('', $HashArm64) + $content = $content.Replace('', $Hash386) $date = Get-Date -Format "yyyy-MM-dd" $content = $content.Replace('', $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