pfSense English Support > Packages

Documenting Package System

(1/4) > >>

raj2569:
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 System

The 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 System

pfSense package are composed of
* Manifest File
* Package Configuration files
* Actual Binaries from FreeBSD
Manifest File

Manifest 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 files
Package 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&amp;act=edit&amp;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 FreeBSD
The actual bineries are the normal FreeBSD packages for that particular program. That can be downloaded directly from FreeBSD FTP Server.

Misc

I 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

raj2569:
Adding my questions here, if some one know the answers to them pl reply.


* what is  the meaning of logging along with facilityname and logfilename in manifest xml
* What is the difference between config_file and configurationfile in manifest xml
* http://pfsense.com/packages/pkg_config.xml has package tag inside packages tab and ouside it. for example spamd comes inside packages tag,
while pure-ftpd comes directly under pfsensepkgs. What's the difference?
* Which of the tags are mandatory for manifest xml
* Is the version tag in package xml the same as the one in manifest xml?
* What types of file can be included via include_file ? (Only php or another xml file also?)
* How is include_file different from additional_files_needed
* When tabs are used what should be the format of externel xml files that are included?
* How can I display the output of commands executed during installation to the output window?
* How can I make one pfSense package dependent on another pfSense package? For example havp package depends on clamav package, and that package needs to be installed and configured
--- Code: ---Apparently this is not possible
--- End code ---
[/list]

hoba:
Feel free to start a new section "Package Developement" at http://doc.pfsense.com  ;)

raj2569:

--- Quote from: hoba on April 06, 2006, 08:36:46 am ---Feel free to start a new section "Package Developement" at http://doc.pfsense.com  ;)

--- End quote ---

This will go there, if you notice I am updating the first post with new material as soon as I get them. But these needs to be peer reviewd to be posted as "Documentation" :) So post the answers ;)

raj

lsf:
You might find this interesting if you didn't already see it.

http://wiki.pfsense.com/wikka.php?wakka=CoreGUI

Navigation

[0] Message Index

[#] Next page

Go to full version