From 6a848c8a7b61431374f424685ec5b2fdb97291d5 Mon Sep 17 00:00:00 2001 From: Markus Fleschutz Date: Fri, 12 Jan 2024 12:39:46 +0100 Subject: [PATCH 1/2] Update install-powershell.ps1 --- scripts/install-powershell.ps1 | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/scripts/install-powershell.ps1 b/scripts/install-powershell.ps1 index 4847fa38..7dc1d436 100755 --- a/scripts/install-powershell.ps1 +++ b/scripts/install-powershell.ps1 @@ -22,6 +22,7 @@ Invoke this script directly from GitHub Invoke-Expression "& { $(Invoke-RestMethod 'https://aka.ms/install-powershell.ps1') } -daily" #> + [CmdletBinding(DefaultParameterSetName = "Daily")] param( [Parameter(ParameterSetName = "Daily")] @@ -116,7 +117,7 @@ function Remove-Destination([string] $Destination) { if ($DoNotOverwrite) { throw "Destination folder '$Destination' already exist. Use a different path or omit '-DoNotOverwrite' to overwrite." } - Write-Host "⏳ (2/2) Removing old installation at: $Destination" + Write-Host "⏳ (5/5) Removing old installation at: $Destination" if (Test-Path -Path "$Destination.old") { Remove-Item "$Destination.old" -Recurse -Force } @@ -259,6 +260,8 @@ if ($IsLinux) { } else { $architecture = "arm32" } + } else { + $architecture = "x64" } } elseif (-not $IsWinEnv) { $architecture = "x64" @@ -357,12 +360,14 @@ try { tar zxf $packagePath -C $contentPath } } else { + Write-Host "⏳ (1/5) Loading metadata from https://raw.githubusercontent.com ..." $metadata = Invoke-RestMethod https://raw.githubusercontent.com/PowerShell/PowerShell/master/tools/metadata.json if ($Preview) { $release = $metadata.PreviewReleaseTag -replace '^v' } else { $release = $metadata.ReleaseTag -replace '^v' } + Write-Host "⏳ (2/5) Found latest release $release for $architecture..." if ($IsWinEnv) { if ($UseMSI) { @@ -379,9 +384,10 @@ try { } elseif ($IsMacOSEnv) { $packageName = "powershell-${release}-osx-${architecture}.tar.gz" } + Write-Host "⏳ (3/5) Package name to download is $packageName..." $downloadURL = "https://github.com/PowerShell/PowerShell/releases/download/v${release}/${packageName}" - Write-Host "⏳ (1/2) Loading $downloadURL" + Write-Host "⏳ (4/5) Loading $downloadURL" $packagePath = Join-Path -Path $tempDir -ChildPath $packageName if (!$PSVersionTable.ContainsKey('PSEdition') -or $PSVersionTable.PSEdition -eq "Desktop") { From 965b63ea1e9dd40076a32fdbaf1870cb0573aa31 Mon Sep 17 00:00:00 2001 From: Markus Fleschutz Date: Fri, 12 Jan 2024 19:37:08 +0100 Subject: [PATCH 2/2] Update install-powershell.ps1 --- scripts/install-powershell.ps1 | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/scripts/install-powershell.ps1 b/scripts/install-powershell.ps1 index 7dc1d436..37f689b6 100755 --- a/scripts/install-powershell.ps1 +++ b/scripts/install-powershell.ps1 @@ -247,22 +247,12 @@ function Add-PathTToSettings { } if ($IsLinux) { - $Name = $PSVersionTable.OS - if ($Name -like "*-generic *") { - if ([System.Environment]::Is64BitOperatingSystem) { - $architecture = "x64" - } else { - $architecture = "x86" - } - } elseif ($Name -like "*-raspi *") { - if ([System.Environment]::Is64BitOperatingSystem) { - $architecture = "arm64" - } else { - $architecture = "arm32" - } - } else { - $architecture = "x64" - } + $platform = (uname -i) + if ($platform -eq "x86_64") { $architecture = "x64" } + elseif ($platform -eq "x86_32") { $architecture = "x86" } + elseif ($platform -eq "aarch64") { $architecture = "arm64" } + elseif ($platform -eq "aarch32") { $architecture = "arm32" } + else { Write-Host "Unknown platform $platform" } } elseif (-not $IsWinEnv) { $architecture = "x64" } elseif ($(Get-ComputerInfo -Property OsArchitecture).OsArchitecture -eq "ARM 64-bit Processor") {