Skip to content

Commit

Permalink
Merge branch '(chocolateyGH-83)_DL_Progress' into development
Browse files Browse the repository at this point in the history
  • Loading branch information
jrdnr committed Nov 14, 2017
2 parents 57679c1 + 35fa6d3 commit 048aed8
Showing 1 changed file with 25 additions and 4 deletions.
29 changes: 25 additions & 4 deletions DSCResources/cChocoPackageInstall/cChocoPackageInstall.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,12 @@ function InstallPackage
if ($cParams) {
$chocoinstallparams += " $cParams"
}
# Check if Chocolatey version is Greater than 0.10.4, and add --no-progress
$chocoVer = [system.version](Get-ChocoInstalledPackage | Where-Object { $_.name -eq 'chocolatey' }).Version
if ($chocoVer -ge 0.10.4) {
$chocoinstallparams += " --no-progress"
}

Write-Verbose -Message "Install command: 'choco install $pName $chocoinstallparams'"

$packageInstallOuput = Invoke-Expression -Command "choco install $pName $chocoinstallparams"
Expand Down Expand Up @@ -270,14 +276,23 @@ function UninstallPackage
if (-not ($pParams))
{
Write-Verbose -Message 'Uninstalling Package Standard'
$packageUninstallOuput = choco uninstall $pName -y
}
elseif ($pParams)
{
[string]$ChocoUninstallparams = '-y'
if ($pParams) {
Write-Verbose -Message "Uninstalling Package with params $pParams"
$packageUninstallOuput = choco uninstall $pName --params="$pParams" -y
$ChocoUninstallparams += " --params=`"$pParams`""
}
if ($pVersion) {
$ChocoUninstallparams += " --version=`"$pVersion`""
}
# Check if Chocolatey version is Greater than 0.10.4, and add --no-progress
$chocoVer = [system.version](Get-ChocoInstalledPackage | Where-Object { $_.name -eq 'chocolatey' }).Version
if ($chocoVer -ge 0.10.4) {
$chocoinstallparams += " --no-progress"
}

$packageUninstallOuput = choco uninstall $ChocoUninstallparams

Write-Verbose -Message "Package uninstall output $packageUninstallOuput "

# Clear Package Cache
Expand Down Expand Up @@ -392,6 +407,12 @@ Function Upgrade-Package {
if ($cParams) {
$chocoupgradeparams += " $cParams"
}
# Check if Chocolatey version is Greater than 0.10.4, and add --no-progress
$chocoVer = [system.version](Get-ChocoInstalledPackage | Where-Object { $_.name -eq 'chocolatey' }).Version
if ($chocoVer -ge 0.10.4) {
$chocoinstallparams += " --no-progress"
}

$cmd = "choco upgrade $pName $chocoupgradeparams"
Write-Verbose -Message "Upgrade command: '$cmd'"

Expand Down

2 comments on commit 048aed8

@jbpaux
Copy link

@jbpaux jbpaux commented on 048aed8 Nov 22, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line 291 shouldn't it be $chocoUninstallparams instead of $chocoinstallparams ?
line 413, shouldn't it be $chocoupgradeparams instead of $chocoinstallparams ?

@jrdnr
Copy link
Owner Author

@jrdnr jrdnr commented on 048aed8 Nov 23, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes you are correct. I had intended to come back and fix but just hadn't gotten back to push it. Thanks for the reminder

Please sign in to comment.