Better way to add alternative using update-alternatives?
27
votes
4
answers
61342
views
I've looked up the manual of
update-alternatives
several times but I can't find out how to show the current link pointing to a specific alternative, and that information is needed when adding a new alternative.
From the update-alternatives
manual:
--install
Let's say I want to add a new version of Java Runtime Edition, but I don't know the current symlink that links to the alternative (`` parameter). What I currently do is:
sudo update-alternatives --install /tmp/randomStuff java /usr/local/java/jre1.7.0_25/bin/java 0
That command will output:
update-alternatives: renaming java link from /usr/local/bin/java to /tmp/randomStuff.
Reading the output I find out the old link that was pointing to the alternative, so I can finally run my command again with the right ` parameter, changing
/tmp/randomStuff to
/usr/local/bin/java`:
sudo update-alternatives --install /usr/local/bin/java java /usr/local/java/jre1.7.0_25/bin/java 0
That works fine, but as you see, running the command with /tmp/randomStuff
as the `` parameter is very awkward.
So, here comes the questions: (1) Are there any update-alternative
arguments that can output the current link that is pointing to a specific alternative, or (2) is there a way to install a new alternative without having to provide a new parameter, simply keeping the current ``?
Asked by pagliuca
(373 rep)
Jul 6, 2013, 03:24 PM
Last activity: Mar 19, 2025, 05:14 PM
Last activity: Mar 19, 2025, 05:14 PM