Add internal post-install step for Brioche installation and updates #342
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.
This PR introduces a new internal subcommand:
brioche self-post-install
. Currently, when called, it just prints a simple message:This PR also updates the
self-update
subcommand to callbrioche self-post-install
on the newly-installed version. Since this command just prints a message, this doesn't do much today, but it does at least validate that the new version is working as expected (or prints a warning with some tips if the command fails... which could be a sign that something is very broken).Of course, this doesn't provide much value today. But my hope is that the new self-update process (part of #281) can last well into the future, so this gives us a place to hook into for things like migrations or one-off cleanup tasks when going from older versions to newer versions. The benefit of doing this now is that future versions can always assume that the
self-post-install
command is called during the update process.When calling
self-post-install
, the self-updater sets 2 extra env vars:BRIOCHE_SELF_POST_INSTALL_SOURCE=self-update
(so the post-install step can tell apart e.g. a new install vs. an update)BRIOCHE_SELF_POST_INSTALL_PREVIOUS_VERSION
(set to the version doing the self-update, so the post-install step can do different things depending on what version we're coming from)