chocolatey-community / chocolatey-packages

Chocolatey Community Maintainers Team Packages - packages that are managed and maintained by core community team for community package repository (https://community.chocolatey.org/packages)
https://community.chocolatey.org/profiles/chocolatey-community
Apache License 2.0
447 stars 377 forks source link

putty.install does not honour --install-directory #2473

Closed fisherhu closed 4 months ago

fisherhu commented 4 months ago

Checklist

Chocolatey Version

2.2.2

Chocolatey License

Professional

Package Version

0.81.0

Current Behaviour

It still installs under C:\, even if it sets TARGETDIR: Overriding install directory with 'TARGETDIR="F:\Program Files\PuTTY"' ... Software install location not explicitly set, it could be in package or default install location of installer.

Expected Behaviour

To install under F:\Program Files\PuTTY

Steps To Reproduce

choco install putty.install --installdirectory 'F:\Program Files\PuTTY' -y

Environment

- Operating System: Microsoft Windows NT 10.0.19045.0
- PowerShell Version: 5.1.19041.4412
- Shell: powershell

Chocolatey Log

No clue if there is any sensitive information there...

2024-05-20 17:11:54,377 9024 [WARN ] - Overriding install directory with 'TARGETDIR="F:\Program Files\PuTTY"'
2024-05-20 17:11:54,391 9024 [DEBUG] - Running licensed 'Start-ChocolateyProcessAsAdmin' with ExeToRun:'C:\Windows\System32\msiexec.exe', Statements:'/i "C:\ProgramData\chocolatey\lib\putty.install\tools\putty-64bit-0.81-installer.msi" /qn /norestart /l*v "C:\Users\fishe\AppData\Local\Temp\\chocolatey\\putty.install\0.81.0\install.log" TARGETDIR="F:\Program Files\PuTTY"', Elevated:'True', Minimized:'False', NoSleep:'False', ValidExitCodes: '0,1641,3010', WorkingDirectory:'C:\ProgramData\chocolatey\lib\putty.install\tools', AnswerFile:'' Has SensitiveStatements:'False'
2024-05-20 17:11:54,410 9024 [DEBUG] - Running ['C:\Windows\System32\msiexec.exe' /i "C:\ProgramData\chocolatey\lib\putty.install\tools\putty-64bit-0.81-installer.msi" /qn /norestart /l*v "C:\Users\fishe\AppData\Local\Temp\\chocolatey\\putty.install\0.81.0\install.log" TARGETDIR="F:\Program Files\PuTTY"]. This may take a while, depending on the statements.
2024-05-20 17:11:55,167 9024 [DEBUG] - Command ['C:\Windows\System32\msiexec.exe' /i "C:\ProgramData\chocolatey\lib\putty.install\tools\putty-64bit-0.81-installer.msi" /qn /norestart /l*v "C:\Users\fishe\AppData\Local\Temp\\chocolatey\\putty.install\0.81.0\install.log" TARGETDIR="F:\Program Files\PuTTY"] exited with '0'
2024-05-20 17:11:55,170 9024 [DEBUG] - Finishing licensed 'Start-ChocolateyProcessAsAdmin'
2024-05-20 17:11:55,172 9024 [INFO ] - putty-64bit-0.81-installer.msi has been installed.

Anything else?

No response

pauby commented 4 months ago

Have you confirmed that the PuTTY installer supports being installed to another directory from the command line?

As mentioned in the documentation (emphasis mine):

Install Directory Override - Override the default installation directory. Chocolatey will automatically determine the type of installer and pass the appropriate arguments to override the install directory. The package must use Chocolatey install helpers and be installing an installer for software.

You can see that Chocolatey CLI is doing that by adding TARGETDIR="F:\Program Files\PuTTY" to the msiexec.exe command line. If the installer ignores it then there is nothing that Chocolatey CLI can do.

fisherhu commented 4 months ago

To be honest I did not check it. Now I did. Yes, it does support via the INSTALLDIR property, i.e.:

msiexec /quiet /i putty-64bit-0.81-installer.msi INSTALLDIR="F:\Program Files\PuTTY"

did the trick.

fisherhu commented 4 months ago

Workaround, good enough for my purposes:

choco install putty.install -y --% --ia=INSTALLDIR=F:\ProgramFiles\PuTTY

The proper solution would be something like implemented in the jenkins' installer.