Subject: Re: Alternatives system for pkgsrc
To: Jeremy C. Reed <email@example.com>
From: Dieter Baron <firstname.lastname@example.org>
Date: 01/20/2005 21:38:00
In article <Pine.LNX.email@example.com> Jeremy wrote:
: > > I think, the choice should be recorded, so if the package is later
: > > added again, it is selected automatically. Updates are often done by
: > > removing the old versions of packages and then installing the new
: > > versions. I think the selected alternative should be the same after
: > > such an update.
: One way to keep it recorded is to keep the /etc/alternatives/vi symlink
: existing. It will point to a non-existent file (like /usr/pkg/bin/vim).
: And since nothing is pointing to it (no /usr/pkg/bin/vi symlink), all
: should be well.
Sadly, no. Say I have vim and nvi installed, with nvi being the
selected alternative. I then deinstall nvi, so vim should be
selected. When I reinstall (a newer version of) nvi, I want nvi to be
selected again. With your proposal, I would not have any working vi
in the interim.
One way to achieve this would be to keep a list of known
alternatives, sorted by preference:
- Each time a package is selected (by the user), it is placed on the
top of this list.
- When the selected package is deinstalled, the first package in the
list that is installed will be selected.
- When a package is installed that is not in the list, it is
appended to the end of the list.
- When a package is installed that precedes the currently selected
package in the list (or if no package from the list is currently
installed), it is selected.