Whole document tree
    

Whole document tree

Debian Menu System - What packages with menu managers should do
[ previous ] [ Abstract ] [ Copyright Notice ] [ Contents ] [ next ]

Debian Menu System
Chapter 4 What packages with menu managers should do


Each package containing a menu manager (i.e. a program that can display a menu) should provide a script or program in /etc/menu-methods/ that can read the menu files. This script will be executed by update-menus, which will feed the menu entries to be installed to your script via standard input (stdin).

The scripts in /etc/menu-methods/ should be configuration files, so the user can tune the behaviour of the script.

Good examples for these scripts for nearly all debian window managers are included in the menu package in /usr/doc/menu/examples. Note that while working on your script, you can use the tricks described in "The internals of the Menu package", section "The update-menus program", to run just your script, instead of having update-menus run all scripts (can save quite a lot of time).

Run update-menus (if it exists) in your postinst script, and remove the execute bit from the /etc/menu-methods/ script in the postrm when called with option ``remove.'' The wm-menu-config script is provided to make all this easier:

Here is an example of such a postrm script using sh:

       #!/bin/sh
       set -e
       wm=twm  #or pdmenu, fvwm, ... whatever manager you're installing
       case "$1" in
          remove)
              if test -x /usr/sbin/wm-menu-config; then wm-menu-config $wm off;fi
          ;;
          purge)
              #remove the files that install-menu creates:
              (cd /etc/X11/twm/; rm system.twmrc menus.dat menudefs.hook)
          ;;
          upgrade);;
          *)
              echo "postrm called with unknown argument \`$1'" >&2
              exit 0
          ;;
       esac

And here is a good example for a postinst script:

       #!/bin/sh
       set -e
       wm=pdmenu #or fvwm, ... whatever manager you're installing
     
       if test -x /usr/sbin/wm-menu-config; then wm-menu-config $wm on;fi

Please, do not make your package depend on the menu package! The preferred way of telling dpkg that your wm can cooperate with menu is:

        Suggests: menu (>1.5)

Please only consider using "depends" if you feel providing reasonable defaults for systems without menu will make life very difficult for you.


[ previous ] [ Abstract ] [ Copyright Notice ] [ Contents ] [ next ]
Debian Menu System
version 1.3, 16 February 2002
Joost Witteveen joostje@debian.org
Joey Hess joey@kite.ml.org
Christian Schwarz schwarz@debian.org