Creating an installable plugin

Started by primroseN, February 13, 2024, 04:54:24 PM

Previous topic - Next topic
Hello all,

I'm an OPNsense newbie I apologize for my limited knowledge. I have been following the HelloWorld plugin development documentation and I appear to have hit a roadblock. When I run the make plugins command, the command runs for a notoriously long time -6+ hours( it is still running as I type this, which is my concern )

My query is 1)- Is this normal behavior or is it my architecture in question?
2) - Is there a way of simply building only the plugin I have created, as opposed to re-building all available plugins on the system?

I will greatly appreciate  any help and guidance on how to make an installable plugin for OPNsense.

1) Yes, running make plugins first builds all prerequisites, which can take a very long time.

2) Prefetch the base, kernel and packages sets so you don't have to build them yourself:

make prefetch-base,kernel,packages

Then build your plugin:

make plugins-<yourplugin>

Cheers
Maurice
OPNsense virtual machine images
OPNsense aarch64 firmware repository

Commercial support & engineering available. PM for details (en / de).

Hey Maurice, sorry for the late response.

This has been very helpful. I have successfully packaged my plugin. Thank you

Cheers,
- Prim

Hello,

I appear to have hit another snag. After successfully running make plugins-<my plugin> I can't seem to find the plugin anywhere on my system. I ran pkg update and that  did not yield any results, as did rebooting the system.

In addition, upon doing some research, I realized I can't state the plugin dependencies in the Makefile. My plugin requires a couple of packages like gcc, mongodb. If I can't put these in the POST_INSTALL.pre/post file, how best can I handle installation of those dependencies?


You're looking at a quite complex problem.

First of all, you need to add your dependencies to ports.conf.

Then in the plugin add your dependencies to PLUGIN_DEPENDS variable.

Now rebuild your plugin. It may require rebuilding the relevant ports for inclusion.

Now you have a proper plugin but it just lives as a package somewhere with a loose reference to its dependencies.

Do you want to put this on an image? Build it with ADDITIONS variable set.

Do you want to install it on the fly? Host the plugin package and its dependencies somewhere on a server, then install one by one (last one is the plugin):

# pkg add -f https://xxx/yyy.pkg

If you want to build an online repository you will have to do more research, perhaps stripping down ports.conf and plugins.conf to only fit your plugin and the dependencies and once "make packages" finishes you can use the packages.tar file to extract on a server. Last step is point a repository configuration towards it on the system you want to install.

Due to lack of further details let's just stop here for now. :)


Cheers,
Franco