Debian Menu System - chapter 3
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"-the update-menus program to run just your script, instead of having update-menus run all scripts (saves some 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 bash:

  #!/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:
         rm /etc/X11/twm/{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 reasonably defaults for systems without menu will make life very difficult for you.


Debian Menu System - Copyright ©1997 Joost Witteveen, Joey Hess, Christian Schwarz.
Contents; abstract; next; back.
version 1.3, 20 November 1998
Joost Witteveen joostje@debian.org
Joey Hess joey@kite.ml.org
Christian Schwarz schwarz@debian.org