TakataSanshiro / Chocolatey-Packages

Some packages that can be installed via chocolatey.org
MIT License
15 stars 29 forks source link

tor/tor-browser: support offline install #83

Closed pyhedgehog closed 2 years ago

pyhedgehog commented 2 years ago

Steps to reproduce

  1. Download tor-win64-0.4.6.9.zip to %TEMP%\chocolatey\tor\0.4.6.9.
  2. Run cinst -y tor

Expected behaviour

Pre-downloaded file used for installation.

Actual behaviour

tor v0.4.6.9 [Approved]
tor package files install completed. Performing other installation steps.
Attempt to get headers for https://archive.torproject.org/tor-package-archive/torbrowser/11.0.3/tor-win64-0.4.6.9.zip failed.
  The remote file either doesn't exist, is unauthorized, or is forbidden for url 'https://archive.torproject.org/tor-package-archive/torbrowser
/11.0.3/tor-win64-0.4.6.9.zip'. Exception calling "GetResponse" with "0" argument(s): "The underlying connection was closed: An unexpected error occurred on a send."
Downloading tor 64 bit
  from 'https://archive.torproject.org/tor-package-archive/torbrowser/11.0.3/tor-win64-0.4.6.9.zip'

PS: Same error for tor-browser.

TakataSanshiro commented 2 years ago

I tried to install tor and tor-browser as your workflow without offline. I was able to install them with manually downloaded files from cache location. %TEMP%\chocolatey\tor\0.4.6.9\tor-win64-0.4.6.9.zip %TEMP%\chocolatey\tor-browser\11.0.4\torbrowser-install-win64-11.0.4_en-US.exe

Some log is here.

tor v0.4.6.9 [Approved]
tor package files install completed. Performing other installation steps.
File appears to be downloaded already. Verifying with package checksum to determine if it needs to be redownloaded.
Hashes match.
tor-browser v11.0.4 [Approved]
tor-browser package files install completed. Performing other installation steps.
Using Language code: 'en-US'
File appears to be downloaded already. Verifying with package checksum to determine if it needs to be redownloaded.
Hashes match.

Can you install other packages as your workflow?

pyhedgehog commented 2 years ago

You mean that this is bug in chocolatey Install-ChocolateyPackage? Seems it does http HEAD request whenever file exists or not... In this case torproject site is blocked so it got 404 and stops on this step. It seems that root cause is chocolatey/choco#2110. Thank you for answer.

TakataSanshiro commented 2 years ago

It might, you changed the cache location. choco config get cacheLocation If some folder location displayed, try to use it instead of %TEMP%\chocolatey. https://docs.chocolatey.org/en-us/guides/usage/change-cache

Can you install another package?

pyhedgehog commented 2 years ago

I've checked it with firefox. Easy recipe: Add to you %windir%\System32\drivers\etc\hosts following line:

1.1.1.1 download.mozilla.org download-installer.cdn.mozilla.net

Then attempt to do choco update firefox. Ever if you already have %TEMP%\chocolatey\Firefox\<ver>\Firefox Setup <ver>.exe, you'll get Attempt to get headers ... and so on. Firefox package source is perfect answer why this happens URL used there is something like https://download.mozilla.org/?product=firefox-96.0.3-ssl&os=win&lang=en-US. So Install-ChocolateyPackage can't guess filename from it.

TakataSanshiro commented 2 years ago

I've tried your recipe on the testing environment. I was not able to install firefox. Move the manually downloaded file(Firefox Setup 96.0.exe) to the cache location. Add the line to the hosts file. cinst -y firefox --version 96.0

I checked to display the message.Attempt to get headers for ... However, not display the following message. File appears to be downloaded already. Verifying with package checksum to determine if it needs to be redownloaded.