Skip to content

Commit

Permalink
(chocolatey-archiveGH-134) Only Enable AutoUninstaller in 0.9.9.x
Browse files Browse the repository at this point in the history
In 0.9.10, auto uninstaller should be enabled by default, so there is
no need to run to enable it.
  • Loading branch information
ferventcoder committed Jul 8, 2016
1 parent 9aa8af7 commit 3bff50c
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,20 @@
# version less than 0.9.9 and we don't know what the
# user may link to - it could be an older version of
# Chocolatey
if versioncmp($chocolatey::chocolatey_version, '0.9.9.0') >= 0 {

# lint:ignore:80chars
if versioncmp($chocolatey::chocolatey_version, '0.9.9.0') >= 0 and versioncmp($chocolatey::chocolatey_version, '0.9.10.0') < 0 {
$_choco_exe_path = "${chocolatey::choco_install_location}\\bin\\choco.exe"

$_enable_autouninstaller = $chocolatey::enable_autouninstaller ? {
false => 'disable',
default => 'enable'
}

if versioncmp($chocolatey::chocolatey_version, '0.9.10.0') >= 0 {
$_find_str = "autoUninstaller|${_enable_autouninstaller}d|"
} else {
$_find_str = "autoUninstaller - [${_enable_autouninstaller}d]"
}

# lint:ignore:80chars
exec { "chocolatey_autouninstaller_${_enable_autouninstaller}":
path => $::path,
command => "${_choco_exe_path} feature -r ${_enable_autouninstaller} -n autoUninstaller",
unless => "cmd.exe /c ${_choco_exe_path} feature list -r | findstr /B /I /C:\"${_find_str}\"",
unless => "cmd.exe /c ${_choco_exe_path} feature list -r | findstr /B /I /C:\"autoUninstaller - [${_enable_autouninstaller}d]\"",
environment => ["ChocolateyInstall=${::chocolatey::choco_install_location}"]
}
# lint:endignore
Expand Down

0 comments on commit 3bff50c

Please sign in to comment.