-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Add 'install-powershell.ps1' to install powershell core on windows #5383
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The Travis CI was successful too, but it's not refreshed here. Please click "Details" to see the builds. |
tools/install-powershell.ps1
Outdated
| $ErrorActionPreference = "Stop" | ||
|
|
||
| if (-not $Destination) { | ||
| $Destination = "~/pscore" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we default to ~/.pscore following .dotnet convention?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have a preference here. But on windows dotnet-install.ps1 actually installs dotnet in $env:LOCALAPPDATA\Microsoft\dotnet\, only the some helping files are placed in ~/.dotnet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps we should use $env:LOCALAPPDATA\Microsoft\powershell
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, will change to that path.
tools/install-powershell.ps1
Outdated
| $Destination = Resolve-Path -Path $Destination | ForEach-Object -MemberName Path | ||
| Write-Verbose "Destination: $Destination" -Verbose | ||
|
|
||
| $architecture = Get-CimInstance win32_operatingsystem | ForEach-Object { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems overkill to check architecture, I would simply use:
switch ($env:PROCESSOR_ARCHITECTURE) {
...
}There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$env:PROCESSOR_ARCHITECTURE shows x86 from a x86 windows powershell on a x64 machine. That's why I turned to win32_operatingsystem.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems like someone deliberately running x86 powershell would expect to install x86 pscore. Not a blocking issue, but seems unnecessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will change back to $env:PROCESSOR_ARCHITECTURE. It would be rare for someone to run a x86 powershell on a x64 machine anyways. We can fix it If it turns out to be an issue.
| Expand-Archive -Path $packagePath -DestinationPath $Destination | ||
| } | ||
|
|
||
| if ($AddToPath -and (-not $env:Path.Contains($Destination))) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a case where the user wouldn't addtopath? Seems like this would be the primary use case? Perhaps have -DoNotAddToPath instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think when installing daily build package, a user possibly doesn't want it to be added to Path by default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm thinking the opposite where for daily self-hosting, I would want it in the path, although it would only need to be added once, so this isn't a big deal. I'm fine leaving it the way it is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK. I will leave it unchanged.
tools/install-powershell.ps1
Outdated
| if ($AddToPath -and (-not $env:Path.Contains($Destination))) { | ||
| ## Add to the User scope 'Path' environment variable | ||
| $userPath = [System.Environment]::GetEnvironmentVariable("Path", "User") | ||
| $userPath += [System.IO.Path]::PathSeparator + $Destination |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be in front?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, will change to add in front.
|
macOS CI was canceled several times. This PR only affects AppVeyor CI runs, and given that I will merge this PR. |
Fix #5348 #5367
Add
install-powershell.ps1to install powershell core packages on windows.Update
Start-PSBootStrapto check and install latest PSCore package.