diff --git a/src/chocolatey.resources/helpers/functions/Get-CheckSumValid.ps1 b/src/chocolatey.resources/helpers/functions/Get-CheckSumValid.ps1 index f71df1c10a..8dfb96e62f 100644 --- a/src/chocolatey.resources/helpers/functions/Get-CheckSumValid.ps1 +++ b/src/chocolatey.resources/helpers/functions/Get-CheckSumValid.ps1 @@ -20,6 +20,10 @@ param( [string] $checksumType = 'md5' ) Write-Debug "Running 'Get-ChecksumValid' with file:`'$file`', checksum: `'$checksum`', checksumType: `'$checksumType`'"; + if ($env:chocolateyIgnoreChecksums -eq 'true') { + Write-Warning "Ignoring checksums due to feature checksumFiles = false or config ignoreChecksums = true." + return + } if ($checksum -eq '' -or $checksum -eq $null) { return } if (!([System.IO.File]::Exists($file))) { throw "Unable to checksum a file that doesn't exist - Could not find file `'$file`'" } diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyInstallCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyInstallCommand.cs index c85ff210aa..8c7539a5c0 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyInstallCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyInstallCommand.cs @@ -83,6 +83,12 @@ public void configure_argument_parser(OptionSet optionSet, ChocolateyConfigurati .Add("p=|password=", "Password - the user's password to the source. Defaults to empty.", option => configuration.SourceCommand.Password = option.remove_surrounding_quotes()) + .Add("ignorechecksums|ignore-checksums", + "IgnoreChecksums - Ignore checksums provided by the package", + option => + { + if (option != null) configuration.Features.CheckSumFiles = false; + }) ; //todo: Checksum / ChecksumType defaults to md5 / package name can be a url / installertype diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyUpgradeCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyUpgradeCommand.cs index ac76ae8392..a44c72e233 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyUpgradeCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyUpgradeCommand.cs @@ -88,6 +88,12 @@ public virtual void configure_argument_parser(OptionSet optionSet, ChocolateyCon .Add("p=|password=", "Password - the user's password to the source. Defaults to empty.", option => configuration.SourceCommand.Password = option.remove_surrounding_quotes()) + .Add("ignorechecksums|ignore-checksums", + "IgnoreChecksums - Ignore checksums provided by the package", + option => + { + if (option != null) configuration.Features.CheckSumFiles = false; + }) ; } diff --git a/src/chocolatey/infrastructure.app/services/PowershellService.cs b/src/chocolatey/infrastructure.app/services/PowershellService.cs index 44d3937686..6df127fa7a 100644 --- a/src/chocolatey/infrastructure.app/services/PowershellService.cs +++ b/src/chocolatey/infrastructure.app/services/PowershellService.cs @@ -208,6 +208,10 @@ public bool run_action(ChocolateyConfiguration configuration, PackageResult pack if (configuration.Verbose) { Environment.SetEnvironmentVariable("ChocolateyEnvironmentVerbose", "true"); + } + if (!configuration.Features.CheckSumFiles) + { + Environment.SetEnvironmentVariable("ChocolateyIgnoreChecksums", "true"); } //todo:if (configuration.NoOutput) //{