Building a package of my own
-
I want to make my own package, and I've been looking through this forum for a thread with like a hello world reference, or some documentation but for some reason not able to find it. Probably my fault for not looking in the right place. Could anyone point me in the right direction?
-
There are two options:
-
See here : https://forum.netgate.com/user/bmeeks, look for the last 50 or so message he posted. He talks about what it is / needs to build your own packages.
A pure "GUI" package is easy to build. You have to apply the open source concept (== reading how other packages are created, look at what you download when installing one, how they are put in place, - like Notes, acme.sh, Shellcmd, Cron, etc).
If your package contains other FreeBSD binaries, things start to ... be less easier.
-
There is a long thread discussing third-party package building here: https://forum.netgate.com/topic/169749/pfsense-compile-requirements-for-3rd-party-software. There are other similar threads in that Development sub-forum.
Like @Gertjan stated, the best way to start is by analyzing an existing package that is similar in form and function to the one you wish to create. Packages on pfSense are either GUI-only, or they may have both a GUI part and then an underlying binary component that typically runs as a service (or background daemon). In that latter case, the GUI portion of the package is used to create the necessary configuration files and environment for the binary piece and then launches the binary piece as appropriate.
GUI packages are stored in the
FreeBSD-ports
repo of pfSense and will havepkg-pfSense-
as their name prefix. The package will be stored in the appropriate subfolder of the ports tree (sysutils
,security
,network
, etc.). The base URL for the pfSenseFreeBSD-ports
repo is on GitHub here: https://github.com/pfsense/FreeBSD-ports.GUI portions of packages are typically written in PHP with a sprinkling of JavaScript if needed. There is an old XML framework for creating package GUI templates, but it is used less and less these days. Here is a link to the official package development docs that describe the XML template format: https://docs.netgate.com/pfsense/en/latest/development/develop-packages.html.