Module Writing it

From Lunar Linux
Revision as of 16:42, 11 November 2008 by Sbarbi (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Contents


Scrivere modules per Lunar può essere difficilissimo oppure facilissimo, ed è molto simile a seguire i passi per l'installazione di package manualmente. Ci sono parecchie variabili a cui pensare durante la scrittura di un modules ed è difficile ottenere un buon risultato se sono le prime volte che li scrivete.

Prima di iniziare

Prendete un pò di tempo per pensare ai motivi che vi spingono a scrivere un nuovo modules ci possono essere molte variabili che impediscono la scrittura di un modules. Ecco alcune linee guida...

  • Cercate se il pacchetto è già presente in Lunar moonbase. Nulla è peggio di scoprire di aver sprecato tempo per un lavoro già fatto.
  • 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

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