(menu.info)Section 7.1


Next: Section 7.2 Up: Chapter 7
Enter node , (file) or (file)node

7.1 The update-menus program
============================

On startup, update-menus checks the file '/var/run/update-menus.pid' and
the pid in it.  If there's an 'update-menus' process with that pid it
kills it.  If '/var/lib/dpkg/lock' exists, it checks to see if dpkg
supports triggers.  If so, it uses dpkg-trigger to trigger a real
update-menus run later.  Otherwise, it forks to background and returns
control to dpkg.  The background process checks the '/var/lib/dpkg/lock'
file approx.  every two second until the file's gone.

Once it's decided to run, whether in the background after dpkg exits, or
in the foreground when used with a trigger-capable dpkg, 'update-menus'
reads the menu-entry files in the following directories: '/etc/menu',
'/usr/lib/menu', '/usr/share/menu', '/usr/share/menu/default'.  (if a
user runs 'update-menus', it will add '~/.menu' to the front of that
list).  For every menu entry line in each file it checks if the
corresponding package is installed.  The menu entries of all packages
marked as installed by dpkg are added together in one big buffer that is
kept in memory (exception: executable menu entry files are executed, and
stdout is placed in the buffer).

Once it's read all menu entry files, 'update-menus' starts all
executable scripts in '/etc/menu-methods/', hands the scripts the
previously created buffer via stdin.  (If 'update-menus' is run by a
user, it will first try to run the scripts in '~/.menu-methods', and
only if that directory doesn't exist, it will run the scripts in
'/etc/menu-methods').

Note that as an aid to debugging, one can use

     update-menus --stdout > /tmp/menu-stdin

and then view the file '/tmp/menu-stdin' to see exactly what
'update-menus' handed the menu-methods on their stdin.

This may also be useful for people writing '/etc/menu-method/*' scripts:
Running 'update-menus' every time you changed something in the script
may be quite time-consuming.  So, it's much easier to run 'update-menus
--stdout' once, and then run

       /etc/menu-methods/mymethod < /tmp/menu-stdin

(and, if that also takes too long, just try editing /tmp/menu-stdin, and
removing 90% or so of all entries)


automatically generated by info2www version 1.2.2.9