grahampugh / erase-install

A script that automates downloading macOS installers, and optionally erasing or upgrading macOS in a single process. Watch the video!
https://grahamrpugh.com/2023/05/14/macaduk-presentation-eraseinstall.html
Apache License 2.0
836 stars 131 forks source link

[FR] - Support for new mist-cli caching server support #406

Closed carlashley closed 1 year ago

carlashley commented 1 year ago

PLEASE NOTE THAT FEATURE REQUESTS ARE ONLY CONSIDERED AGAINST v.28.0+

Is your feature request related to a problem? Please describe. Not really a problem per-se, more a "quality of life" issue :)

Describe the solution you'd like The mist-cli project was recently updated to include support for passing an argument that will let it make use of a network's Apple caching service, it would be nice if erase-install could be updated at some point to also support this.

This would be an optional argument so it could be used at end user discretion.

A new argment such as --cachingserver (example only) would accept an http://example.org:port parameter value that would then be passed to mist-cli to use; this has potential to reduce the amount of data downloaded directly from Apple, particularly in environments such as classroom labs, etc.

An important note here is that the Apple caching server is http only, so erase-install would need to either transform a https://example.org:port value into a http://example.org:port value, or error out. https traffic itself through the caching server is handled by mist-cli passing the correct parameters when downloading content.

As far as falling back to content not in the cache, this shouldn't be necessary, as mist-cli handles all the fetching, and if remote content exists on Apple's CDN but not in the local caching server, the content server itself will handle "passing" the file on to the requesting client (Caching Server is essentially a normal proxy caching server, but a bit more special).

Describe alternatives you've considered There aren't really any alternatives to this.

Additional context AssetCacheLocatorUtil can potentially be used to determine which caching service should be used as it has a --json argument, you do have to pipe stderr to /dev/null as the tool will still dump it's "normal" output to stderr.

AssetCacheLocatorUtil --json 2>/dev/null

My own preference is that the argument used to enable a caching server be used should require a user specified parameter, that way the individual has the option of determining which caching server should be used in complex environments or for circumstances where AssetCacheLocatorUtil might not find a caching server for whatever reason.

grahampugh commented 1 year ago

Hi @carlashley , yes I intend to add an option to pass the setting through to mist-cli. I don't intend to add any additional sanity checks on the URL of the caching server, I assume Mist will do that correctly if I just pass on the value.

grahampugh commented 1 year ago

This is addressed in v30.0 - I would welcome your tests, because I don't have a caching server, nor do I have practical means of setting one up.

carlashley commented 1 year ago

@grahampugh Thanks :) Ran some tests this morning with --caching-server and it is working as expected.