Skip to content

Commit

Permalink
(chocolateyGH-527) Url is optional
Browse files Browse the repository at this point in the history
Some packages should be able to support 64 bit only. In those
cases Chocolatey should allow 32 bit urls to be optional
and fail the package on 32 bit systems with a helpful message.
  • Loading branch information
ferventcoder committed May 3, 2016
1 parent 8c70964 commit 694c80c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ Get-FtpFile
param(
[parameter(Mandatory=$true, Position=0)][string] $packageName,
[parameter(Mandatory=$true, Position=1)][string] $fileFullPath,
[parameter(Mandatory=$true, Position=2)][string] $url,
[parameter(Mandatory=$false, Position=2)][string] $url = '',
[parameter(Mandatory=$false, Position=3)][string] $url64bit = '',
[parameter(Mandatory=$false)][string] $checksum = '',
[parameter(Mandatory=$false)][string] $checksumType = '',
Expand Down Expand Up @@ -172,6 +172,12 @@ param(
$checksumType = $checksumType32
}

# If we're on 32 bit or attempting to force 32 bit and there is no
# 32 bit url, we need to throw an error.
if ($url -eq $null -or $url -eq '') {
throw "This package does not support $bitWidth bit architecture."
}

if ($getOriginalFileName) {
try {
$fileDirectory = [System.IO.Path]::GetDirectoryName($fileFullPath)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ param(
[parameter(Mandatory=$false, Position=1)]
[alias("installerType","installType")][string] $fileType = 'exe',
[parameter(Mandatory=$false, Position=2)][string] $silentArgs = '',
[parameter(Mandatory=$false, Position=3)][string] $url,
[parameter(Mandatory=$false, Position=3)][string] $url = '',
[parameter(Mandatory=$false, Position=4)]
[alias("url64")][string] $url64bit = '',
[parameter(Mandatory=$false)]$validExitCodes = @(0),
Expand Down

0 comments on commit 694c80c

Please sign in to comment.