Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 18 additions & 9 deletions WASP/Private/Install-ChocolateyInstallPackage.ps1
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
function Install-ChocolateyInstallPackage() {
<#
.SYNOPSIS
This function overrides the Install-ChocolateyInstallPackage function and receives an optional filepath. It checks if the binary already exists or if it has to be downloaded first.
This function checks if the binary already exists or if it has to be downloaded first and overrides the Install-ChocolateyInstallPackage function.

.DESCRIPTION
This function receives and saves the parameters which are given in the package script.
If there is file parameter given the function checks if the binary exists or not. If it does not exist the VERIFICATION.txt will be checked to retrieve an url and checksums.

With this parameters the Chocolatey Web downloader can be started and the binary can be downloaded into the tools folder of the package.
In the end the script gets modified by calling the Edit-ChocolateyInstaller script.
Prior to this step the script gets modified by calling the Edit-ChocolateyInstaller script.

.PARAMETER all
For further information to the parameters:
Expand Down Expand Up @@ -149,13 +148,22 @@ function Install-ChocolateyInstallPackage() {
}
}

# Check the url found above ($url or $url64bit) and download the file
if ($null -ne $url) {
$urlFound = $url
} elseif ($null -ne $url64bit) {
# Check the url found above ($url or $url64bit) and download the file. url64bit is preferred over url32 bit!
$urlFound = ''

if ($url64bit -ne '' -and $null -ne $url64bit) {
$urlFound = $url64bit
}
} elseif ($url -ne '' -and $null -ne $url) {
$urlFound = $url
}

if ($urlFound -eq ''){
Write-Log "No url in Package found - Stop! url64bit: $url64bit, url: $url" -Severity 3
exit 1
}

Write-Log "Found the following URL: $urlFound" -Severity 1

Write-Log "Start editing chocolateyInstall..." -Severity 1

$defaultFileName = $urlFound.Split("/")[-1]
Expand All @@ -166,7 +174,8 @@ function Install-ChocolateyInstallPackage() {
$downloadFilePath = Join-Path (Join-Path (Get-Item -Path ".\").FullName "tools") "$($packageName)Install.$fileType"
$checksumType = Get-ChecksumTypeFromVerificationFile -Checksums $checksum, $checksum64
$checksumType64 = $checksumType


# Get-ChocolateyWebFile works like this: url64bit is preferred over url32 bit!
$null = Get-ChocolateyWebFile -PackageName $packageName `
-FileFullPath $downloadFilePath `
-Url $url `
Expand Down
26 changes: 18 additions & 8 deletions WASP/Private/Install-ChocolateyPackage.ps1
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
function Install-ChocolateyPackage() {
<#
.SYNOPSIS
This function overrides the Install-ChocolateyPackage function and receives an url and checksums to download the package binary.
This function receives an url and checksums to download the package binary and overrides the Install-ChocolateyPackage.

.DESCRIPTION
This function receives and saves the parameters which are given in the package script.
With this parameters the Chocolatey Web downloader can be started and the binary can be downloaded into the tools folder of the package.
In the end the script gets modified by calling the Edit-ChocolateyInstaller script.
With this parameters the Chocolatey Web downloader can be started and the binary can be downloaded into the tools folder of the package.
Prior to this step the script gets modified by calling the Edit-ChocolateyInstaller script.

.PARAMETER all
For further information to the parameters:
Expand Down Expand Up @@ -37,12 +37,21 @@ function Install-ChocolateyPackage() {
[parameter(ValueFromRemainingArguments = $true)][Object[]] $ignoredArguments
)

# Check the url found above ($url or $url64bit) and download the file
if ($null -ne $url) {
$urlFound = $url
} elseif ($null -ne $url64bit) {
# Check the url found above ($url or $url64bit) and download the file. url64bit is preferred over url32 bit!
$urlFound = ''

if ($url64bit -ne '' -and $null -ne $url64bit) {
$urlFound = $url64bit
}
} elseif ($url -ne '' -and $null -ne $url) {
$urlFound = $url
}

if ($urlFound -eq ''){
Write-Log "No url in Package found - Stop! url64bit: $url64bit, url: $url" -Severity 3
exit 1
}

Write-Log "Found the following URL: $urlFound" -Severity 1

Write-Log "Start editing chocolateyInstall..." -Severity 1

Expand All @@ -58,6 +67,7 @@ function Install-ChocolateyPackage() {

if ($url -or $url64bit) {
$downloadFilePath = Join-Path (Join-Path (Get-Item -Path ".\").FullName "tools") "$($packageName)Install.$fileType"
# Get-ChocolateyWebFile works like this: url64bit is preferred over url32 bit!
$null = Get-ChocolateyWebFile -PackageName $packageName `
-FileFullPath $downloadFilePath `
-Url $url `
Expand Down
24 changes: 17 additions & 7 deletions WASP/Private/Install-ChocolateyPowershellCommand.ps1
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
function Install-ChocolateyPowershellCommand() {
<#
.SYNOPSIS
This function overrides the Install-ChocolateyPowershellCommand function and receives an url and checksums to download the package binary.
This function receives an url and checksums to download the package binary and overrides the Install-ChocolateyPowershellCommand function.

.DESCRIPTION
This function receives and saves the parameters which are given in the package script.
With this parameters the Chocolatey Web downloader can be started and the binary can be downloaded into the tools folder of the package.
In the end the script gets modified by calling the Edit-ChocolateyInstaller script.
Prior to this step the script gets modified by calling the Edit-ChocolateyInstaller script.

.PARAMETER all
For further information to the parameters:
Expand All @@ -31,12 +31,21 @@ function Install-ChocolateyPowershellCommand() {

$downloadFilePath = Join-Path (Join-Path (Get-Item -Path ".\").FullName "tools") "$($packageName)Install.ps1"

# Check the url found above ($url or $url64bit) and download the file
if ($null -ne $url) {
$urlFound = $url
} elseif ($null -ne $url64bit) {
# Check the url found above ($url or $url64bit) and download the file. url64bit is preferred over url32 bit!
$urlFound = ''

if ($url64bit -ne '' -and $null -ne $url64bit) {
$urlFound = $url64bit
}
} elseif ($url -ne '' -and $null -ne $url) {
$urlFound = $url
}

if ($urlFound -eq ''){
Write-Log "No url in Package found - Stop! url64bit: $url64bit, url: $url" -Severity 3
exit 1
}

Write-Log "Found the following URL: $urlFound" -Severity 1

Write-Log "Start editing chocolateyInstall..." -Severity 1

Expand All @@ -52,6 +61,7 @@ function Install-ChocolateyPowershellCommand() {
New-Item -Path (Join-Path (Join-Path (Get-Item -Path ".\").FullName "tools") "overridden.info") -Force

if ($url -or $url64bit) {
# Get-ChocolateyWebFile works like this: url64bit is preferred over url32 bit!
$null = Get-ChocolateyWebFile -PackageName $packageName `
-FileFullPath $downloadFilePath `
-Url $url `
Expand Down
25 changes: 17 additions & 8 deletions WASP/Private/Install-ChocolateyZipPackage.ps1
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
function Install-ChocolateyZipPackage() {
<#
.SYNOPSIS
This function overrides the Install-ChocolateyZipPackage function and receives a optional filepath or an url to a zip file. Depending on the input the functions downloads and/or unzips the binaries.
This function downloads and/or unzips the binaries and overrides the Install-ChocolateyZipPackage function and receives a optional filepath or an url to a zip file.

.DESCRIPTION
This function receives and saves the parameters which are given in the package script.
If there is file parameter given the function checks if the binary exists or not. If it does not exist and there is also no url given the VERIFICATION.txt will be checked to retrieve an url and checksums.
If there is a url given or a url found in the VERIFICATION.txt file it will be downloaded.
Afterwards the zip will be unpacked into the tools folder.

In the end the script gets modified by calling the Edit-ChocolateyInstaller script.
Prior the script gets modified by calling the Edit-ChocolateyInstaller script.

.PARAMETER all
For further information to the parameters:
Expand Down Expand Up @@ -116,12 +115,21 @@ function Install-ChocolateyZipPackage() {
$checksumType64 = $checksumType
}

# Check the url found above ($url or $url64bit) and download the file
if ($null -ne $url) {
$urlFound = $url
} elseif ($null -ne $url64bit) {
# Check the url found above ($url or $url64bit) and download the file. url64bit is preferred over url32 bit!
$urlFound = ''

if ($url64bit -ne '' -and $null -ne $url64bit) {
$urlFound = $url64bit
}
} elseif ($url -ne '' -and $null -ne $url) {
$urlFound = $url
}

if ($urlFound -eq ''){
Write-Log "No url in Package found - Stop! url64bit: $url64bit, url: $url" -Severity 3
exit 1
}

Write-Log "Found the following URL: $urlFound" -Severity 1

Write-Log "Start editing chocolateyInstall..." -Severity 1

Expand All @@ -133,6 +141,7 @@ function Install-ChocolateyZipPackage() {

try {
if (-Not $remoteFile) {
# Get-ChocolateyWebFile works like this: url64bit is preferred over url32 bit!
$null = Get-ChocolateyWebFile -PackageName $packageName `
-FileFullPath $downloadFilePath `
-Url $url `
Expand Down
Loading