Subject: Re: HEADS UP: Alternatives system added
To: Pavel Cahyna <pavel.cahyna@st.mff.cuni.cz>
From: Julio M. Merino Vidal <jmmv@menta.net>
List: tech-pkg
Date: 01/25/2005 22:06:01
On Tue, Jan 25, 2005 at 09:42:17PM +0100, Pavel Cahyna wrote:
> On Tue, 25 Jan 2005 14:55:12 +0100, Julio M. Merino Vidal wrote:
> 
> > Hi all,
> > 
> > as we have been discussing during the last days, I've added the alternatives
> > framework to pkgsrc and converted nvi and vim* to use it.
> > 
> > When you decide to update any of these packages, pkg_alternatives should be
> > pulled in as a dependency and, after the installation, you should be able
> > to run the installed package using the common 'vi', 'ex' and 'view' names.
> > 
> > Here are some commands to play with, assuming you have both vim and nvi
> > installed:
> > 
> >     pkg_alternatives list       # List all available packages with alternatives
> >     pkg_alternatives status nvi # Show status of all wrappers associated to nvi
> >     pkg_alternatives manual nvi # Select nvi as a default
> 
> Shouldn't there be also
> 
> pkg_alternatives list vi    # List all available packages which provide vi
> pkg_alternatives display vi # show status of the vi wrapper
> pkg_alternatives manual vi nvi # Select nvi as a default for vi

You should read the manual page.  In the previous mail, I said "_some_
commands to play with", but there are much more.

> Why is the latter needed? Suppose that openssh is an alternative for 1/
> ssh (the other alternative being ssh2) and 2/ rsh (the other alternative
> being e.g. heimdal). One then would want to handle those cases separately.
> E.g. select openssh as default for ssh, but heimdal for rsh. Etc.

In this case, openssh could register itself as an alternative for ssh,
ssh2 and rsh.

You can set openssh as the default as a whole group of wrappers (like
"pkg_alternatives manual openssh"), which could select all the binaries
provided by it as the defaults for ssh, ssh2 and rsh.

But you can tune each independent wrapper to suit your needs (as in
"pkg_alternatives -w manual bin/ssh /usr/pkg/bin/openssh-ssh" or
however the binary could be called).

Hope this helps,

-- 
Julio M. Merino Vidal <jmmv@menta.net>
The NetBSD Project - http://www.NetBSD.org/