Hi,
I am trying to write a package for clamav and havp. I have setup a test repository locally and trying to understand the manifest and package xml formats. Rather than just ask the questions, I will document what I understand and ask what I do not know, In the process making a crude documentation of package system. I will wikify it once I get enough information. Pl correct any errors
pfSense Packaging SystemThe basic idea behind pfSense packaging system is to install the normal FreeBSD packages, but keep the configuration inside the pfSense xml. This is achieved by creating the config file of application from scratch from xml duing installation and when it is changed in web interface. pfSense provides infrastructure to create the web interface and to store it in it's xml config. The package writer is expected to convert the data from xml to the native format of the application.
Creating a Local Repository.To test local packages you need to create a local repository of packages. The local repository can be any web server accessible from wan interface with 2 main subdirectories. They are
packages and
pfSense.
packages contain the main package manifest file
pkg_config.xml. This also has
config subdirectory for package specefic configuration files. The
pfSense directory has xmlrpc code. Get the xmlrpc code from
http://www.pfsense.com/xmlrpc.tgz and untar it in the directory. To change the default repository directory from pfsense.com to your webserver, edit the
/etc/inc/globals.inc and change
xmlrpcbaseurl to your repository. Now click the
System -> Packages from the pfsense web interface and you should see packages from your local repository. You are set to go now.
Package SystempfSense package are composed of
- Manifest File
- Package Configuration files
- Actual Binaries from FreeBSD
Manifest FileManifest file is the
packages/pkg_config.xml It contains list of packages available for installation and some basic information about packages. The format of manifest xml is as follows:
<pfsensepkgs>
<packages>
<package>
<name></name>
<website></website>
<descr></descr>
<category></category>
<config_file></config_file>
<depends_on_package_base_url></depends_on_package_base_url>
<depends_on_package></depends_on_package>
<version></version>
<status></status>
<maintainer></maintainer>
<configurationfile></configurationfile>
<logging>
<facilityname></facilityname>
<logfilename></logfilename>
</logging>
</package>
<packages>
<pfsensepkgs>
Package configuration filesPackage manifest file for each package specifies a configuration file for each package via
config_file tag. The convention is to keep this file inside the
packages/config/ directory. The format is:
<?xml version="1.0" encoding="utf-8" ?>
<packagegui>
<name></name>
<version></version>
<title></title>
<include_file></include_file>
<!-- For what is this used? -->
<backup_file></backup_file>
<aftersaveredirect></aftersaveredirect>
<!-- the package configs are stored in this subtree of main config file -->
<configpath></configpath>
<!-- pfSense menu hookup. Section should be an existing pfSense section -->
<menu>
<name></name>
<section></section>
<configfile></configfile>
<tooltiptext></tooltiptext>
<!-- the act=edit will let you directly edit the page -->
<url>/pkg_edit.php?xml=package.xml&act=edit&id=0</url>
</menu>
<!-- Start the service, rc file comes from FreeBSD package or generated using write_rcfile -->
<!--is rcfile and executable mutually exclusive? -->
<service>
<name></name>
<rcfile></rcfile>
<executable></executable>
</service>
<!-- For creation of Tabs inside the package page -->
<!-- The page opened after clicking the menu item will have these tabs. -->
<!-- url can be of the form /pkg.php?xml=spamd.xml for getting data from a form -->
<!-- Additional xml files should be included via additional_files_needed -->
<tabs>
<tab>
<text></text>
<url></url>
<active/>
</tab>
</tabs>
<!-- Used to include additional xml files for tabbed menu and (what all?)-->
<additional_files_needed>
<prefix></prefix>
<chmod></chmod>
<item></item>
</additional_files_needed>
<!-- What is this used for? -->
<adddeleteeditpagefields>
<columnitem>
<fielddescr></fielddescr>
<fieldname></fieldname>
</columnitem>
</adddeleteeditpagefields>
<!-- data fields are defined here, these data is accepted from user-->
<fields>
<field>
<fielddescr></fielddescr>
<fieldname></fieldname>
<description></description>
<size></size>
<type></type>
</field>
</fields>
<!-- these gets executed during various times of package installation.-->
<!-- Is the full list available here? -->
<!-- This is used to define inline php functions that are called by other hooks -->
<!-- You can also use include_file to include php code -->
<custom_php_global_functions> </custom_php_global_functions>
<!-- The install and deinstall commands, create your directories etc here and call sync function -->
<!-- Sync function should convert the xml to config file, write out the config fle and restart the daemon -->
<custom_php_install_command> </custom_php_install_command>
<custom_php_deinstall_command> </custom_php_deinstall_command>
<!-- No idea where this is used -->
<custom_add_php_command> </custom_add_php_command>
<custom_add_php_command_late> </custom_add_php_command_late>
<custom_delete_php_command> </custom_delete_php_command>
<custom_php_resync_config_command> </custom_php_resync_config_command>
<!-- Is this similar to Service tab? -->
<start_command> </start_command>
<!-- When is this used ? -->
<process_kill_command> </process_kill_command>
</packagegui>
Binaries from FreeBSDThe actual bineries are the normal FreeBSD packages for that particular program. That can be downloaded directly from FreeBSD FTP Server.
MiscI will expand this as I proceed with my package and understand more about package system, In the mean time pl feel free to add more info as comments.
With Regards,
raj