To use update-alternatives --install <master link> <name> <path> <pri> ..., one needs an option
in update-alternatives to find the master link if <name> has just one alternative installed.
This is the symbolic link that points to the /etc/alternatives/<name>
For example, suppose one wants to install a new alternative to 'rename':
jack@berkeley:tmp => ls -lt /etc/alternatives/rename
0 lrwxrwxrwx 1 root root 16 Jan 15 17:04 /etc/alternatives/rename -> /usr/bin/prename
There is no option in update-alternatives to find the master link that points to /etc/alternatives/rename:
jack@berkeley:tmp => update-alternatives --config rename
There is only one alternative in link group rename: /usr/bin/prename
Nothing to configure.
jack@berkeley:tmp => update-alternatives --display rename
rename - auto mode
link currently points to /usr/bin/prename
/usr/bin/prename - priority 60
slave rename.1.gz: /usr/share/man/man1/prename.1.gz
Current 'best' version is '/usr/bin/prename'.
The only workaround is to look at the /var/lib/dpkg/alternatives file:
jack@berkeley:tmp => cat /var/lib/dpkg/alternatives/rename
/usr/bin/rename <<<<<<<< this is needed for new install <<<<<<
jack@berkeley:tmp => ls -lt /usr/bin/rename
0 lrwxrwxrwx 1 root root 24 Jan 15 17:04 /usr/bin/rename -> /etc/alternatives/rename*
If update-alternatives is the interface to the alternatives system, it should provide the all information
needed to install a new alternative in all cases.
This fails if there is exactly one alternative installed but works if multiple alternatives are installed:
jack@berkeley:tmp => update-alternatives --config java
There are 5 choices for the alternative java (providing /usr/bin/java). <<<<<<<< this is needed for new install <<<<<<