1. Preface

This is a short documentation describing different policies used at and for grml.

2. Packaging Software

If you are not yet familiar with creating Debian packaging useful resources are the Debian New Maintainers' Guide and The Debian Developer's Reference.

Software that should be added to the grml repository (and as a consequence being available for inclusion in grml) must be packaged according to the Debian policy. The Debian packages should be lintian-clean and have to provide manpages for the shipped executables. The package should be maintained inside a mercurial repository hosted at hg.grml.org. If the package is a grml specific package (so upstream is different from the grml-team) the Debian package has to start with the suffix grml- (so the grml specific packages can be identified easily).

If you want to see software included in grml but won't be able to deal with the Debian package please send your feature request to the grml-team.

Uploading Debian packages to the grml pool is restricted to the ftp-masters (being Michael Prokop and Alexander Wirt at the time of writing this document).

As a long term goal the Debian packages used at grml should be provided to the official Debian distribution using the official WNPP / ITP (Intend To Package) procedure.

3. Adding Software to grml

If you plan to write software for inclusion and distribution by grml you should be aware of the following requirements:

4. Contributing patches to grml

Software written by and maintained by the grml-team is available at hg.grml.org. If you plan to provide a patch to the grml-team you can checkout the according repository and create a patch using the hg diff command. Usage example:

hg clone http://hg.grml.org/grml-policy
cd grml-policy
hg diff > update_for_grml-policy-mention_foobar.diff

And mail the resulting diff to the grml-team. The maintainer of the according repository is listed in the Contact-column on hg.grml.org. You are free to contact the grml-team directly via mail or the grml-mailinglist as well.

More details regarding use of mercurial at grml is available at grml.org/mercurial/.

5. Common practices for writing code

5.1. Header information

Every script should provide a header which should look like this:

#!/bin/sh
# Filename:      grml2hd
# Purpose:       install grml to harddisk
# Authors:       grml-team (grml.org), (c) Andreas Gredler <jimmy@grml.org>, Michael Prokop <mika@grml.org>
# Bug-Reports:   see http://grml.org/bugs/
# License:       This file is licensed under the GPL v2.
# Latest change: Thu Sep 13 23:00:56 CEST 2007 [mika]
################################################################################

5.2. Footer information

Most developers of the grml-team use Vim as their favourite editor. Therefor providing a modeline at the end of the sourcefile is commonly used to indicate the favourite editing mode/style. Usage example:

# vim: ai filetype=sh expandtab shiftwidth=3

5.3. grml shellscript library

The grml system provides several shellscript resources. The package grml-etc-core provides the files /etc/grml/lsb-functions and /etc/grml/script-functions, the package grml-shlib ships /etc/grml/sh-lib.

5.3.1. /etc/grml/lsb-functions

The file /etc/grml/lsb-functions is used within init-scripts and init-style scripts (like shellscripts handling with services) and is supposed to be POSIX-compatible. Usage example:

% source /etc/grml/lsb-functions
% einfo "Starting foobar." ; /bin/true ; eend $?
 * Starting foobar.                                  [ ok ]
% einfo "Starting foobar." ; /bin/false ; eend $?
 * Starting foobar.                                  [ !! ]
%

If you want to provide output on the plain console (without using an interface like dialog or stfl) you should consider the use of /etc/grml/lsb-functions so look and feel of grml-scripts is as consistent as possible.

5.3.2. /etc/grml/script-functions

The file /etc/grml/script-functions provides common functions used inside several scripts, like check4root (check for root-permissions), iszsh (check for running zsh). The file is supposed to be used in every POSIX-compatible shell (otherwise it's a bug).

5.3.3. /etc/grml/sh-lib

The file /etc/grml/sh-lib provides a smiliar functionality like /etc/grml/lsb-functions and /etc/grml/script-functions do. As a long term goal the functionality of this file should be merged with the one of lsb-functions and script-functions.

5.4. Good practices for shellscript

6. About this document

© Michael Prokop <mika@grml.org>; HTML version powered by asciidoc.