Skip to content

added 64bit support & vscode-insiders install support #1137

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

Merged
merged 6 commits into from
Dec 28, 2017

Conversation

tabs-not-spaces
Copy link
Contributor

Added a new parameter to be able to install stable / insiders edition based on value of "BuildEdition" parameter. added non-literal paths for install media to support 64-bit installation.

Needs more work to support 32-bit / 64-bit installation.

@msftclas
Copy link

msftclas commented Dec 28, 2017

CLA assistant check
All CLA requirements met.

@@ -92,27 +105,38 @@
#>
[CmdletBinding()]
param(
[parameter()]
[ValidateSet("stable","insider")]
[string]$BuildEdition = "stable",
Copy link
Contributor

Choose a reason for hiding this comment

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

Please separate each parameter with a blank line - ditto between lines 113 and 114 - for consistency (see Start-EditorServices.ps1).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changes made as per comment

@@ -100,19 +117,28 @@ param(
)
Copy link
Contributor

Choose a reason for hiding this comment

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

What if you added an Architecture parameter that defaults to 64bit but also allows a 32bit value. Then you could test the specific install path (either under Program Files or Program Files (x86) and download the specified bit-version to install.

Copy link
Contributor Author

@tabs-not-spaces tabs-not-spaces Dec 28, 2017

Choose a reason for hiding this comment

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

Yep - easy inclusion. I'll add it now.

Another option would be to simply install based on a OSArchitecture check - but if the goal is to allow custom installs, then I suppose it's better to give the end user the option to chose arch?

@tabs-not-spaces
Copy link
Contributor Author

Architecture params added with failsafe for someone choosing 64bit on a 32bit system.

@@ -92,6 +114,14 @@
#>
[CmdletBinding()]
param(
[parameter()]
[ValidateSet(,"64","32")]
Copy link
Contributor

Choose a reason for hiding this comment

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

If you use 64bit and 32bit, then you can use $Architecture in the Write-Host output to indicate which bit-version is being installed. Or I guess you could use " ... ${Architecture}-bit ..." but I think the args 64bit / 32bit read a bit nicer.


switch ($Architecture) {
"64" {
if ((Get-WmiObject -Class Win32_OperatingSystem).OSArchitecture -eq "64-bit") {
Copy link
Contributor

Choose a reason for hiding this comment

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

You'll want to use Get-CimInstance here. No GWMI in PS Core - even on Windows.

@tabs-not-spaces
Copy link
Contributor Author

architecture params are now set to "32-bit" & "64-bit". GWMI replaced with GCIM as per request. Write-Hosts changed to display app name and architecture build.


switch ($Architecture) {
"64-bit" {
if ((Get-WmiObject -Class Win32_OperatingSystem).OSArchitecture -eq "64-bit") {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you forgot the change to use Get-CimInstance. :-) Other than that, I think this is ready to merge.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

shit! good catch. I put it in my clipboard and forgot to paste it 💀

break;
}
"32-bit" {
$codePath = ${env:ProgramFiles(x86)}
Copy link
Contributor

Choose a reason for hiding this comment

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

Oops, missed this ... sorry. I'm pretty sure on a 32-bit OS you'd use just ${env:ProgramFiles}. ${env:ProgramFiles(x86)} is unique to the 64-bit version of Windows. See https://en.wikipedia.org/wiki/Environment_variable#Windows

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh yes. of course. I'll add in the idiot proofing for 32-bit on 64-bit now.

@tabs-not-spaces
Copy link
Contributor Author

alright so now if you choose 64bit you will get 64bit or 32 bit based on OSArch. If you select 32bit you will get 32bit regardless of OSArch but the $codePath variable changes to reflect the OSArch requirements.

Copy link
Contributor

@rkeithhill rkeithhill left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@TylerLeonhardt TylerLeonhardt left a comment

Choose a reason for hiding this comment

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

LGTM

@TylerLeonhardt TylerLeonhardt merged commit 7a00934 into PowerShell:master Dec 28, 2017
@TylerLeonhardt
Copy link
Member

Thanks for this @tabs-not-spaces!

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.

4 participants