1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
|
Since 0.3.3, Feta implements a rudimentary set of plugins for new
commands. The goal of the plugin system is to keep Feta itself lean and
simple, but extending its capabilities to more advanced jobs, such as
installing recommended packages, or working with Debian tasks.
Creating a Plugin
-----------------
To create a plugin, put an executable file in /usr/share/feta/, and have the
filename be the name of the command. When `feta command <args>' is run,
the script will be run with the same arguments as Feta (sans the command
name). If the filename ends in .0, it will only be run as root.
Plugins are expected to understand how to deal with the options -t, -q,
-V, and -y. "Deal with" can mean "throwing out". The following code for
shell scripts will eliminate those arguments from the parameter list.
# Start here
OPTS=`getopt -n configure -o V,q,t,y -- $@`
if [ $? != 0 ] ; then exit 1; fi
eval set -- "$OPTS"
while true ; do
case "$1" in
-q|-t|-V|-y) shift;;
--) shift; break;;
esac
done
# End here
Perl programmers are advised to use Getopt::Std. Adapt to your personal
language as needed.
Stylistic Stuff
---------------
Please don't print any long error messages unless -V is used. Instead, return
non-zero; Feta will print a generic message and tell the user to try again
with -V. If you need to print a minimal error message, prefix it with a
"E: " for error or "W: " for warning (like APT does).
All plugins should have a help file based on the template in help/template
included with Feta.
Licensing
---------
Because plugins are used from an exec interface, they do not have to be
licensed under the GPL. However, any not licensed under the GPL (or public
domain) will not be distributed with Feta.
|