Add 'install-powershell.ps1' to install powershell core on windows#5383
Add 'install-powershell.ps1' to install powershell core on windows#5383daxian-dbw merged 3 commits intoPowerShell:masterfrom
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.
Should we default to ~/.pscore following .dotnet convention?
There was a problem hiding this comment.
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.
Perhaps we should use $env:LOCALAPPDATA\Microsoft\powershell
There was a problem hiding this comment.
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.
This seems overkill to check architecture, I would simply use:
switch ($env:PROCESSOR_ARCHITECTURE) {
...
}There was a problem hiding this comment.
$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.
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.
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.
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.
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.
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.
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.
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.