Module Writing

From Lunar Linux
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 quick guidelines...

  • Check if the package is already in the Lunar moonbase. Nothing is worse then doing the same work twice.
  • 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 home directory and even though a module would be nice, it's often just easier to install it manually.

Starting the module

Quick and Dirty Way

The quick way to create a module is by using lvu. All you have to do is run this as root ' lvu new mymodule ' this will attempt to make a module DETAILS file from scratch using cut and paste from the user. It will create both the directory in zlocal and the DETAILS file. Now if you ' lvu cd mymodule ' you should see a DETAILS file in that directory. At this point you should verify that the DETAILS file looks like the one discribed in the the Normal Way

Normal Way

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/
      SOURCE_VFY=sha1:e96df66f703c5ab1a295e216b5035ee14d6202b2
        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 and Module Guidelines for detailled information about available module scripts and module examples.

Personal tools
Namespaces
Variants
Actions
Wiki Navigation
Project Sites
Toolbox