Skip to content

Conversation

@daxian-dbw
Copy link
Member

Enhance 'install-powershell.ps1' to work on Linux/MacOS.

When -AddToPath is specified:

  • On Windows, add the absolute destination path to the 'User' scope environment variable 'Path';
  • On Linux, make the symlink '/usr/bin/pwsh' points to "$Destination/pwsh";
  • On MacOS, make the symlink '/usr/local/bin/pwsh' points to "$Destination/pwsh".

Copy link
Member

@adityapatwardhan adityapatwardhan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some non-blocking comments

$userPath = [System.Environment]::GetEnvironmentVariable("Path", "User")
$userPath = $Destination + [System.IO.Path]::PathSeparator + $userPath
[System.Environment]::SetEnvironmentVariable("Path", $userPath, "User")
Write-Verbose "'$Destination' is added to the Path" -Verbose
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think, since we have CmdletBinding() we should not force -verbose

Copy link
Member Author

@daxian-dbw daxian-dbw Nov 10, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These messages are actually intentionally written out so that a user roughly knows what the script is doing when running it.


Expand-Archive -Path $packagePath -DestinationPath $Destination
if ($IsWinEnv) {
Expand-Archive -Path $packagePath -DestinationPath $Destination
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we delete the compressed package after expansion?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The compressed package will be deleted. The compressed package is downloaded to $tempDir which will be deleted in the finally block at the end of the script.

@daxian-dbw
Copy link
Member Author

Linux job succeeded, but the macOS job was canceled again.
Currently install-powershell.ps1 is only used in AppVeyor bootstrapping (install latest powershell core if not found), so it won't affect macOS CI run. Given that, I will merge this PR.

@daxian-dbw daxian-dbw merged commit 2f399e2 into PowerShell:master Nov 11, 2017
@daxian-dbw daxian-dbw deleted the enhance branch November 11, 2017 01:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants