Date: Sunday, August 3, 2014 @ 20:46:57 Author: guillaume Revision: 219262
Add check of JAVA_HOME to archlinux-java Modified: java-common/trunk/bin_archlinux-java --------------------+ bin_archlinux-java | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) Modified: bin_archlinux-java =================================================================== --- bin_archlinux-java 2014-08-03 14:45:31 UTC (rev 219261) +++ bin_archlinux-java 2014-08-03 18:46:57 UTC (rev 219262) @@ -21,6 +21,17 @@ fi } +check_java_home() { + if [ "x${JAVA_HOME}" != "x${DEFAULT_PATH}" ]; then + echo "JAVA_HOME is not set to '${DEFAULT_PATH}'," + echo 'which means this script may not provide the expected result.' + echo 'To fix this, please ensure '/etc/profile.d/jre.sh' sets JAVA_HOME' + echo 'accordingly and that no other profile script interfer.' + echo 'You may also need to relogin in order for this variable to be set.' + exit 1 + fi +} + # $1: parameter count given to this script for this option # $2: expected parameter count for this option check_param_count() { @@ -174,11 +185,11 @@ ## Main case $1 in - 'status') do_status;; - 'get') do_get;; - 'set') check_root; check_param_count $# 2; do_set $2;; - 'unset') check_root; do_unset;; - 'fix') check_root; do_fix;; + 'status') check_java_home; do_status;; + 'get') check_java_home; do_get;; + 'set') check_java_home; check_root; check_param_count $# 2; do_set $2;; + 'unset') check_java_home; check_root; do_unset;; + 'fix') check_java_home; check_root; do_fix;; 'help' | '--help' | '-h' | '') usage;; *) echo "$(basename $0): unknown option '$@'"; exit 1;; esac