Skip to content

Commit

Permalink
(chocolatey-archiveGH-427) Account for checksumming x64 urls as well
Browse files Browse the repository at this point in the history
  • Loading branch information
ferventcoder committed Mar 1, 2014
1 parent ec460cb commit 5519d60
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 11 deletions.
12 changes: 10 additions & 2 deletions src/helpers/functions/Get-ChocolateyWebFile.ps1
Expand Up @@ -39,9 +39,11 @@ param(
[string] $url,
[string] $url64bit = '',
[string] $checksum = '',
[string] $checksumType = ''
[string] $checksumType = '',
[string] $checksum64 = '',
[string] $checksumType64 = $checksumType
)
Write-Debug "Running 'Get-ChocolateyWebFile' for $packageName with url:`'$url`', fileFullPath:`'$fileFullPath`', url64bit:`'$url64bit`', checksum: `'$checksum`', checksumType: `'$checksumType`'";
Write-Debug "Running 'Get-ChocolateyWebFile' for $packageName with url:`'$url`', fileFullPath:`'$fileFullPath`', url64bit:`'$url64bit`', checksum: `'$checksum`', checksumType: `'$checksumType`', checksum64: `'$checksum64`', checksumType64: `'$checksumType64`'";

$url32bit = $url;
$bitWidth = 32
Expand All @@ -55,6 +57,12 @@ param(
Write-Debug "Setting url to '$url64bit' and bitPackage to $bitWidth"
$bitPackage = $bitWidth
$url = $url64bit;
# only set if urls are different
if ($url32bit -ne $url64bit) {
$checksum = $checksum64
}

$checksumType = $checksumType64
}

$forceX86 = $env:chocolateyForceX86;
Expand Down
8 changes: 5 additions & 3 deletions src/helpers/functions/Install-ChocolateyPackage.ps1
Expand Up @@ -49,18 +49,20 @@ param(
[string] $url64bit = '',
$validExitCodes = @(0),
[string] $checksum = '',
[string] $checksumType = ''
[string] $checksumType = '',
[string] $checksum64 = '',
[string] $checksumType64 = ''
)

try {
Write-Debug "Running 'Install-ChocolateyPackage' for $packageName with url:`'$url`', args: `'$silentArgs`', fileType: `'$fileType`', url64bit: `'$url64bit`', checksum: `'$checksum`', checksumType: `'$checksumType`', validExitCodes: `'$validExitCodes`' ";
Write-Debug "Running 'Install-ChocolateyPackage' for $packageName with url:`'$url`', args: `'$silentArgs`', fileType: `'$fileType`', url64bit: `'$url64bit`', checksum: `'$checksum`', checksumType: `'$checksumType`', checksum64: `'$checksum64`', checksumType64: `'$checksumType64`', validExitCodes: `'$validExitCodes`' ";

$chocTempDir = Join-Path $env:TEMP "chocolatey"
$tempDir = Join-Path $chocTempDir "$packageName"
if (![System.IO.Directory]::Exists($tempDir)) {[System.IO.Directory]::CreateDirectory($tempDir) | Out-Null}
$file = Join-Path $tempDir "$($packageName)Install.$fileType"

Get-ChocolateyWebFile $packageName $file $url $url64bit -checksum $checksum -checksumType $checksumType
Get-ChocolateyWebFile $packageName $file $url $url64bit -checksum $checksum -checksumType $checksumType -checksum64 $checksum64 -checksumType64 $checksumType64
Install-ChocolateyInstallPackage $packageName $fileType $silentArgs $file -validExitCodes $validExitCodes
Write-ChocolateySuccess $packageName
} catch {
Expand Down
8 changes: 5 additions & 3 deletions src/helpers/functions/Install-ChocolateyPowershellCommand.ps1
Expand Up @@ -5,14 +5,16 @@ param(
[string] $url ='',
[string] $url64bit = '',
[string] $checksum = '',
[string] $checksumType = ''
[string] $checksumType = '',
[string] $checksum64 = '',
[string] $checksumType64 = ''
)
Write-Debug "Running 'Install-ChocolateyPowershellCommand' for $packageName with psFileFullPath:`'$psFileFullPath`', url: `'$url`', url64bit:`'$url64bit`', checkSum: `'$checksum`', checksumType: `'$checksumType`' ";
Write-Debug "Running 'Install-ChocolateyPowershellCommand' for $packageName with psFileFullPath:`'$psFileFullPath`', url: `'$url`', url64bit:`'$url64bit`', checkSum: `'$checksum`', checksumType: `'$checksumType`', checkSum64: `'$checksum64`', checksumType64: `'$checksumType64`' ";

try {

if ($url -ne '') {
Get-ChocolateyWebFile $packageName $psFileFullPath $url $url64bit -checksum $checksum -checksumType $checksumType
Get-ChocolateyWebFile $packageName $psFileFullPath $url $url64bit -checksum $checksum -checksumType $checksumType -checksum64 $checksum64 -checksumType64 $checksumType64
}

$nugetPath = $(Split-Path -parent $(Split-Path -parent $helpersPath))
Expand Down
8 changes: 5 additions & 3 deletions src/helpers/functions/Install-ChocolateyZipPackage.ps1
Expand Up @@ -40,9 +40,11 @@ param(
[string] $url64bit = $url,
[string] $specificFolder ="",
[string] $checksum = '',
[string] $checksumType = ''
[string] $checksumType = '',
[string] $checksum64 = '',
[string] $checksumType64 = ''
)
Write-Debug "Running 'Install-ChocolateyZipPackage' for $packageName with url:`'$url`', unzipLocation: `'$unzipLocation`', url64bit: `'$url64bit`', specificFolder: `'$specificFolder`', checksum: `'$checksum`', checksumType: `'$checksumType`' ";
Write-Debug "Running 'Install-ChocolateyZipPackage' for $packageName with url:`'$url`', unzipLocation: `'$unzipLocation`', url64bit: `'$url64bit`', specificFolder: `'$specificFolder`', checksum: `'$checksum`', checksumType: `'$checksumType`', checksum64: `'$checksum64`', checksumType64: `'$checksumType64`' ";

try {
$fileType = 'zip'
Expand All @@ -52,7 +54,7 @@ param(
if (![System.IO.Directory]::Exists($tempDir)) {[System.IO.Directory]::CreateDirectory($tempDir)}
$file = Join-Path $tempDir "$($packageName)Install.$fileType"

Get-ChocolateyWebFile $packageName $file $url $url64bit -checkSum $checkSum -checksumType $checksumType
Get-ChocolateyWebFile $packageName $file $url $url64bit -checkSum $checkSum -checksumType $checksumType -checkSum64 $checkSum64 -checksumType64 $checksumType64
Get-ChocolateyUnzip "$file" $unzipLocation $specificFolder $packageName

Write-ChocolateySuccess $packageName
Expand Down

0 comments on commit 5519d60

Please sign in to comment.