From e8b57a53b874cb6155f10f53a9521218f891ceae Mon Sep 17 00:00:00 2001 From: hjp Date: Mon, 23 May 2005 09:12:18 +0000 Subject: [PATCH] Check if apppath is available before trying to use it. --- .zjava | 126 ++++++++++++++++++++++++++++++--------------------------- 1 file changed, 67 insertions(+), 59 deletions(-) diff --git a/.zjava b/.zjava index 8de42d9..e369d2b 100644 --- a/.zjava +++ b/.zjava @@ -1,66 +1,74 @@ -for i in /usr/java/j2sdk1.4.2_03 /usr/local/j2sdk1.4.2 /usr/local/j2sdk1.4.1 /usr/java/j2sdk1.4.0 \ - /usr/java/jdk1.3.1_02 /usr/java/jre1.3.1_02 \ - /usr/local/jdk1.2.2 /usr/java1.2 /usr/local/jdk1.2 \ - /usr/local/jdk117_v3 /usr/local/jdk1.1.6 \ - /usr/local/java -do - if [ -d "$i/bin" ] - then - PATH=$(apppath "$i/bin") - export JAVA_HOME=$i - break; - fi -done +# setup java environment. +# +# This file uses apppath. Since it would clobber the PATH variable if apppath +# isn't in the path, we just skip everything in this case. -ALL_PATH=.:/usr/local/java/classes:$ORACLE_HOME/jdbc/lib/classes111.zip:/usr/java1.2/lib/tools.jar:/usr/local/jswdk-1.0.1/lib/servlet.jar:/usr/local/java/lib/Tidy.jar:/usr/local/roxen/2.1/roxen/server/java/classes/servlet.jar -NEW_PATH="" - -for i in ${(s/:/)ALL_PATH} -do - if test -r "$i" +if whence apppath > /dev/null +then + for i in /usr/java/j2sdk1.4.2_03 /usr/local/j2sdk1.4.2 /usr/local/j2sdk1.4.1 /usr/java/j2sdk1.4.0 \ + /usr/java/jdk1.3.1_02 /usr/java/jre1.3.1_02 \ + /usr/local/jdk1.2.2 /usr/java1.2 /usr/local/jdk1.2 \ + /usr/local/jdk117_v3 /usr/local/jdk1.1.6 \ + /usr/local/java + do + if [ -d "$i/bin" ] then - case "$NEW_PATH" in - $i:*|*:$i|*:$i:*) ;; - *) - if test -z "$NEW_PATH" - then - NEW_PATH=$i - else - NEW_PATH=$NEW_PATH:$i - fi - esac + PATH=$(apppath "$i/bin") + export JAVA_HOME=$i + break; fi -done + done -export CLASSPATH=$NEW_PATH + ALL_PATH=.:/usr/local/java/classes:$ORACLE_HOME/jdbc/lib/classes111.zip:/usr/java1.2/lib/tools.jar:/usr/local/jswdk-1.0.1/lib/servlet.jar:/usr/local/java/lib/Tidy.jar:/usr/local/roxen/2.1/roxen/server/java/classes/servlet.jar + NEW_PATH="" -for i in /usr/local/tomcat -do - if [ -d "$i" ] - then - export CATALINA_HOME="$i" - export TOMCAT_HOME="$i" - PATH=$(apppath "$i/bin") - break; - fi -done + for i in ${(s/:/)ALL_PATH} + do + if test -r "$i" + then + case "$NEW_PATH" in + $i:*|*:$i|*:$i:*) ;; + *) + if test -z "$NEW_PATH" + then + NEW_PATH=$i + else + NEW_PATH=$NEW_PATH:$i + fi + esac + fi + done -for i in /usr/local/ant -do - if [ -d "$i" ] - then - export ANT_HOME="$i" - PATH=$(apppath "$i/bin") - break; - fi -done + export CLASSPATH=$NEW_PATH -for i in /usr/local/openxchange -do - if [ -d "$i" ] - then - export OX_HOME="$i" - PATH=$(apppath "$i/bin" "$i/sbin") - break; - fi -done + for i in /usr/local/tomcat + do + if [ -d "$i" ] + then + export CATALINA_HOME="$i" + export TOMCAT_HOME="$i" + PATH=$(apppath "$i/bin") + break; + fi + done + + for i in /usr/local/ant + do + if [ -d "$i" ] + then + export ANT_HOME="$i" + PATH=$(apppath "$i/bin") + break; + fi + done + + for i in /usr/local/openxchange + do + if [ -d "$i" ] + then + export OX_HOME="$i" + PATH=$(apppath "$i/bin" "$i/sbin") + break; + fi + done +fi