(#3255) Rewrite chocolateysetup.psm1 #3256
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description Of Changes
Motivation and Context
This script has barely been touched in the last decade, in part because it's difficult to follow. Gave it a much needed revision to remove unnecessary clutter, make its code patterns more consistent, and be much more sensible in how it declares and calls commands, so that we can be much more confident that things are working how we expect them to.
This should help make it much easier to make changes to going forward, should we ever need to.
Testing
Tests were performed on Win11, Server 2019, and Server 2008R2
install.ps1
script we provide on chocolatey.org, providing the-ChocolateyDownloadUrl
to point at the locally-built nupkg.chocolateyInstall.ps1
due to Many Issues trying to make that script work on that ancient OS (mostly TLS issues I didn't wanna take the time to sort out).C:\ProgramData\chocolatey
folder, then install v2.0 or v2.1 of Chocolatey CLI, then do achoco upgrade --pre -s localfolder/
with the built nupkg inlocalfolder
Operating Systems Testing
Change Types Made
Change Checklist
Related Issue
Fixes #3255