Auto-Building Morphix Modules

In the last two hacks we've looked at what Morphix is, and how we can easily customize an existing Morphix Live CD. In this last hack, we will take a look at Module Maker, or MMaker, a tool for autobuilding Morphix modules. Remastering modules is all fine and well, and you can do this just as you can with a compressed KNOPPIX image. However, laziness is seen as a virtue in Morphix-land: one command is all it should take to (re)build a module.

A look at a module generator

MMaker is a tool under development at the moment, but is quite simple in nature. Using a so-called template, an xml file with all the information about the module you want to build, you can auto-build a Morphix module:

mmaker mytemplate.xml mymodule.mod

What MMaker does when you execute this command is debootstrap a new debian filesystem using the details in the template, set up the necessary mainmodule directories and installs all packages specified in the template, while using apt to handle any dependancies. Afterwards it compresses the whole bunch into a fresh new module, ready to be added to a Morphix Live CD in the usual manner.

As you might have guessed, the template is the key to all of this. A look at one for Morphix LightGUI: [note to editor: the template uses an xml notation, so might not appear when viewing in html]


<comps>
 <groups>
  <version>0.5</version>
  <id>lightgui</id>
  <name>Morphix LightGUI</name>
  <repositorylist>
   <repository type="debian">ftp://ftp.debian.org/debian</repository>
   <repository type="plain">http://www.morphix.org/debian</repository>
  </repositorylist>
  <description>Morphix LightGUI mainmodule. Includes XFCE4, Firefox,
  Abiword and a host of other goodies</description>
  <type>mainmod</type>
  <suite>sid</suite>
  <packagelist>
   <packagereq>abiword</packagereq>
   <packagereq>xfce4</packagereq>
   <packagereq>mozilla-firefox</packagereq>
   <!-- ... other goodies here ... -->
  </packagelist>
 </group>
</comps>

Seems simple, doesn't it? The actual template for LightGUI is quite a bit longer (and contains a package to start xfce4 at boot time), but it's very simple to specify which repositories you want to use, what Debian suite you want, what type of Morphix module you want to autobuild and naturally the packages you want. Currently, MMaker can only build base and main modules . A few tags might need some extra explaining:

<repository> - With this tag you define the Debian repository/repositories from which to build your module. Use the type="plain" attribute when you have a repository without separate suites (You can verify this by checking the repository, if it has a Packages file in the root directory of the repository we call it 'plain'). Normal, Debian-style repositories is default

<type> - mainmod, basemod. minimod-type templates are coming up (a separate minimodule generator was constructed before MMaker). It would actually be fairly easy to even have a knoppix-type.

<suite> - sid, sarge, woody (or unstable, testing or stable). These are the three branches of Debian, of which Morphix is derived from.

<arch> - the architecture for which you are building your module. Using an architecture different from the host system isn't recommended and can lead to very interesting errors. It defaults to the architecture of your host system, which should be fine most of the time.

There are a few other tags and commandline options for MMaker, consult the documentation for details.

After your module is built (which takes some time without a local Debian mirror) your uncompressed module will exist in a directory in your /tmp. MMaker will output details of how to recompress it if necessary. We hope MMaker will be useful in letting Morphix work for you!

References

Module Maker Wiki page: http://www.alextreme.org/phpwiki/index.php/ModuleMaker