kawa.sh.in 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. #!@KAWA_SHELL@
  2. thisfile=`command -v $0`
  3. case "$thisfile" in
  4. "") echo "installation error - can't find path to $0"; exit -1 ;;
  5. /*) ;;
  6. *) thisfile="$PWD/$thisfile" ;;
  7. esac
  8. while test -L "$thisfile"; do thisfile=$(readlink -f "$thisfile"); done
  9. thisdir=`dirname "$thisfile"`
  10. kawadir=`echo "$thisdir" | sed -e 's|/bin\(/\.\)*$||'`
  11. if [ "$#" -eq 0 ]
  12. then
  13. command_line="$0"
  14. else
  15. command_line="$0 $*"
  16. fi
  17. test -t 0 || no_console="--no-console"
  18. # If configured with --enable-kawa-frontend then kawa.sh is
  19. # only used for pre-install testing. In that case
  20. # we don't need to set KAWALIB, since kawapath.c looks for it in "..".
  21. @ENABLE_KAWA_FRONTEND_TRUE@ LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$thisdir
  22. @ENABLE_KAWA_FRONTEND_TRUE@ export LD_LIBRARY_PATH
  23. @ENABLE_KAWA_FRONTEND_TRUE@ exec $thisdir/kawa "$@"
  24. KAWALIB=${KAWALIB-"`@CYGPATH_W@ $kawadir/lib/kawa.jar`"}
  25. # MSYS: KAWALIB=${KAWALIB-"`cd $kawadir/lib/; pwd -W`@CLASSPATH_SEPARATOR@kawa.jar`"}
  26. CLASSPATH="${KAWALIB}@CLASSPATH_SEPARATOR@@run_classpath@${CLASSPATH}"
  27. export CLASSPATH
  28. if test -n "$JAVA_HOME"; then
  29. JAVA="${JAVA_HOME}/bin/java"
  30. else
  31. JAVA=${JAVA-java}
  32. fi
  33. # This ugly duplication is so we only have to use arrays and substrings
  34. # (which are non-Posix and non-portable) if there is a -D or -J option.
  35. case "$1" in
  36. -D* | -J*)
  37. i=0
  38. for arg in "$@"; do
  39. case "$arg" in
  40. -D*)
  41. jvm_args[i++]="$arg"
  42. shift
  43. ;;
  44. -J*)
  45. jvm_args[i++]="${arg:2}"
  46. shift
  47. ;;
  48. *) break
  49. ;;
  50. esac
  51. done
  52. exec ${JAVA} -Dkawa.command.line="${command_line}" -Dkawa.command.pid="$$" -Dkawa.home="${kawadir}" "${jvm_args[@]}" kawa.repl ${no_console} "$@"
  53. ;;
  54. *)
  55. exec ${JAVA} -Dkawa.command.line="${command_line}" -Dkawa.command.pid="$$" -Dkawa.home="${kawadir}" kawa.repl ${no_console} "$@"
  56. ;;
  57. esac