Revision: 4417
          http://sourceforge.net/p/jump-pilot/code/4417
Author:   edso
Date:     2015-05-04 18:55:43 +0000 (Mon, 04 May 2015)
Log Message:
-----------
* fix Gentoo java version '' insufficient bug
  http://sourceforge.net/p/jump-pilot/feature-requests/221
* java version check now more robust, warns only if version 
  cannot be detected properly
* follow links to oj_linux.sh now indefinitely
* resolve JUMP_HOME now without . and ..

Modified Paths:
--------------
    core/trunk/ChangeLog
    core/trunk/scripts/oj_linux.sh

Modified: core/trunk/ChangeLog
===================================================================
--- core/trunk/ChangeLog        2015-05-04 13:07:23 UTC (rev 4416)
+++ core/trunk/ChangeLog        2015-05-04 18:55:43 UTC (rev 4417)
@@ -1,4 +1,14 @@
 # for display continuity sake please use 2 spaces instead of tabs
+
+2015-05-04 ede
+  oj_linux.sh
+  * fix Gentoo java version '' insufficient bug
+  http://sourceforge.net/p/jump-pilot/feature-requests/221
+  * java version check now more robust, warns only if version 
+    cannot be detected properly
+  * follow links to oj_linux.sh now indefinitely
+  * resolve JUMP_HOME now without . and ..
+
 2015-04-12 Giuseppe Aruta <giuseppe_ar...@yahoo.it>
   * Raster Color Editor Panel. Added an option to invert color range and an 
option to set
     values outside choosen range to transparent. Optimized color ramp. Added 
more color ramps

Modified: core/trunk/scripts/oj_linux.sh
===================================================================
--- core/trunk/scripts/oj_linux.sh      2015-05-04 13:07:23 UTC (rev 4416)
+++ core/trunk/scripts/oj_linux.sh      2015-05-04 18:55:43 UTC (rev 4417)
@@ -32,6 +32,9 @@
   expr "$1" : '^[0-9][0-9]*\.[0-9][0-9]*$' > /dev/null 2>&1
 }
 
+## check if parameter is an absolute path
+relPath(){ echo "$@" | awk '/^\//{exit 1}'; }
+
 ## end function, delays closing of terminal
 end(){
   # show error for some time to prohibit window closing on X
@@ -78,13 +81,20 @@
   postinstall "$1"
 }
 
-## detect home folder
-if(test -L "$0") then
-  auxlink=`ls -l "$0" | sed 's/^[^>]*-> //g'`
-  JUMP_HOME=`dirname "$auxlink"`/..
-else 
-  JUMP_HOME=`dirname "$0"`/..
-fi
+ME="$0"
+## absolutify home folder
+relPath "$ME" && ME="$(pwd)/$ME"
+# filter multiple // and ./ and replace ..
+ME=$(echo "$ME"|awk 
'{gsub(/\/+/,"/",$0);gsub(/\/\.\//,"/",$0);while($0~/\/\.\.\//&&last!=$0){last=$0;gsub(/\/([\.][^\.]|[^\.][\.]|[^\.][^\.]|[^\/][^\/][^\/]+)\/\.\.\//,"/",$0);};print}')
+# resolv possible link to our actual location 
+while [ -L "$ME" ]; do
+  MEBASE=$(dirname "$ME")
+  ME=$(readlink -n "$ME")
+  relPath "$ME" && ME="$MEBASE/$ME"
+done
+JUMP_HOME=$(dirname $(dirname "$ME"))
+echo ---JUMP_HOME---
+echo $JUMP_HOME
 
 ## run postinstalls only, if requested
 case "$1" in
@@ -116,8 +126,9 @@
     # check availability and issue warning in case
   fi
 fi
-[ ! -d "$JUMP_SETTINGS" ] || [ ! -w "$JUMP_SETTINGS" ] && \
+if [ ! -d "$JUMP_SETTINGS" ] || [ ! -w "$JUMP_SETTINGS" ]; then 
   echo "Warning: Cannot access settings folder '$JUMP_SETTINGS' for writing."
+fi
 
 ## search java, order is:
 # 1. first in oj_home/jre
@@ -139,11 +150,15 @@
 add the location of java to your PATH environment variable." && ERROR=1 && end
 
 # resolve recursive links to java binary
-relPath(){ echo $1 | awk '/^\//{exit 1}'; }
 relPath "$JAVA" && JAVA="$(pwd)/$JAVA"
 while [ -L "${JAVA}" ]; do
   JDIR=$(dirname "$JAVA")
-  JAVA=$(readlink -n "${JAVA}")
+  JAVA_CANDIDATE=$(readlink -n "${JAVA}")
+  # protect against Gentoo's run-java-tool.bash wrapper
+  if [ $(basename "$JAVA") != $(basename "$JAVA_CANDIDATE") ]; then
+    break
+  fi
+  JAVA="$JAVA_CANDIDATE"
   relPath "$JAVA" && JAVA="${JDIR}/${JAVA}"
 done
 # java executable file?
@@ -155,7 +170,14 @@
 JAVA_VERSION=$(echo $JAVA_VERSIONSTRING | awk -F'"' '/^java version/{print 
$2}' | awk -F'.' '{print $1"."$2}')
 JAVA_ARCH=$(echo $JAVA_VERSIONSTRING | grep -q -i 64-bit && echo x64 || echo 
x86)
 JAVA_NEEDED="1.6"
-if ! is_decimal "$JAVA_VERSION" || ! awk "BEGIN{if($JAVA_VERSION < 
$JAVA_NEEDED)exit 1}"; then
+if ! is_decimal "$JAVA_VERSION"; then
+  echo "Warning! Your java version could not be detected properly. Please 
report this issue to the OJ developer list. The result was
+---JAVA_VERSIONSTRING---
+$JAVA_VERSIONSTRING
+---JAVA_VERSION---
+$JAVA_VERSION
+---"
+elif ! awk "BEGIN{if($JAVA_VERSION < $JAVA_NEEDED)exit 1}"; then
   echo "Your java version '$JAVA_VERSION' is insufficient to run OpenJUMP.
 Please provide an at least a version '$JAVA_NEEDED' Java Runtime."
   ERROR=1
@@ -163,8 +185,9 @@
 fi
 
 # always print java infos
-echo "Using '$(basename "${JAVA}")' found in '$(dirname "${JAVA}")"
-echo $("$JAVA" -version 2>&1|awk 'BEGIN{ORS=""}{print $0"; "}')
+echo ---JAVA---
+echo "Using '$(basename "${JAVA}")' found in '$(dirname "${JAVA}")'"
+"$JAVA" -version 2>&1|awk 'BEGIN{ORS=""}{print $0"; "}END{print "\n"}'
 
 JUMP_PROFILE=~/.jump/openjump.profile
 if [ -f "$JUMP_PROFILE" ]; then
@@ -294,4 +317,4 @@
 cd "$OLD_DIR"
 
 ## run end function
-end
\ No newline at end of file
+end


------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel

Reply via email to