Created
November 20, 2013 19:18
-
-
Save solidsnack/7569266 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
set -o errexit -o nounset -o pipefail | |
function -h { | |
cat <<USAGE | |
USAGE: ln_libjvm.bash | |
Symlink a likely libjvm.so into /usr/bin. | |
USAGE | |
}; function --help { -h ;} | |
export LC_ALL=en_US.UTF-8 | |
function main { | |
ln_libjvm | |
} | |
function ln_libjvm { | |
# Expand glob to get likely SOs. | |
local libjvms=( /usr/lib/jvm/java-*-openjdk-*/jre/lib/*/server/libjvm.so ) | |
if [[ -f ${libjvms[0]} ]] | |
then sudo ln -nsf "${libjvms[0]}" /usr/lib/libjvm.so | |
else err "Not a file: ${libjvms[0]}" | |
fi | |
} | |
function msg { out "$*" >&2 ;} | |
function err { local x=$? ; msg "$*" ; return $(( $x == 0 ? 1 : $x )) ;} | |
function out { printf '%s\n' "$*" ;} | |
if [[ ${1:-} ]] && declare -F | cut -d' ' -f3 | fgrep -qx -- "${1:-}" | |
then "$@" | |
else main "$@" | |
fi |
(I agree regarding help text)
Another way to do this would be to create a text file /etc/ld.so.conf.d/jvm.conf
containing the path to the directory containing libjvm.so - then run ldconfig
to pick it up. This makes all .so files in that directory available.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I believe the help should read 'Symlink a likely libjvm.so into /usr/lib.'