Created
April 26, 2013 02:24
-
-
Save malaverdiere/5464724 to your computer and use it in GitHub Desktop.
Update JDK alternatives to Oracle JDK on openSUSE systems.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
#This program is free software: you can redistribute it and/or modify | |
#it under the terms of the GNU General Public License as published by | |
#the Free Software Foundation, either version 3 of the License, or | |
#(at your option) any later version. | |
# | |
#This program is distributed in the hope that it will be useful, | |
#but WITHOUT ANY WARRANTY; without even the implied warranty of | |
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
#GNU General Public License for more details. | |
# | |
#You should have received a copy of the GNU General Public License | |
#along with this program. If not, see <http://www.gnu.org/licenses/>. | |
#Before running this script, you need to have installed the Oracle JDK from the RPM | |
#In case icedtea-web is installed, you need to re-run the script whenever the IcedTea Firefox plug-in is updated. | |
#Original inspiration http://www.freetechie.com/blog/installing-oracle-sun-java-jrejdk-1-7-update-7-on-opensuse-12-2-x86_64/ | |
echo "Updating Java plugin" | |
sudo /usr/sbin/update-alternatives --install "/usr/lib64/browser-plugins/javaplugin.so" "javaplugin" "/usr/java/latest/jre/lib/amd64/libnpjp2.so" 20000 | |
for exec in /usr/java/latest/bin/* | |
do | |
matchingBase=${exec##*/} #String manipulation from here: http://stackoverflow.com/questions/2664740/extract-file-basename-without-path-and-extension-in-bash | |
matching=/usr/bin/$matchingBase | |
if [ -x $exec ] && [ -x $matching ] | |
then | |
echo "sudo /usr/sbin/update-alternatives --install \"$matching\" \"$matchingBase\" \"$exec\" 20000" | |
sudo /usr/sbin/update-alternatives --install "$matching" "$matchingBase" "$exec" 20000 | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you for this great script. I'm trying now to add it the updating of browser-plugins "libnpjp2.so").
Update: Jaheoo did it before me: https://gist.github.com/jaehoo/a39c7bfba1cd7673932e