Build user menu entries in postinst
Hello,
I was thinking for a long time whether it is good to build the user
menu entries from the installed packages instead of just cut and pasting
them in the meta package. I now plan to do the following:
1. Check the following ($PKG = meta package name)
cddmenufile=""
if [ -s "$HOME"/.menu/"$PKG" ] ; then
cddmenufile="$HOME"/.menu/"$PKG"
elif [ -s /etc/cdd/"$CDD"/menu/"$PKG" ] ; then
cddmenufile=/etc/cdd/"$CDD"/menu/"$PKG"
elif [ -s /usr/lib/cdd/"$CDD"/menu/"$PKG" ] ; then
cddmenufile=/usr/lib/cdd/"$CDD"/menu/"$PKG"
elif [ -s /usr/share/cdd/"$CDD"/menu/"$PKG" ] ; then
cddmenufile=/usr/share/cdd/"$CDD"/menu/"$PKG"
fi
If $cddmenufile exists and contains an entry for the dependand
package A (dep_A) (this is checked via
[ ! -z "$cddmenufile" ] && grep -q -i "?package($dep_A)" "$cddmenufile"
) then use this menu entry in the user menu in
favour of using the menu entry the package maintainer of the
package dep_A is providing.
2. The next option for overriding the menu entry of the package
maintainer of dep_A is to provide a document file in
/usr/share/doc/$PKG/
which might be named as follows
docfile=""
if [ -s /usr/share/doc/"$PKG"/"$pkg".html ] ; then
docfile=/usr/share/doc/"$PKG"/"$pkg".html
elif [ -s /usr/share/doc/"$PKG"/"$pkg".txt ] ; then
docfile=/usr/share/doc/"$PKG"/"$pkg".txt
elif [ -s /usr/share/doc/"$PKG"/"$pkg" ] ; then
docfile=/usr/share/doc/"$PKG"/"$pkg"
fi
if such a file exists use file to find out whether it is html or
not and call either sensible-browser or sensible-pager. So the
resulting menu entry looks like
?package(dep_a): needs="text" \
section="CDD/Task" \
title="dep_A" \
command="sensible-<something> $docfile" \
hints="<html-title> / first line of text"
3. If the meta package maintainer does not use these chances for
intervention in the user menu it is obtained automagically from
the normal package menu. The only change to this file is that
the section entry is changed to "CDD/Task". This enables easily
following package maintainer changes without changing the meta
package. On the other hand we pay the price that we have not the
freedom to add menu hints or whatever. Bothering package maintainers
with bug reports (and patches) would help here and enhances general
Debian quality as a whole.
4. I'm currently thinking about creating a menu entry as last option
if all else fails which just prints the package description and
recommends to read /usr/share/doc/<dep_A> by using the sensible-pager.
Comments?
Kind regards
Andreas.
Reply to: