| 1 | #!/bin/sh |
| 2 | |
| 3 | # create symlink for the active jvm |
| 4 | cd /usr/lib/jvm |
| 5 | |
| 6 | # the link "forced-jvm" is created by an user to explicitly use a specific jvm |
| 7 | if [ -x forced-jvm ]; then |
| 8 | ln -sfn forced-jvm default-jvm |
| 9 | else |
| 10 | # if no "forced-jvm" is present, then the latest installed version is taken |
| 11 | LATEST=`ls -d java-*/bin/java | sort -Vr | head -1 | cut -d/ -f1` |
| 12 | if [ "$LATEST" ]; then |
| 13 | ln -sfn $LATEST default-jvm |
| 14 | fi |
| 15 | fi |
| 16 | |
| 17 | # clean up dangling symlinks |
| 18 | for link in $(find -L /usr/bin -type l -print); do |
| 19 | case "$(readlink $link)" in ../lib/jvm/*) |
| 20 | rm "$link" |
| 21 | ;; |
| 22 | esac |
| 23 | done |
| 24 | |
| 25 | # create program links for the currently active jre |
| 26 | cd /usr/bin |
| 27 | find ../lib/jvm/default-jvm/bin -mindepth 1 -type f -exec ln -sfn {} . \; |
| 28 | |