Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

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

Merged
daxian-dbw merged 4 commits into
PowerShell:masterPowerShell/PowerShell:masterfrom
daxian-dbw:enhancedaxian-dbw/PowerShell:enhanceCopy head branch name to clipboard
Nov 11, 2017
Merged

Enhance 'install-powershell.ps1' to work on Linux/MacOS#5411
daxian-dbw merged 4 commits into
PowerShell:masterPowerShell/PowerShell:masterfrom
daxian-dbw:enhancedaxian-dbw/PowerShell:enhanceCopy head branch name to clipboard

Conversation

@daxian-dbw

Copy link
Copy Markdown
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".

@adityapatwardhan adityapatwardhan left a comment

Copy link
Copy Markdown
Member

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
Copy Markdown
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

@daxian-dbw daxian-dbw Nov 10, 2017

Copy link
Copy Markdown
Member Author

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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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

Morty Proxy This is a proxified and sanitized view of the page, visit original site.