I created an installer that will download and install dependencies (I dont know if I am doing it right by the way).
Everything installs properly ... But by the end of the installation I am getting an obscure message. Here is my installer
function install_package {
Param([string]$package_name)
$result = choco list -lo | Where-object { $_.ToLower().StartsWith($package_name.ToLower()) }
if($null -ne $result) {
return
}
Write-Host "Installing $package_name" -ForegroundColor Green
choco install $package_name -y | Out-Null
}
function setup_env_for_exe {
Param([string]$exe_name)
refreshenv | Out-Null
$exe_path = (Get-ChildItem -Force -ErrorAction SilentlyContinue 'C:\Program Files\' -recurse -include "$exe_name.exe").DirectoryName
$envPath = [Environment]::GetEnvironmentVariable("Path", [EnvironmentVariableTarget]::Machine)
if(!$env:Path.Contains($exe_path)) {
Write-Host "Setting environment path for $exe_name" -ForegroundColor Green
[Environment]::SetEnvironmentVariable(
"Path",
$envPath + ";$exe_path",
[EnvironmentVariableTarget]::Machine)
refreshenv | Out-Null
}
}
function full_setup {
Param([string]$package_name)
install_package($package_name)
setup_env_for_exe($package_name)
}
$toolsDir = (Split-Path -parent $MyInvocation.MyCommand.Definition)
full_setup("gnuplot")
full_setup("snaketail")
install_package("mongodb")
setup_env_for_exe("mongo")
Get-ChocolateyUnzip -FileFullPath "$toolsDir\test.zip" -Destination "C:\test\"
With this script I am getting the following output:
The install of stress-test-package was successful.
Software installed to 'C:\Program Files\gnuplot\'
Why would it be installed to the gnuplot directory ?
If I remove the gnuplot setup from my script it installs indeed to my test directory. But I don't know why it's printing out that .. and the fact that nothing related to my test package is pushed to the gnuplot directory