Home
Help
Search
Login
Register
OPNsense Forum
»
English Forums
»
Development and Code Review
(Moderator:
fabian
) »
Possible to create plugin containing binaries?
« previous
next »
Print
Pages: [
1
]
Author
Topic: Possible to create plugin containing binaries? (Read 5172 times)
GurliGebis
Newbie
Posts: 42
Karma: 3
Possible to create plugin containing binaries?
«
on:
January 29, 2017, 12:22:00 am »
I've been reading about the plugin system, and have gotten to this page:
https://docs.opnsense.org/development/examples/helloworld.html#create-an-installable-plugin
Might just be me, but I cannot find the info on how the binaries for the service the plugin is about should be built and added to the package?
And can the plugin be installed using the normal pkg tool, or does it have to be integrated into the backend and installed from there somehow?
Logged
franco
Administrator
Hero Member
Posts: 17661
Karma: 1611
Re: Possible to create plugin containing binaries?
«
Reply #1 on:
January 29, 2017, 10:02:37 am »
Hi there,
Plugins are strictly not for binaries, only for GUI / integration scripts. It's very simple though to attach binaries, the dependency/dependencies is/are added from the plugin framework:
https://github.com/opnsense/plugins/blob/master/net/haproxy/Makefile#L4
This ties to FreeBSD ports found in this repository:
https://github.com/opnsense/ports
It's possible to install plugins from the command line with pkg:
# pkg install os-PLUGINNAME
But that is only after the plugin is in our repository or you did a custom build / have your own repository.
You can also build/install plugins from the plugins repository on a running OPNsense box in case you want to skip your own package repository. The same is true for ports if required.
There are likely more questions coming up soon, so please don't hesitate to ask them.
Cheers,
Franco
Logged
GurliGebis
Newbie
Posts: 42
Karma: 3
Re: Possible to create plugin containing binaries?
«
Reply #2 on:
January 29, 2017, 11:08:03 am »
I have a small program that I need to have running on my firewall
So the plan is to make it into a plugin, so it is easy to manage from the web interface.
I have already setup a freebsd development VM, so it should be possible to do.
So let me see if I got it right, there is no way to have the plugin built with the binaries inside the pkg - it has to be a dependency to another package?
Logged
fabian
Moderator
Hero Member
Posts: 2769
Karma: 200
OPNsense Contributor (Language, VPN, Proxy, etc.)
Re: Possible to create plugin containing binaries?
«
Reply #3 on:
January 29, 2017, 04:04:18 pm »
It would be possible but this is not what plugins are made for - a plugin is made to be a glue code between the management (provide an interface to configure it, create configuration files etc.) and the software it is using (packages, ports etc.).
You can compile your binary and include it in the plugin but this is no clean solution.
You should create a plugin for the plugin related stuff and a package with your binary which can be built from source.
The plugin should have the package as a dependency.
Logged
franco
Administrator
Hero Member
Posts: 17661
Karma: 1611
Re: Possible to create plugin containing binaries?
«
Reply #4 on:
January 29, 2017, 04:45:46 pm »
Short answer: Yes, you can embed binaries, but you'll be in charge of updating them manually, providing different binaries for different architectures, etc.
If that's alright for your use case go for it as it is the simplest solution.
Logged
Print
Pages: [
1
]
« previous
next »
OPNsense Forum
»
English Forums
»
Development and Code Review
(Moderator:
fabian
) »
Possible to create plugin containing binaries?