From 09f68d4c2b6d0709eeeb0607a0f02da2e27e3416 Mon Sep 17 00:00:00 2001 From: Rob Reynolds Date: Sat, 16 May 2015 15:17:52 -0500 Subject: [PATCH 1/3] (GH-281) Fix notsilent switch NotSilent option was not working appropriately since it wasn't checked and wasn't passing overriding arguments to the installer. This fixes that behavior to allow the notsilent switch to work again. --- .../infrastructure.app/services/PowershellService.cs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/chocolatey/infrastructure.app/services/PowershellService.cs b/src/chocolatey/infrastructure.app/services/PowershellService.cs index 80d5f10246..223cc6fd4c 100644 --- a/src/chocolatey/infrastructure.app/services/PowershellService.cs +++ b/src/chocolatey/infrastructure.app/services/PowershellService.cs @@ -190,12 +190,10 @@ public bool run_action(ChocolateyConfiguration configuration, PackageResult pack Environment.SetEnvironmentVariable("TEMP", configuration.CacheLocation); - //verify how not silent is passed - //if (configuration.NotSilent) - //{ - // Environment.SetEnvironmentVariable("installerArguments", " "); - // Environment.SetEnvironmentVariable("chocolateyInstallOverride", "true"); - //} + if (configuration.NotSilent) + { + Environment.SetEnvironmentVariable("chocolateyInstallOverride", "true"); + } if (configuration.Debug) { Environment.SetEnvironmentVariable("ChocolateyEnvironmentDebug", "true"); From cc5d18de17a677521991f53fc7c9292087c80731 Mon Sep 17 00:00:00 2001 From: Sam Spilsbury Date: Thu, 7 May 2015 12:31:26 +0800 Subject: [PATCH 2/3] (GH-274) Allow unattended installs as non-admin user Previously, if a non-admin user attempted to install chocolatey, a message indicating that non-admin installs were for advanced users only would appear and block the installation. This runs contrary to chocolatey policy, so just pass -y during the unpackself command. The installation should never block. --- nuget/chocolatey/tools/chocolateysetup.psm1 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/nuget/chocolatey/tools/chocolateysetup.psm1 b/nuget/chocolatey/tools/chocolateysetup.psm1 index 9722773b4b..d615b8ffc6 100644 --- a/nuget/chocolatey/tools/chocolateysetup.psm1 +++ b/nuget/chocolatey/tools/chocolateysetup.psm1 @@ -41,9 +41,9 @@ param( $chocoNew = Join-Path $thisScriptFolder 'chocolateyInstall\choco.exe' if ($debugMode) { - & $chocoNew unpackself -fdv + & $chocoNew unpackself -fdvy } else { - & $chocoNew unpackself -f + & $chocoNew unpackself -fy } $installModule = Join-Path $thisScriptFolder 'chocolateyInstall\helpers\chocolateyInstaller.psm1' @@ -314,9 +314,9 @@ param( Copy-Item $chocoExe $chocoExeDest -force if ($debugMode) { - & $chocoExeDest unpackself -fdv + & $chocoExeDest unpackself -fdvy } else { - & $chocoExeDest unpackself -f + & $chocoExeDest unpackself -fy } } From 7f4478fac57eb899cd2acd8801deb3b001db25a5 Mon Sep 17 00:00:00 2001 From: Sam Spilsbury Date: Thu, 7 May 2015 21:13:18 +0800 Subject: [PATCH 3/3] (GH-274) Clean up how debugMode is expressed Previously we had an if condition on debugMode, but it is more concise to just express it as a string appended to the list of options passed to choco. --- nuget/chocolatey/tools/chocolateysetup.psm1 | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/nuget/chocolatey/tools/chocolateysetup.psm1 b/nuget/chocolatey/tools/chocolateysetup.psm1 index d615b8ffc6..5e3440796a 100644 --- a/nuget/chocolatey/tools/chocolateysetup.psm1 +++ b/nuget/chocolatey/tools/chocolateysetup.psm1 @@ -4,7 +4,7 @@ $sysDrive = $env:SystemDrive $tempDir = $env:TEMP $defaultChocolateyPathOld = "$sysDrive\Chocolatey" #$ErrorActionPreference = 'Stop' -$debugMode = $false +$debugModeParams = "" function Initialize-Chocolatey { <# @@ -34,17 +34,13 @@ param( Write-Debug "Initialize-Chocolatey" if ($env:ChocolateyEnvironmentDebug -eq 'true') { - $debugMode = $true + $debugModeParams = "dv" } Install-DotNet4IfMissing $chocoNew = Join-Path $thisScriptFolder 'chocolateyInstall\choco.exe' - if ($debugMode) { - & $chocoNew unpackself -fdvy - } else { - & $chocoNew unpackself -fy - } + & $chocoNew unpackself -fy$debugModeParams $installModule = Join-Path $thisScriptFolder 'chocolateyInstall\helpers\chocolateyInstaller.psm1' Import-Module $installModule -Force @@ -313,11 +309,7 @@ param( $chocoExeDest = Join-Path $chocolateyPath 'choco.exe' Copy-Item $chocoExe $chocoExeDest -force - if ($debugMode) { - & $chocoExeDest unpackself -fdvy - } else { - & $chocoExeDest unpackself -fy - } + & $chocoExeDest unpackself -fy$debugModeParams } function Ensure-ChocolateyLibFiles {