Plugin File Structure
Version 2 (Anil Gulecha, 01/04/2011 02:43 am)
Plugin File Structure
We will take a look at how a plugin is organized, and what files consist a plugin.
NexentaStor plugins are a collection of debian packages. Typically, a plugin can consist of any plugin that extends the three components of the Nexenta Appliance, namely: **nms** (Nexenta Management Service), **nmc** (Nexenta Management Console), **nmv** (Nexenta Management View).
Let's the the following two example plugins and discuss their structure: *ddclient* and *simple-encryption*.
## Package: ddclient ##
This image shows the file structure of the ddclient package. You can download this package offline via the commands listed on the [repository page](http://www.nexentastor.org/projects/ddclient/repository).
The main package directory nmc-ddcleint forms all of plugin, i.e, the plugin only has the nmc component. This folder has another directory (*debian*) and 2 perl modules (*Ddclient.pm*, *metafile.pm*)
* *<ins>Ddclient.pm</ins>* - This is the main plugin module, that provides the functionality required. In this particular case, the plugin is basically a wrapper over underlying ddclient facilities. We will go into a line by line explanation later on.
* *<ins>metafile.pm</ins>* - This module is included in all plugin packages. This includes basic plugin information like name, description, plugin group, etc. We will go into a line by line explanation later on.
* *<ins>debian/</ins>* - This directory is present in any debian package, and contains package meta-information (name, dependencies), and build rules (like a Makefile) that builds the packages. This folder can also optionally contain post/pre install/removal scripts if required by your plugin package.
* *<ins>debian/control</ins>* - This file lays out the information official package name, version, dependencies.
* *<ins>debian/changelog</ins>* - This is a plain text changelog that maintains a log of what changes were made subsequent versions. An entry is to be added manually for every version of the package released. The 'dch' command makes it easy to edit this file, and maintain the syntax required.
* *<ins>debian/rules</ins>* - This is the main build file. It is a Makefile that lays out the targets *clean*, *deploy-dirs*, *binary-arch* and *binary*. These respectively clean the workspace, install files in temporary directory structure, builds the binary debian package respectively.
* *<ins>debian/copyright</ins>* - This file includes the licensing information about the package.