busybox: init: post update script hook #7671
Draft
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 adds a post-update hook to buysbox's init to run a script from the new image. I've chosen to insert it between the update finishing making its changes and cleaning up prior to reboot.
The script may be per project, device, or distro wide via busybox package scripts. I've chosen new/old VERSION_ID and DEVICE.ARCH as the needed exports for the script. This should be enough for where the device is coming from and where it's going to. These are exported because by the time the hook runs, the old image is no longer available to query.
The temp commit is just the demo script echo'ing the exported variables and putting in a sleep delay to see the output. Normally, the script will echo any output after the script completes (not during progress). It should be dropped before merge.
A reminder that two updates needs to happen to see changes: once to update init to have the call, and the second to then run a post-update script.
WIP:
condense new/old project arch to one set of variables
any other information from old image?
other?