[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Install-*-menu policy

> --==_Exmh_-78548752P
> Content-Type: text/plain; charset=us-ascii
> Philippe Troin:
> > 
> > What's the policy on 1.2 about install-{x,fvwm2,*}-menu in Debian 1.2 
> > ? Should packages implement it or not ? And using what ?
> > Is there any package around here implementing it ?
> The only thing that is currently implemented is install-fvwm2menu.
> It is part of the Debian fvwm2 package. Unless someone gets something
> done _really_ fast (in less than 47 hours 40 minutes), there are no
> alternatives. Packages which wish to use anything, should use
> install-fvwm2menu.

Hey, where do all my emails go to? I've done something, i.e.

Here's what I've sent to debian-devel some time ago:

The recently to fvwm2 added feature "install-fvwm2menu" has the
rather big disadvantage that any package installed before
fvwm2 will not be able to add a menu entry to the fvwm2 menu.

Also, with "install-fvwm2menu" we will only be able to make menu's
for fvwm2. If we want to make menu's for other window managers, or
for a console menu, we will have to modify each package's postinst
that has a install-fvwm2menu line in it.

Therefore, I recently proposed on debian-devel to add two scripts
(install-menu and remove-menu) to a package that's marked "essential".
These scripts would do nothing but adding/remove a line to a menu-file:
something like (see real version of install-menu below)

  echo $* >> /var/lib/dpkg/menu

and, in stead of putting in a package's postinst

  install-fvwm2menu --install menu entryid icon text cmd

we should use the general install-menu:

  install-menu needs menu entryid icon text cmd
Note the extra "needs". This would be eighter "X", or "VC", or, maybe,
"Braille" for a braille reader.

Then, we the fvwm2 postinst should skim this file for lines 
beginning with "X", and execute for each line 
"install-fvwm2menu --instal $*". Other window managers can do the same.

I have already recieved to positive replies from Brian C. White, and
from Dirk.Eddelbuettel, and hope/assume you agree with the principle
as well.

Of course, I could also include the scripts "install-menu" and 
"remove-menu" in debian package but, creating yet another package
adds more to the confusion of the first-time user, giving him/her
yet another conflict resolution screen when s/he installes an
application, and generaly makes it all more confusing.

Because it really are only two very short (about 10 lines of code each)
scripts, I personally prefer them to be put in another base package.
This is why I'm writing you, dpkg author.

The scripts below are tested with a patched fvwm2 (that parses the
created /var/lib/dpkg/menu file), and with a new version of gnuplot,
that executes the needed install-menu and remove-menu commands.

Naturally, the locations of the menu database (/var/lib/dpkg/menu)
and the hooks the window managers should setup for scripts that
gets executed after install-menu is called (in /etc/menu-methods)
are suggestions only, and I welcome any advice.

I'm including the scripts here below, as well as the changes to
fvwm2 that were necessary, for anyone who's interested.

# This script should be run by the postinst from packages that
# provide programmes that end-users may want to run.
#  (these programmes will be run always with the samme commandline
#  arguments).
# Calling this script will update /var/lib/dpkg/menu, providing information
# for window managers like fvwm2 to build a propper menu.
#   (also, if we ever create such a thing, for a VC manager (probably a 
#    dialog programme)
# Also, it will call all scripts in /etc/menu-methods/, with the
# arguments: --install-menu needs menu entryid icon text cmd
# (For removal, these scripts are called with: --remove-menu entryid)
# This script should be run as:
#   install-menu needs menu entryid icon text cmd
#   With:
# 	Needs  The type of terminal to be expected. For example, 
# 	       "X" or "VC" (for Virtual Console).
# 	menu   name of menu the entry should be in (submenus are
# 	       given using slashes: Apps/Editors)
# 	id     a unique identifier (each line must have a unique name)
# 	icon   In the case of X11, this may be name of icon to put before
# 	       the entry text, "none" if no icon is desired.
# 	       For other terminal types, any single word will do.
# 	text   The text of the menu entry, what the user sees. Can be 
# 	       quoted to get spaces into the text.
# 	cmd    The shell command to be executed to get the programme running
# So, if the postinst from for example emacs should contain the
# lines
#   install-menu X Apps/Editors emacs /usr/X11R6/include/X11/pixmaps/page2.xpm\
# 		   "Emacs"  /usr/bin/emacs
#   install-menu VC Apps/Editors emacs "Emacs"  /usr/bin/emacs
# This indicates that emacs can be run both on the VC as well on X11.
# The corresponding remove-menu line in the postrm should be:
#   remove-menu emacs
# GPL; written by joostje@debian.org
# Also in essential: mkdir /etc/menu-methods

grep -v "\"$1\" [^ ]* \"$3\"" $menu > $menu.tmp
mv $menu.tmp $menu
echo \"$1\" \"$2\" \"$3\" \"$4\" \"$5\" \"$6\" >> /var/lib/dpkg/menu

for f in /etc/menu-methods/*; do 
  if test -x $f; then
    $f --install-menu  "$1" "$2" "$3" "$4" "$5" "$6"

# This script should be run by the postrm of packages that
# provide a install-menu line in the postinst.
# The remove-menu call takes only one argument, the id to be removed:
# The postrm Emacs example:
# remove-menu emacs

grep -v "$1" /var/lib/dpkg/menu > /var/lib/dpkg/menu.tmp
mv /var/lib/dpkg/menu.tmp /var/lib/dpkg/menu

for f in /etc/menu-methods/*; do 
  if test -x $f; then
    $f --remove-menu "$1"


diff -u fvwm2_2.0.43-BETA/debian.install-fvwm2menu fvwm2_2.0.43-BETA-menu/debian.install-fvwm2menu
--- fvwm2_2.0.43-BETA/debian.install-fvwm2menu	Sun Aug  4 14:25:32 1996
+++ fvwm2_2.0.43-BETA-menu/debian.install-fvwm2menu	Wed Oct 30 22:12:01 1996
@@ -2,6 +2,8 @@
 # Debian install-fvwm2menu (c) Austin Donnelly 1996
 #    Closely based on a sh and awk version by Lars Wirzenius.
+# --instal-menu and --remove-menu added my joostje@debian.org
 # This is free software; see the GNU General Public Licence
 # version 2 or later for copying conditions.  There is NO warranty.
@@ -46,6 +48,12 @@
         Install a new menu entry (or change an existing one)
     $progname --remove entryid
         Remove an existing menu entry
+    Or, with the \"needs\" parameters (needs is here X):
+    $progname --install-menu needs menu entryid icon menutext cmd
+        Install a new menu entry (or change an existing one)
+    $progname --remove-menu entryid
+        Remove an existing menu entry
     $progname --build
         Rebuild the menu hook files after manually editing $menus_dat
@@ -227,7 +235,17 @@
-if ($opt eq "--remove" ||
+if ($opt eq "--install-menu" )
+    &usage if ($#ARGV != 5);
+    if ( ("$ARGV[0]" eq "\"X\"") || ("$ARGV[0]" eq "X") ) {
+	&install($ARGV[1], $ARGV[2], $ARGV[3], $ARGV[4], "Exec $ARGV[5]");
+    }
+    exit(0);
+if ($opt eq "--remove" || $opt eq "--remove-menu" ||
     $opt eq "-r")
     &usage if ($#ARGV != 0);
diff -u fvwm2_2.0.43-BETA/debian.postinst fvwm2_2.0.43-BETA-menu/debian.postinst
--- fvwm2_2.0.43-BETA/debian.postinst	Sun Aug  4 18:38:39 1996
+++ fvwm2_2.0.43-BETA-menu/debian.postinst	Wed Oct 30 20:29:14 1996
@@ -1,4 +1,4 @@
+#!/usr/bin/perl -w
@@ -95,6 +95,15 @@
     warn "warning: $INSTALL_FVWM --build returned error code $ret\n"
 	if ($ret);
+# For each line in /var/lib/dpkg/menu, execute install-fvwm2menu --install
+# once. OK, so I'm not a perl hacker, and I did this with sed; it
+# probably could have been done much easier with perl. --joostje@debian.org
+system "cat /var/lib/dpkg/menu | sed -n -e 's/[^\"]*\"\$/Exec &/' -e 's/^\"X\"/install-fvwm2menu --install/p' |less" ;
+#then, add a symlink in /etc/menu/methods to /usr/lib/fvwm/install-fvwm2menu
+system "ln -s /usr/bin/install-fvwm2menu /etc/menu-methods/fvwm2";
 # If we've already translated the users' ~/.fvwmrc then we're done
 exit 0 if ( -f "$CONFIGDONE" );

joost witteveen
Use Debian/GNU Linux!

TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
debian-devel-REQUEST@lists.debian.org . Trouble? e-mail to Bruce@Pixar.com

Reply to: