Running shell script during plugin installation

Answered

Hi Dears,

Is it possible to execute a shell script during plugin installation? I would like to install a 3rd party command-line utility with Homebrew that would be used by the plugin later on. I tried to find anything related to Shell scripts in the SDK documentation but I couldn't.

I already checked these posts:

But if I understood well these are solutions to the second half of my challenge of using scripts after the plugin is installed. However, I would need to run the first script as part of the installation process and would be great to show the script output to the user as well. If you could give me some tips on what should I looking for and/or sharing the related part(s) in the SDK doc, then I would be really grateful. 🙏

P.s.: This is an internal pet project and now I only want to have the plugin as a user interface instead of running the scripts manually.

2 comments
Comment actions Permalink

Hi Anna,
I recommend pointing users to install the required software manually. This is how it's done in, e.g., plugins related to frontend frameworks - Node.js must be installed manually on the system, and plugins don't handle it.

A potential obvious problem with your solution is that a user doesn't have to use Brew for package management. Also, there are other operating systems than macOS.

If you still want to take this approach for some reason, you can listen for the plugin installation event with the PluginStateListener. It will also be called after plugin updates, so the logic you want to execute should depend on some persisted flag (e.g., with PropertiesComponent).

1
Comment actions Permalink

Hi Karol,

Thank you so much for the detailed response! AFAIK Homebrew is available for Linux and Windows with Linux subsystem. But you're right I still don't cover all the possibilities.

I think I will start with your first solution and expect the lib to be installed before the plugin could be used. 

And let's see later if I have the capacity I'll try to achieve the original approach with a better solution. But I appreciate the suggestion and the doc reference!

Have a nice day!

0

Please sign in to leave a comment.