Module Writing

From Lunar Linux
Revision as of 17:50, 23 April 2006 by Jannis (Talk | contribs)
Jump to: navigation, search

Contents


Writing lunar modules can be extremely complex or very simple, and is analogous to performing the steps needed to install a package manually. However, there are so many variables you need to think of when writing modules, that it's hard to get them all right if you're new at writing modules.

Before you start

Take some time to think about why you want to make a new module. Also, there might be things to consider that would prevent you from writing a module at all. Here's some guidelines

  • Check if the package is not already in moonbase. Nothing is worse then doing the same work double.
  • Check the license. Perhaps the license is not compatible with lunar and your newly written module might never make it into moonbase due to licensing issues (You can always submit your modules on the non-free modules website).
  • Check the dependencies required for the module, and see if those also meet these requirements. Sometimes a module might take so much time to write that it's not worth it
  • Check if you're not better off installing it manually or using a binary. Plenty of packages are so easy to install into your homedirectory and even though a module would be nice, it's often just easier to install it manually.


Starting the module

Find a good spot in moonbase. You should always work in the zlocal section. Your system moonbase is located in "/var/lib/lunar/moonbase".

cd /var/lib/lunar/moonbase/zlocal
mkdir mymodule
cd mymodule

Every module is defined as the group of files and directories including a DETAILS file in a directory. So we need a DETAILS file:

    MODULE=mymodule
   VERSION=1.0
    SOURCE=$MODULE-$VERSION.tar.bz2
SOURCE_URL=http://my.site.org/files/
  WEB_SITE=http://my.site.org/
   ENTERED=20050808
   UPDATED=20050808
     SHORT="Makes module writing easy"
cat<<EOF
MyModule is a simple tool to explain module writing in
detail. It doesn't actually exist but is used as an example
for educational purposes
EOF

This is a basic DETAILS file with all required components. As you can see it's just plain shell code.

All lunar module files are bash code. This means that you should pay special attention to shell meta characters and proper syntax

This DETAILS file already can be all you need for writing a module, depending on the way "mymodule" needs to be compiled.

Module Format

See Module Basics for detailled information about available module scripts and module examples.

Personal tools
Namespaces
Variants
Actions
Wiki Navigation
Project Sites
Toolbox