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 of nearly all debian window managers are included in the menu package in /usr/doc/menu/examples.

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.''

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

  #!/bin/sh
  set -e
  inst=/etc/menu-methods/twm  #or fvwm, ... whatever manager you're installing
  case "$1" in
     remove)
         chmod a-x $inst
     ;;
     purge)
         #remove the files that install-menu creates:
         rm /etc/X11/twm/{system.twmrc,menus.dat,menudefs.hook}
         #maybe also rm $inst, if dpkg doesn't do that itself.
     ;;
     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
  inst=/etc/menu-methods/pdmenu #or fvwm, ... whatever manager you're installing
  if [ -x /usr/bin/update-menus ] ; then 
    if [ -f $inst ]; then
       chmod a+x $inst
       update-menus; 
    fi  
  fi

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