Subject: Re: Alternatives system, 2nd round
To: Jeremy C. Reed <reed@reedmedia.net>
From: Julio M. Merino Vidal <jmmv84@gmail.com>
List: tech-pkg
Date: 01/21/2005 20:33:55
On Fri, 2005-01-21 at 09:59 -0800, Jeremy C. Reed wrote:
> How does it generate the man pages? And how do users use the man pages?
> (do they have to look twice?)
It is based on a template that basically says "this is a wrapper program
for this other utility. use the following command to see which binary
it's pointing to and then see its man page". Check the wrapper.man file
included in the tarball.
We can't do any better without symlinks. But I'm against them because
all the reasons given in the other mail (mainly because they can break
and because they won't be customizable by the user).
> And do you have an example on how I can use this with pdq as a lpr
> replacement? pdq has different switches but does same basic functionality
> like "cat foo.ps | pdq" and "pdq foo.ps".
>
> (I have only looked at the diff and not the tarball yet.)
You could do something like what's in the nvi package:
ALTERNATIVES_WRAPPERS= bin/lpq bin/lpr
ALTERNATIVES_CMDS.bin/lpq+= "${PREFIX}/pdq -some-flag"
ALTERNATIVES_CMDS.bin/lpr+= "${PREFIX}/pdq -some-other-flag"
(I'm not sure if the quotes will work here to group the command with
its arguments... this is something I still have to verify.)
You can even create wrappers by hand (although they won't be known by
any package; this is something easy to fix):
$ alternatives register bin/lpq /usr/pkg/bin/pdq -some-flag
$ alternatives register bin/lpd /usr/pkg/bin/pdq -some-other-flag
Cheers,
--
Julio M. Merino Vidal <jmmv84@gmail.com>
http://www.livejournal.com/users/jmmv/
The NetBSD Project - http://www.NetBSD.org/