[lsb-discuss] How to handle man pages in packages installed into/opt

Till Kamppeter till.kamppeter at gmail.com
Mon Apr 9 09:14:20 PDT 2007

Wichmann, Mats D wrote:
> lsb-discuss-bounces at lists.freestandards.org wrote:
>> Hi,
>> I am packaging printer drivers to be installed in /opt and to
>> make them
>> being found in the system I put symlinks into system directories (like
>> /usr/share/ppd), or set environment variables (like $PATH).
>> Now I have a problem: Some drivers (like Gutenprint) have also
>> some man
>> pages for the command line printer maintenance tools. The man pages of
>> Gutenprint get installed into the directories
>> /opt/gutenprint/man/man?/
>> and there is no variable like $MANPATH and man does not search any
>> directory recursively, as CUPS does with PPDs (one could set a
>> directory symlink then). What is the easiest way to make these man
>> pages visible for man on an LSB-compliant distro?
> Just so somebody has answered:
> the theory was to add a MANPATH addition in an /etc/profile.d script.

There is a $MANPATH variable, but it is of limited use, as if you set 
it, all other search locations of man are deactivated. So you need to 
find out these locations and add them to $MANPATH if you want to use 

In the build environment with installed Gutenprint (my LSB package) you get

man ls -> OK
MANPATH=/opt/gutenprint/man/ man ls -> not found
MANPATH=/opt/gutenprint/man/ man escputil -> OK
MANPATH=/opt/gutenprint/man/:/usr/share/man/ man ls -> OK
MANPATH=/opt/gutenprint/man/:/usr/share/man/ man escputil -> OK

To find the system's manpath there is no unique solution (another hole 
in the LSB). Ubuntu (and probably also Debian) shows it with the command 
"manpath", the LSB build environment needs "man --path". So assuming if 
all distros use one of these methods, the ugly piece of code to add to 
/etc/profile(.d) by a package's maintainer script would be

oldmanpath=`manpath 2>/dev/null` || oldmanpath=`man --path 2>/dev/null`
export MANPATH=/opt/PACKAGE/man:$oldmanpath
unset oldmanpath


More information about the lsb-discuss mailing list