From 0ad1759cd5e5e47c4e121123420a9b08296152a3 Mon Sep 17 00:00:00 2001 From: Markus Fleschutz Date: Sun, 3 Nov 2024 12:17:40 +0100 Subject: [PATCH] Updated install-powershell.ps1 --- scripts/install-powershell.ps1 | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/scripts/install-powershell.ps1 b/scripts/install-powershell.ps1 index 489afe6e..377d2425 100755 --- a/scripts/install-powershell.ps1 +++ b/scripts/install-powershell.ps1 @@ -125,7 +125,7 @@ function Remove-Destination([string]$Destination) { Remove-Item "$Destination.old" -Recurse -Force } if ($IsWinEnv -and ($Destination -eq $PSHOME)) { - Write-Host "⏳ (4/5) Removing old installation at $Destination... " + Write-Host "⏳ (3/4) Removing old installation at $Destination... " # handle the case where the updated folder is currently in use Get-ChildItem -Recurse -File -Path $PSHOME | ForEach-Object { if ($_.extension -eq ".old") { @@ -135,7 +135,7 @@ function Remove-Destination([string]$Destination) { } } } else { - Write-Host "⏳ (4/5) Moving old installation to $($Destination).old... " + Write-Host "⏳ (3/4) Moving old installation to $($Destination).old... " # Unix systems don't keep open file handles so you can just move files/folders even if in use sudo mv "$Destination" "$($Destination).old" } @@ -355,7 +355,7 @@ try { tar zxf $packagePath -C $contentPath } } else { - Write-Host "⏳ (1/5) Querying infos from https://raw.githubusercontent.com ..." + Write-Host "⏳ (1/4) Querying infos 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' @@ -378,10 +378,10 @@ try { } elseif ($IsMacOSEnv) { $packageName = "powershell-${release}-osx-${architecture}.tar.gz" } - Write-Host "⏳ (2/5) Latest release is $release for $architecture, package name is $packageName ..." + Write-Host " Latest release is $release for $architecture, package name is: $packageName" $downloadURL = "https://github.com/PowerShell/PowerShell/releases/download/v${release}/${packageName}" - Write-Host "⏳ (3/5) Loading $downloadURL" + Write-Host "⏳ (2/4) Loading $downloadURL" $packagePath = Join-Path -Path $tempDir -ChildPath $packageName if (!$PSVersionTable.ContainsKey('PSEdition') -or $PSVersionTable.PSEdition -eq "Desktop") { @@ -424,6 +424,7 @@ try { Expand-ArchiveInternal -Path $packagePath -DestinationPath $contentPath } } else { + Write-Host "Extracting..." tar zxf $packagePath -C $contentPath } } @@ -431,7 +432,7 @@ try { if (-not $UseMSI) { Remove-Destination $Destination if (Test-Path $Destination) { - Write-Verbose "Copying files" -Verbose + Write-Host "Copying files..." # only copy files as folders will already exist at $Destination Get-ChildItem -Recurse -Path "$contentPath" -File | ForEach-Object { $DestinationFilePath = Join-Path $Destination $_.fullname.replace($contentPath, "") @@ -441,7 +442,7 @@ try { $null = New-Item -Path (Split-Path -Path $Destination -Parent) -ItemType Directory -ErrorAction SilentlyContinue Move-Item -Path $contentPath -Destination $Destination } else { - Write-Host "⏳ (5/5) Moving new installation to $Destination... " + Write-Host "⏳ (4/4) Moving new installation to $Destination... " & sudo mv "$contentPath" "$Destination" } }