Module does not appear in Menu

Started by darsen, July 14, 2021, 08:19:34 AM

Previous topic - Next topic
Hi everyone,

I developed a OPNSense module following this guide: https://docs.opnsense.org/development/examples/helloworld.html

I have also created Menu.xml to specify where exactly I want my module to appear in OPNSense Menu. After that, I packaged the module into a "txz".

After installing the module on a new OPNSense, by running "pkg install my-module.txz", I don't see it appearing in the Menu.

If I restart OPNSense, then I see it.

Do I need to restart something as part of POST_INSTALL ?

Thanks a lot,

darsen

If you have the latest plugin code it should work out of the box after install (and has been for a long time).

You can always run "opnsense-patch" to clear the menu cache. It's just a file on the disk:

https://github.com/opnsense/update/commit/ed95d5e3bb5


Cheers,
Franco

Quote from: franco on July 14, 2021, 08:30:15 AM
If you have the latest plugin code it should work out of the box after install (and has been for a long time).

You can always run "opnsense-patch" to clear the menu cache. It's just a file on the disk:

https://github.com/opnsense/update/commit/ed95d5e3bb5


Cheers,
Franco

It works with opnsense-patch ! Thanks a lot!

Can I include opnsense-patch inside "+POST_INSTALL" ?

Thanks a lot

darsen

As I said the appropriate hook is provided by https://github.com/opnsense/plugins/blob/master/Templates/configure unless you clobber +POST_INSTALL yourself. If that is the case you can always alter your approach and use +POST_INSTALL.pre or +POST_INSTALL.post file overrides.


Cheers,
Franco

Quote from: franco on July 14, 2021, 08:43:08 AM
As I said the appropriate hook is provided by https://github.com/opnsense/plugins/blob/master/Templates/configure unless you clobber +POST_INSTALL yourself. If that is the case you can always alter your approach and use +POST_INSTALL.pre or +POST_INSTALL.post file overrides.


Cheers,
Franco

Aha now I get it, so if I remove the +POST_INSTALL everything should work.
I created the +POST_INSTALL because the documentation said that it needs to be created:

Quote
Next add a +POST_INSTALL file in the plugin directory, to reload the configd process after installation. This is needed for the new "test" command to register.

Maybe we can update the documentation to make it more clear.

Thanks a lot Franco!

Uh, ok, I will update the docs. Thanks for the pointer!


Cheers,
Franco

Actually, can you point me to the documentation that seems outdated? I can't find it in the docs repo...


Cheers,
Franco


Hi Aleks,

Ah thanks. I was grepping for "POST_INSTALL" but the source file reads "POST\_INSTALL"... d'oh :)


Cheers,
Franco