Files
ChocolateyPackages/Erlang16/tools/chocolateyUninstall.ps1
Iristyle 9f1c28998c fix: Erlang bin path to user PATH, don't reinst
- 100MB download was running again, even if installed already
 - need to ensure the bin dir is in PATH for access to erl
 - Handle PATH manip in install and uninstall
2013-07-17 11:28:38 -04:00

37 lines
954 B
PowerShell

$package = 'Erlang'
$installFolder = 'erl5.10.2'
try
{
$installPath = (Join-Path "${Env:\ProgramFiles(x86)}" $installFolder),
(Join-Path $Env:ProgramFiles $installFolder) |
? { Test-Path $_ } |
Select -First 1
$uninstall = Join-Path $installPath 'uninstall.exe'
#uses NSIS installer - http://nsis.sourceforge.net/Docs/Chapter3.html
$uninstallParams = @{
PackageName = $package;
FileType = 'exe';
SilentArgs = '/S';
File = $uninstall;
}
Uninstall-ChocolateyPackage @uninstallParams
$binLocation = Join-Path $installPath 'bin'
$userPaths = [Environment]::GetEnvironmentVariable('Path', 'User') -split ';' |
? { ($_ -notmatch $binLocation) -and (![String]::IsNullOrEmpty($_)) } |
Select-Object -Unique
[Environment]::SetEnvironmentVariable('Path', ($userPaths -join ';'), 'User')
Write-ChocolateySuccess $package
}
catch
{
Write-ChocolateyFailure $package "$($_.Exception.Message)"
throw
}