Skip to content
This repository has been archived by the owner on Feb 19, 2019. It is now read-only.

Problem with 64 bit option in Install-ChocolateyPackage.ps1 et al #229

Closed
Redsandro opened this issue Jan 7, 2013 · 10 comments
Closed

Problem with 64 bit option in Install-ChocolateyPackage.ps1 et al #229

Redsandro opened this issue Jan 7, 2013 · 10 comments

Comments

@Redsandro
Copy link
Contributor

Some software has an .exe installer for the 32 bit and .msi installer for the 64 bit version.

Because of this:

  • $fileType is different in both cases;
  • $silentArgs is different in both cases.

But you can specify only one.

One idea is to extract the bit-switch from Get-ChocolateyWebFile.ps1:

$processor = Get-WmiObject Win32_Processor
$procCount = (Get-WmiObject Win32_ComputerSystem).NumberofProcessors
if ($procCount -eq '1') {
    $is64bit = $processor.AddressWidth -eq 64
    Write-Debug "Processor width is $($processor.AddressWidth)."
} else {
    Write-Debug "First processor width is $($processor[0].AddressWidth)."
    $is64bit = $processor[0].AddressWidth -eq 64
}
$systemBit = '32 bit'
if ($is64bit) {
    $systemBit = '64 bit';
    $url = $url64bit;
}

...and turn it into a global Chocolatey function so every package can just do getBits() or something:

function getBits {
    $processor = Get-WmiObject Win32_Processor
    $procCount = (Get-WmiObject Win32_ComputerSystem).NumberofProcessors
    if ($procCount -eq '1') {
        return $processor.AddressWidth
    } else {
        return $processor[0].AddressWidth
    }
}
@ferventcoder
Copy link
Contributor

+1 like :D

@Redsandro
Copy link
Contributor Author

Is there a file or a proposed file that we could/should use for small
global functions like this?
I can imagine in the future it would be beneficial to globalize other small
but useful functions as well and it's a hassle to create separate files for
all of them, mainly because every file would need to be specified in that
other file that imports them all.

On Mon, Jan 7, 2013 at 6:54 PM, Rob Reynolds notifications@github.comwrote:

+1 like :D


Reply to this email directly or view it on GitHubhttps://github.com//issues/229#issuecomment-11962409.

@ferventcoder
Copy link
Contributor

Each function in chocolatey is a file, no matter how small.

@Redsandro
Copy link
Contributor Author

What's the reason for that?

For trivial but handy functions, a global tricks.ps1 or whatever might be easier on the eyes (contemplating a future where there are multiple trivial functions globalized) when looking inside the functions directory.

Just curious.
(Knowledge is acceptance and acceptance is peace of mind. ;))

@Redsandro
Copy link
Contributor Author

Can I assign myself to this?

@Redsandro
Copy link
Contributor Author

I wanted to attach the pull request here but I guess that's not possible or I am still too new with GitHub :P But here:
#231

@rismoney
Copy link
Contributor

rismoney commented Jan 8, 2013

getbits? lol - isn't get-processorAddressWidth or something more appropriate - though wordier for sure ;)

@Redsandro
Copy link
Contributor Author

The idea is to write less code, not more ;)

Also, the idea is to make sense for people less tech-savvy but with a wish to make packages. Like my grandma. She would like to make packages, and she called me three times, worried about words like processorAddressWidth. She thought it would have to be measured in centimeters haha, silly woman. She knows what bits are though, because 30 years ago she had System 1 8 bits. She also complained that it was renamed to Macintosh 128k a few years later, saying it was confusing.

Seriously though, I named the function Get-ProcessorBits in the pullrequest. Get two people to agree with you and I'll change it.

@ferventcoder
Copy link
Contributor

@Redsandro this is hilarious. :)

@ghost ghost assigned ferventcoder Apr 26, 2013
@ferventcoder
Copy link
Contributor

The PR is closed, so this is closed. :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants