Skip to content

Add support for pre-uninstall and post-install hooks #59

@jtackaberry

Description

@jtackaberry

Scripts often persist state and perform other actions that will leave behind cruft when the user uninstalls the script. In Reaticulate's case, for example, it:

  1. provides the user an option to run at startup, in which it injects a stanza into the user's __startup.lua
  2. maintains external state that some users may want to clear out during uninstall (including as part of troubleshooting)
  3. creates a generated file in the user's Data directory (which is not tracked by ReaPack as the filename changes)

It's come up several times now where I wished I had the ability to add a ReaScript hook that ReaPack invokes during uninstall to take care of the above cases.

So the idea is for ReaPacks to be able to define a pre-uninstall entrypoint script that the ReaPack extension calls when the user performs the uninstall action. The hook's script would be distributed with the ReaPack, but would not necessarily be included as an action, given that we probably wouldn't want users to run this directly. ReaPack could implicitly register the script as an action, invoke it, then unregister it.

Ideally ReaPack would also wait for the script to terminate before proceeding, in case the hook script opens a gfx window that invites some user-interaction (for example to choose how thoroughly things should be cleaned up). I'm not sure if this is actually possible for extensions to detect, and I understand dealing with edge cases (such as misbehaving hook scripts) would be tedious, but it would improve the flexibility of the hook to be able to load additional content distributed with the ReaPack as part of the hook before the ReaPack extension deletes the files.

For symmetry, a post-install hook would be really nice as well. Less important than a pre-uninstall hook IMO, but It would improve UX if at installation time I could prompt the user to ask if they wanted to launch the main script right away. Not terribly useful for discrete actions of course, but for long-running scripts that provide background functionality it would improve the user's experience if they didn't need to hunt for the action to explicitly launch it.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions