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, and they must always include the /etc/menu-methods/menu.h configuration file at the beginning with the command !include menu.h For the same reason, scripts in /etc/menu-methods/ are requested to use the following configurable functions: title() for the title (in place of $title), icon() for the icon (in place of $icon), term() for running text command under X11. sections_translations() for the list of translations of sections name available. This later one is only defined if you !include lang.h
Good examples for these scripts for nearly all Debian window managers are included in the menu package in /usr/share/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).
This script should not be executable in the package. Instead the
postinst should add the execute bit and then run
update-menus
(if it is executable).
Similarly, the postrm script when called with option ``remove''
should remove the execute bit and run update-menus
(if it is
executable).
Here is an example of such a postrm script using sh
:
#!/bin/sh set -e inst=/etc/menu-methods/#PACKAGE# case "$1" in remove) if [ -f $inst ]; then chmod a-x $inst if [ -x /usr/bin/update-menus ]; then update-menus ; fi 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 inst=/etc/menu-methods/#PACKAGE# if [ -f $inst ]; then chmod a+x $inst if [ -x /usr/bin/update-menus ]; then update-menus fi fi
Note:
Previous version of menu were advertising the script /usr/sbin/wm-menu-config. There was a flaw: this script was only available when menu is installed and so the menu-method script was not executable if menu was installed afterward.
This script is considered deprecated, please don't use it anymore.
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
Please only consider using "depends" if you feel providing reasonable defaults for systems without menu will make life very difficult for you.
Debian Menu System
version 1.4, 22 March 2005joostje@debian.org
joeyh@debian.org
schwarz@debian.org
ballombe@debian.org