riezebosch / BoxstarterPackages

My wrongly named chocolatey packages repository. See the url for the AU results.
https://gist.github.com/riezebosch/78af415724ed3724701f732956900b2b
31 stars 34 forks source link

Use installer checksum to validate (and skip when possible) lengthy download #5

Closed masaeedu closed 8 years ago

masaeedu commented 8 years ago

I haven't looked at the other installers yet, but both the install and uninstall scripts in BoxstarterPackages/MsSqlServer2014Express/tools/ download a hefty installer as the first step. Since the installer URL is hardcoded, I'm assuming this installer won't change between installs of the same version of this package. It should be possible to get a checksum of the installer and use this to skip download if a valid file is already present on disk, as well as to verify integrity when performing the download.

This would be useful for people using the package from puppet manifests like I am.

riezebosch commented 8 years ago

In my experience chocolatey already uses the cached download but it makes sense the check the validity using a checksum. I did not include it because I could not found a proper source from Microsoft stating the checksum.

masaeedu commented 8 years ago

@riezebosch That hasn't been my experience. E.g. if you try to uninstall after installing, its going to download the installer again. Re: Microsoft provided checksum, you can just compute the checksum of the file yourself. E.g.

PS C:\Users\masae> Get-FileHash .\Downloads\SQLEXPR_x86_ENU.exe -Algorithm MD5

Algorithm       Hash                                                                   Path
---------       ----                                                                   ----
MD5             3CEF695244AD16E241DEBF7BDFA5EDA7

Now just change your install script so it downloads to a particular location, and before you download, check if a file with the appropriate checksum already exists in that location.

riezebosch commented 8 years ago

Turns out I had this change already in the queue! Could you please test it out? I have a test feed available at https://myget.org/F/riezebosch

See: https://github.com/riezebosch/BoxstarterPackages/commit/30dbcc685a87748493670fb076117b390bee5dd6