Module Writing

(Difference between revisions)
Jump to: navigation, search
m (Reverted edits by 194.176.176.82 (Talk); changed back to last version by Striker)
Line 11: Line 11:
  
 
==Starting the module==
 
==Starting the module==
 +
 +
 +
====Easy way====
 +
The easy way to write a module is by using lvu.
 +
All you have to do run this as root ' lvu new mymodule ' this will walk you though everything that is needed for a DETAILS file. It will create both the directory in [[zlocal]] and the [[DETAILS]] file. Now if you ' cd /var/lib/lunar/moonbase/zlocal/mymodule ' you should see a DETAILS file in that directory.
 +
 +
====Hard 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".
 
Find a good spot in [[moonbase]]. You should always work in the [[zlocal]] section. Your system [[moonbase]] is located in "/var/lib/lunar/moonbase".

Revision as of 03:27, 20 February 2010

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

Easy way

The easy way to write a module is by using lvu. All you have to do run this as root ' lvu new mymodule ' this will walk you though everything that is needed for a DETAILS file. It will create both the directory in zlocal and the DETAILS file. Now if you ' cd /var/lib/lunar/moonbase/zlocal/mymodule ' you should see a DETAILS file in that directory.

Hard 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